Skip to content

Add common define for STM32H7 boards #335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/AIoTC_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@
#define HAS_TCP
#endif

#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
#define BOARD_STM32H7
#endif

/******************************************************************************
* CONSTANTS
******************************************************************************/
Expand Down
8 changes: 4 additions & 4 deletions src/ArduinoIoTCloudTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "tls/utility/CryptoUtil.h"
#endif

#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
#ifdef BOARD_STM32H7
# include "tls/utility/SHA256.h"
# include <stm32h7xx_hal_rtc_ex.h>
# include <WiFi.h>
Expand All @@ -56,7 +56,7 @@
* EXTERN
******************************************************************************/

#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
#ifdef BOARD_STM32H7
extern RTC_HandleTypeDef RTCHandle;
#endif

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

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

#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
#ifdef BOARD_STM32H7
_ota_error = portenta_h7_onOTARequest(_ota_url.c_str());
#endif
}
Expand Down
8 changes: 5 additions & 3 deletions src/utility/ota/OTA-portenta-h7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
a commercial license, send an email to [email protected].
*/

#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)

/******************************************************************************
* INCLUDE
******************************************************************************/

#include <AIoTC_Config.h>

#ifdef BOARD_STM32H7

#include "OTA.h"

#include <Arduino_DebugUtils.h>
Expand Down Expand Up @@ -87,4 +89,4 @@ int portenta_h7_onOTARequest(char const * ota_url)
NVIC_SystemReset();
}

#endif /* defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) */
#endif /* BOARD_STM32H7 */
2 changes: 1 addition & 1 deletion src/utility/ota/OTA.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int samd_onOTARequest(char const * ota_url);
int rp2040_connect_onOTARequest(char const * ota_url);
#endif

#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
#ifdef BOARD_STM32H7
int portenta_h7_onOTARequest(char const * ota_url);
#endif

Expand Down
4 changes: 2 additions & 2 deletions src/utility/watchdog/Watchdog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void mkr_nb_feed_watchdog()
static void mbed_watchdog_enable()
{
watchdog_config_t cfg;
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
#if defined(BOARD_STM32H7)
cfg.timeout_ms = PORTENTA_H7_WATCHDOG_MAX_TIMEOUT_ms;
#elif defined(ARDUINO_NANO_RP2040_CONNECT)
cfg.timeout_ms = NANO_RP2040_WATCHDOG_MAX_TIMEOUT_ms;
Expand All @@ -117,7 +117,7 @@ static void mbed_watchdog_reset()
void mbed_watchdog_trigger_reset()
{
watchdog_config_t cfg;
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
#if defined(BOARD_STM32H7)
cfg.timeout_ms = 1;
#elif defined(ARDUINO_NANO_RP2040_CONNECT)
cfg.timeout_ms = 1;
Expand Down