Skip to content

Commit 5628497

Browse files
authored
Merge pull request #335 from pennam/stm32h7-boards
Add common define for STM32H7 boards
2 parents 112ec82 + 6123f80 commit 5628497

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

src/AIoTC_Config.h

+4
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@
141141
#define HAS_TCP
142142
#endif
143143

144+
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
145+
#define BOARD_STM32H7
146+
#endif
147+
144148
/******************************************************************************
145149
* CONSTANTS
146150
******************************************************************************/

src/ArduinoIoTCloudTCP.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include "tls/utility/CryptoUtil.h"
3939
#endif
4040

41-
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
41+
#ifdef BOARD_STM32H7
4242
# include "tls/utility/SHA256.h"
4343
# include <stm32h7xx_hal_rtc_ex.h>
4444
# include <WiFi.h>
@@ -56,7 +56,7 @@
5656
* EXTERN
5757
******************************************************************************/
5858

59-
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
59+
#ifdef BOARD_STM32H7
6060
extern RTC_HandleTypeDef RTCHandle;
6161
#endif
6262

@@ -151,7 +151,7 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,
151151
#endif /* AVR */
152152

153153
#if OTA_ENABLED && !defined(__AVR__)
154-
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
154+
#if defined(BOARD_STM32H7)
155155
/* The length of the application can be retrieved the same way it was
156156
* communicated to the bootloader, that is by writing to the non-volatile
157157
* storage registers of the RTC.
@@ -829,7 +829,7 @@ void ArduinoIoTCloudTCP::onOTARequest()
829829
_ota_error = rp2040_connect_onOTARequest(_ota_url.c_str());
830830
#endif
831831

832-
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
832+
#ifdef BOARD_STM32H7
833833
_ota_error = portenta_h7_onOTARequest(_ota_url.c_str());
834834
#endif
835835
}

src/utility/ota/OTA-portenta-h7.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
a commercial license, send an email to [email protected].
1616
*/
1717

18-
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
19-
2018
/******************************************************************************
2119
* INCLUDE
2220
******************************************************************************/
2321

22+
#include <AIoTC_Config.h>
23+
24+
#ifdef BOARD_STM32H7
25+
2426
#include "OTA.h"
2527

2628
#include <Arduino_DebugUtils.h>
@@ -87,4 +89,4 @@ int portenta_h7_onOTARequest(char const * ota_url)
8789
NVIC_SystemReset();
8890
}
8991

90-
#endif /* defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) */
92+
#endif /* BOARD_STM32H7 */

src/utility/ota/OTA.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int samd_onOTARequest(char const * ota_url);
6262
int rp2040_connect_onOTARequest(char const * ota_url);
6363
#endif
6464

65-
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
65+
#ifdef BOARD_STM32H7
6666
int portenta_h7_onOTARequest(char const * ota_url);
6767
#endif
6868

src/utility/watchdog/Watchdog.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void mkr_nb_feed_watchdog()
9191
static void mbed_watchdog_enable()
9292
{
9393
watchdog_config_t cfg;
94-
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
94+
#if defined(BOARD_STM32H7)
9595
cfg.timeout_ms = PORTENTA_H7_WATCHDOG_MAX_TIMEOUT_ms;
9696
#elif defined(ARDUINO_NANO_RP2040_CONNECT)
9797
cfg.timeout_ms = NANO_RP2040_WATCHDOG_MAX_TIMEOUT_ms;
@@ -117,7 +117,7 @@ static void mbed_watchdog_reset()
117117
void mbed_watchdog_trigger_reset()
118118
{
119119
watchdog_config_t cfg;
120-
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
120+
#if defined(BOARD_STM32H7)
121121
cfg.timeout_ms = 1;
122122
#elif defined(ARDUINO_NANO_RP2040_CONNECT)
123123
cfg.timeout_ms = 1;

0 commit comments

Comments
 (0)