diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp index 9f24275905..6177980390 100644 --- a/cores/arduino/HardwareSerial.cpp +++ b/cores/arduino/HardwareSerial.cpp @@ -182,6 +182,16 @@ void HardwareSerial::init(void) _serial.tx_tail = 0; } +void HardwareSerial::configForLowPower(void) +{ +#if defined(HAL_PWR_MODULE_ENABLED) && defined(UART_IT_WUF) + // Reconfigure properly Serial instance to use HSI as clock source + end(); + uart_config_lowpower(&_serial); + begin(_serial.baudrate, _config); +#endif +} + // Actual interrupt handlers ////////////////////////////////////////////////////////////// void HardwareSerial::_rx_complete_irq(serial_t* obj) @@ -226,6 +236,7 @@ void HardwareSerial::begin(unsigned long baud, byte config) uint32_t databits = 0; _serial.baudrate = (uint32_t)baud; + _config = config; // Manage databits switch(config & 0x07) { diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h index 81a48add5f..dff7163745 100644 --- a/cores/arduino/HardwareSerial.h +++ b/cores/arduino/HardwareSerial.h @@ -125,11 +125,15 @@ class HardwareSerial : public Stream void setRx(PinName _rx); void setTx(PinName _tx); + friend class STM32LowPower; + // Interrupt handlers static void _rx_complete_irq(serial_t* obj); static int _tx_complete_irq(serial_t* obj); private: + uint8_t _config; void init(void); + void configForLowPower(void); }; extern HardwareSerial Serial1; diff --git a/cores/arduino/board.h b/cores/arduino/board.h index 3ca81179e2..00e207e62a 100644 --- a/cores/arduino/board.h +++ b/cores/arduino/board.h @@ -14,6 +14,7 @@ extern "C"{ #include "digital_io.h" #include "hal_uart_emul.h" #include "hw_config.h" +#include "low_power.h" #include "rtc.h" #include "spi_com.h" #include "stm32_eeprom.h" diff --git a/cores/arduino/stm32/PinNames.h b/cores/arduino/stm32/PinNames.h index e1ed2e7dd4..d860db33a5 100644 --- a/cores/arduino/stm32/PinNames.h +++ b/cores/arduino/stm32/PinNames.h @@ -9,7 +9,10 @@ extern "C" { #endif typedef enum { + // Not connected + NC = (int)0xFFFFFFFF, + // Pin name definition PA_0 = (PortA << 4) + 0x00, PA_1 = (PortA << 4) + 0x01, PA_2 = (PortA << 4) + 0x02, @@ -205,8 +208,11 @@ typedef enum { PK_14 = (PortK << 4) + 0x0E, PK_15 = (PortK << 4) + 0x0F, #endif - // Not connected - NC = (int)0xFFFFFFFF +// Specific pin name define in the variant +#if __has_include("PinNamesVar.h") +#include "PinNamesVar.h" +#endif + P_END = NC } PinName; #ifdef __cplusplus diff --git a/cores/arduino/stm32/low_power.c b/cores/arduino/stm32/low_power.c new file mode 100644 index 0000000000..1b47663068 --- /dev/null +++ b/cores/arduino/stm32/low_power.c @@ -0,0 +1,332 @@ +/** + ****************************************************************************** + * @file LowPower.c + * @author WI6LABS + * @version V1.0.0 + * @date 17 - November -2017 + * @brief Provides a Low Power interface + * + ****************************************************************************** + * @attention + * + *

© COPYRIGHT(c) 2017 STMicroelectronics

+ * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + +#include "Arduino.h" +#include "low_power.h" + +#ifdef HAL_PWR_MODULE_ENABLED + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef UART_IT_WUF +/* Save UART handler for callback */ +static UART_HandleTypeDef* WakeUpUart = NULL; +#endif +/* Save callback pointer */ +static void (*WakeUpUartCb)( void ) = NULL; + +/** + * @brief Initialize low power mode + * @param None + * @retval None + */ +void LowPower_init(){ + /* Enable Power Clock */ + __HAL_RCC_PWR_CLK_ENABLE(); + + /* Allow access to Backup domain */ + HAL_PWR_EnableBkUpAccess(); + + /* Reset RTC Domain */ + __HAL_RCC_BACKUPRESET_FORCE(); + __HAL_RCC_BACKUPRESET_RELEASE(); + +#ifdef __HAL_RCC_WAKEUPSTOP_CLK_CONFIG + /* Ensure that HSI is wake-up system clock */ + __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_HSI); +#endif + /* Check if the system was resumed from StandBy mode */ + if (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET) + { + /* Clear Standby flag */ + __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB); + } + + /* Clear all related wakeup flags */ + __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); +} + +/** + * @brief Configure a pin as wakeup source if compatible. + * @param pin: pin to configure + * @param mode: pin mode (edge or state). The configuration have to be compatible. + * @retval None + */ +void LowPower_EnableWakeUpPin(uint32_t pin, uint32_t mode) { +#if !defined(PWR_WAKEUP_PIN1_HIGH) + UNUSED(mode); +#endif + uint32_t wkup_pin; + PinName p = digitalPinToPinName(pin); + if (p != NC) { + switch (p) { + default : +#ifdef PWR_WAKEUP_PIN1 + case SYS_WKUP1 : + wkup_pin = PWR_WAKEUP_PIN1; +#ifdef PWR_WAKEUP_PIN1_HIGH + if (mode != RISING) { + wkup_pin = PWR_WAKEUP_PIN1_LOW; + } +#endif + break; +#endif /* PWR_WAKEUP_PIN1 */ +#ifdef PWR_WAKEUP_PIN2 + case SYS_WKUP2 : + wkup_pin = PWR_WAKEUP_PIN2; +#ifdef PWR_WAKEUP_PIN2_HIGH + if (mode != RISING) { + wkup_pin = PWR_WAKEUP_PIN2_LOW; + } +#endif + break; +#endif /* PWR_WAKEUP_PIN2 */ +#ifdef PWR_WAKEUP_PIN3 + case SYS_WKUP3 : + wkup_pin = PWR_WAKEUP_PIN3; +#ifdef PWR_WAKEUP_PIN3_HIGH + if (mode != RISING) { + wkup_pin = PWR_WAKEUP_PIN3_LOW; + } +#endif + break; +#endif /* PWR_WAKEUP_PIN3 */ +#ifdef PWR_WAKEUP_PIN4 + case SYS_WKUP4 : + wkup_pin = PWR_WAKEUP_PIN4; +#ifdef PWR_WAKEUP_PIN4_HIGH + if (mode != RISING) { + wkup_pin = PWR_WAKEUP_PIN4_LOW; + } +#endif + break; +#endif /* PWR_WAKEUP_PIN4 */ +#ifdef PWR_WAKEUP_PIN5 + case SYS_WKUP5 : + wkup_pin = PWR_WAKEUP_PIN5; +#ifdef PWR_WAKEUP_PIN5_HIGH + if (mode != RISING) { + wkup_pin = PWR_WAKEUP_PIN5_LOW; + } +#endif + break; +#endif /* PWR_WAKEUP_PIN5 */ +#ifdef PWR_WAKEUP_PIN6 + case SYS_WKUP6 : + wkup_pin = PWR_WAKEUP_PIN6; +#ifdef PWR_WAKEUP_PIN6_HIGH + if (mode != RISING) { + wkup_pin = PWR_WAKEUP_PIN6_LOW; + } +#endif + break; +#endif /* PWR_WAKEUP_PIN6 */ +#ifdef PWR_WAKEUP_PIN7 + case SYS_WKUP7 : + wkup_pin = PWR_WAKEUP_PIN7; + break; +#endif /* PWR_WAKEUP_PIN7 */ +#ifdef PWR_WAKEUP_PIN8 + case SYS_WKUP8 : + wkup_pin = PWR_WAKEUP_PIN8; + break; +#endif /* PWR_WAKEUP_PIN8 */ + } + HAL_PWR_EnableWakeUpPin(wkup_pin); + } +} + +/** + * @brief Enable the sleep mode. + * @param None + * @retval None + */ +void LowPower_sleep(uint32_t regulator){ + /* + * Suspend Tick increment to prevent wakeup by Systick interrupt. + * Otherwise the Systick interrupt will wake up the device within + * 1ms (HAL time base) + */ + HAL_SuspendTick(); + + /* Enter Sleep Mode , wake up is done once User push-button is pressed */ + HAL_PWR_EnterSLEEPMode(regulator, PWR_SLEEPENTRY_WFI); + + /* Resume Tick interrupt if disabled prior to SLEEP mode entry */ + HAL_ResumeTick(); + + if (WakeUpUartCb != NULL) { + WakeUpUartCb(); + } +} + +/** + * @brief Enable the stop mode. + * @param obj : pointer to serial_t structure + * @retval None + */ +void LowPower_stop(serial_t *obj){ + __disable_irq(); + +#ifdef UART_IT_WUF + if (WakeUpUart != NULL) { + HAL_UARTEx_EnableStopMode(WakeUpUart); + } +#endif + +#if defined(STM32L0xx) || defined(STM32L1xx) + /* Enable Ultra low power mode */ + HAL_PWREx_EnableUltraLowPower(); + + /* Enable the fast wake up from Ultra low power mode */ + HAL_PWREx_EnableFastWakeUp(); +#endif +#ifdef __HAL_RCC_WAKEUPSTOP_CLK_CONFIG + /* Select HSI as system clock source after Wake Up from Stop mode */ + __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_HSI); +#endif + + /* Enter Stop mode */ + HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); + + /* Exit Stop mode reset clocks */ + SystemClock_Config(); +#ifdef UART_IT_WUF + if (WakeUpUart != NULL) { + /* In case of WakeUp from UART, reset its clock source to HSI */ + uart_config_lowpower(obj); + HAL_UARTEx_DisableStopMode(WakeUpUart); + } +#else + UNUSED(obj); +#endif + __enable_irq(); + + HAL_Delay(10); + + if (WakeUpUartCb != NULL) { + WakeUpUartCb(); + } +} + +/** + * @brief Enable the standby mode. The board reset when leaves this mode. + * @param None + * @retval None + */ +void LowPower_standby(){ + __disable_irq(); + +#if defined(STM32L0xx) || defined(STM32L1xx) + /* Enable Ultra low power mode */ + HAL_PWREx_EnableUltraLowPower(); + + /* Enable the fast wake up from Ultra low power mode */ + HAL_PWREx_EnableFastWakeUp(); +#endif + + HAL_PWR_EnterSTANDBYMode(); +} + +/** + * @brief Enable the shutdown mode.The board reset when leaves this mode. + * If shutdown mode not available, use standby mode instead. + * @param None + * @retval None + */ +void LowPower_shutdown(){ + __disable_irq(); +#ifdef STM32L4xx + /* LSE must be on to use shutdown mode */ + if(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == SET) { + HAL_PWREx_EnterSHUTDOWNMode(); + } else +#endif + { + LowPower_standby(); + } +} + +/** + * @brief Configure the UART as a wakeup source. A callback can be called when + * the chip leaves the low power mode. See board datasheet to check + * with which low power mode the UART is compatible. + * Warning This function will change UART clock source to HSI + * @param serial: pointer to serial + * @param FuncPtr: pointer to callback + * @retval None + */ +void LowPower_EnableWakeUpUart(serial_t* serial, void (*FuncPtr)( void ) ) { +#ifdef UART_IT_WUF + UART_WakeUpTypeDef WakeUpSelection; + if(serial == NULL) { + return; + } + /* Save Uart handler and Serial object */ + WakeUpUart = &(serial->handle); + + /* make sure that no UART transfer is on-going */ + while(__HAL_UART_GET_FLAG(WakeUpUart, USART_ISR_BUSY) == SET); + /* make sure that UART is ready to receive + * (test carried out again later in HAL_UARTEx_StopModeWakeUpSourceConfig) */ + while(__HAL_UART_GET_FLAG(WakeUpUart, USART_ISR_REACK) == RESET); + + /* set the wake-up event: + * specify wake-up on RXNE flag + */ + WakeUpSelection.WakeUpEvent = UART_WAKEUP_ON_READDATA_NONEMPTY; + HAL_UARTEx_StopModeWakeUpSourceConfig(WakeUpUart, WakeUpSelection); + + /* Enable the UART Wake UP from STOP1 mode Interrupt */ + __HAL_UART_ENABLE_IT(WakeUpUart, UART_IT_WUF); +#else + UNUSED(serial); +#endif + /* Save callback */ + WakeUpUartCb = FuncPtr; +} + +#ifdef __cplusplus +} +#endif + +#endif /* HAL_PWR_MODULE_ENABLED */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/cores/arduino/stm32/low_power.h b/cores/arduino/stm32/low_power.h new file mode 100644 index 0000000000..81d5baf136 --- /dev/null +++ b/cores/arduino/stm32/low_power.h @@ -0,0 +1,71 @@ +/** + ****************************************************************************** + * @file LowPower.h + * @author WI6LABS + * @version V1.0.0 + * @date 17 - November -2017 + * @brief Header for Low Power module + ****************************************************************************** + * @attention + * + *

© COPYRIGHT(c) 2017 STMicroelectronics

+ * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __LOW_POWER_H +#define __LOW_POWER_H + +/* Includes ------------------------------------------------------------------*/ +#include "stm32_def.h" +#include "uart.h" + +#ifdef HAL_PWR_MODULE_ENABLED + +#ifdef __cplusplus + extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + +void LowPower_init(); +void LowPower_EnableWakeUpPin(uint32_t pin, uint32_t mode); +void LowPower_EnableWakeUpUart(serial_t* serial, void (*FuncPtr)( void ) ); +void LowPower_sleep(uint32_t regulator); +void LowPower_stop(serial_t *obj); +void LowPower_standby(); +void LowPower_shutdown(); + +#ifdef __cplusplus + } +#endif + +#endif /* HAL_PWR_MODULE_ENABLED */ + +#endif /* __LOW_POWER_H */ diff --git a/cores/arduino/stm32/rtc.c b/cores/arduino/stm32/rtc.c index 562d09110e..7e7d2fabcc 100644 --- a/cores/arduino/stm32/rtc.c +++ b/cores/arduino/stm32/rtc.c @@ -314,6 +314,19 @@ void RTC_init(hourFormat_t format, sourceClock_t source) { initFormat = format; + /* Enable Power Clock */ + __HAL_RCC_PWR_CLK_ENABLE(); + +#ifdef HAL_PWR_MODULE_ENABLED + /* Allow access to Backup domain */ + HAL_PWR_EnableBkUpAccess(); +#endif + /* Reset RTC Domain */ + if(source != LSE_CLOCK) { + __HAL_RCC_BACKUPRESET_FORCE(); + __HAL_RCC_BACKUPRESET_RELEASE(); + } + /* Init RTC clock */ RTC_initClock(source); diff --git a/cores/arduino/stm32/uart.c b/cores/arduino/stm32/uart.c index af72dd5fa1..dc054c758b 100644 --- a/cores/arduino/stm32/uart.c +++ b/cores/arduino/stm32/uart.c @@ -125,6 +125,7 @@ void uart_init(serial_t *obj) printf("ERROR: UART pins mismatch\n"); return; } + // Enable USART clock #if defined(USART1_BASE) else if(obj->uart == USART1) { @@ -288,6 +289,10 @@ void uart_init(serial_t *obj) huart->Init.Mode = UART_MODE_TX_RX; huart->Init.HwFlowCtl = UART_HWCONTROL_NONE; huart->Init.OverSampling = UART_OVERSAMPLING_16; +#if !defined(STM32F1xx) && !defined(STM32F2xx) && !defined(STM32F4xx)\ + && !defined(STM32L1xx) + huart->AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; +#endif // huart->Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; if(HAL_UART_Init(huart) != HAL_OK) { @@ -403,6 +408,69 @@ void uart_deinit(serial_t *obj) HAL_UART_DeInit(uart_handlers[obj->index]); } +#if defined(HAL_PWR_MODULE_ENABLED) && defined(UART_IT_WUF) +/** + * @brief Function called to configure the uart interface for low power + * @param obj : pointer to serial_t structure + * @retval None + */ +void uart_config_lowpower(serial_t *obj) +{ + if(obj == NULL) { + return; + } + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + /* Ensure HSI clock is enable */ + if(__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) == RESET) { + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; + RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct)!= HAL_OK) { + Error_Handler(); + } + } + /* Configure HSI as source clock for low power wakeup clock */ + switch (obj->index) { +#if defined(USART1_BASE) + case 0: + if (__HAL_RCC_GET_USART1_SOURCE() != RCC_USART1CLKSOURCE_HSI) { + __HAL_RCC_USART1_CONFIG(RCC_USART1CLKSOURCE_HSI); + } + break; +#endif +#if defined(USART2_BASE) && defined(__HAL_RCC_USART2_CONFIG) + case 1: + if (__HAL_RCC_GET_USART2_SOURCE() != RCC_USART2CLKSOURCE_HSI) { + __HAL_RCC_USART2_CONFIG(RCC_USART2CLKSOURCE_HSI); + } + break; +#endif +#if defined(USART3_BASE) && defined(__HAL_RCC_USART3_CONFIG) + case 2: + if (__HAL_RCC_GET_USART3_SOURCE() != RCC_USART3CLKSOURCE_HSI) { + __HAL_RCC_USART3_CONFIG(RCC_USART3CLKSOURCE_HSI); + } + break; +#endif +#if defined(UART4_BASE) && defined(__HAL_RCC_UART4_CONFIG) + case 3: + if (__HAL_RCC_GET_UART4_SOURCE() != RCC_UART4CLKSOURCE_HSI) { + __HAL_RCC_UART4_CONFIG(RCC_UART4CLKSOURCE_HSI); + } + break; +#endif +#if defined(UART5_BASE) && defined(__HAL_RCC_UART5_CONFIG) + case 4: + if (__HAL_RCC_GET_UART5_SOURCE() != RCC_UART5CLKSOURCE_HSI) { + __HAL_RCC_UART5_CONFIG(RCC_UART5CLKSOURCE_HSI); + } + break; +#endif + } +} +#endif + /** * @brief write the data on the uart * @param obj : pointer to serial_t structure @@ -866,6 +934,19 @@ void UART10_IRQHandler(void) } #endif +/** + * @brief HAL UART Call Back + * @param UART handler + * @retval None + */ +void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart) +{ + uint8_t index = uart_index(huart); + serial_t *obj = rx_callback_obj[index]; + + HAL_UART_Receive_IT(huart, &(obj->recv), 1); +} + #ifdef __cplusplus } #endif diff --git a/cores/arduino/stm32/uart.h b/cores/arduino/stm32/uart.h index 66cd5162a9..97707c80fe 100644 --- a/cores/arduino/stm32/uart.h +++ b/cores/arduino/stm32/uart.h @@ -279,6 +279,9 @@ struct serial_s { /* Exported functions ------------------------------------------------------- */ void uart_init(serial_t *obj); void uart_deinit(serial_t *obj); +#if defined(HAL_PWR_MODULE_ENABLED) && defined(UART_IT_WUF) +void uart_config_lowpower(serial_t *obj); +#endif size_t uart_write(serial_t *obj, uint8_t data, uint16_t size); int uart_getc(serial_t *obj, unsigned char* c); void uart_attach_rx_callback(serial_t *obj, void (*callback)(serial_t*)); diff --git a/variants/BLUEPILL_F103C8/PinNamesVar.h b/variants/BLUEPILL_F103C8/PinNamesVar.h new file mode 100644 index 0000000000..b65ff1991e --- /dev/null +++ b/variants/BLUEPILL_F103C8/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/BLUEPILL_F103C8/stm32f1xx_hal_conf.h b/variants/BLUEPILL_F103C8/stm32f1xx_hal_conf.h index 9369936ed5..b466615b2f 100644 --- a/variants/BLUEPILL_F103C8/stm32f1xx_hal_conf.h +++ b/variants/BLUEPILL_F103C8/stm32f1xx_hal_conf.h @@ -70,7 +70,7 @@ /*#define HAL_NOR_MODULE_ENABLED*/ /*#define HAL_PCCARD_MODULE_ENABLED*/ /*#define HAL_PCD_MODULE_ENABLED*/ -/*#define HAL_PWR_MODULE_ENABLED*/ +#define HAL_PWR_MODULE_ENABLED #define HAL_RCC_MODULE_ENABLED #define HAL_RTC_MODULE_ENABLED /*#define HAL_SD_MODULE_ENABLED*/ diff --git a/variants/DISCO_F100RB/PinNamesVar.h b/variants/DISCO_F100RB/PinNamesVar.h new file mode 100644 index 0000000000..b65ff1991e --- /dev/null +++ b/variants/DISCO_F100RB/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/DISCO_F100RB/stm32f1xx_hal_conf.h b/variants/DISCO_F100RB/stm32f1xx_hal_conf.h index 78f5c5cf4d..36a5689a7f 100644 --- a/variants/DISCO_F100RB/stm32f1xx_hal_conf.h +++ b/variants/DISCO_F100RB/stm32f1xx_hal_conf.h @@ -70,7 +70,7 @@ /*#define HAL_NOR_MODULE_ENABLED*/ /*#define HAL_PCCARD_MODULE_ENABLED*/ /*#define HAL_PCD_MODULE_ENABLED*/ -/*#define HAL_PWR_MODULE_ENABLED*/ +#define HAL_PWR_MODULE_ENABLED #define HAL_RCC_MODULE_ENABLED #define HAL_RTC_MODULE_ENABLED /*#define HAL_SD_MODULE_ENABLED*/ diff --git a/variants/DISCO_F407VG/PinNamesVar.h b/variants/DISCO_F407VG/PinNamesVar.h new file mode 100644 index 0000000000..b65ff1991e --- /dev/null +++ b/variants/DISCO_F407VG/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/DISCO_F746NG/PinNamesVar.h b/variants/DISCO_F746NG/PinNamesVar.h new file mode 100644 index 0000000000..8ec2fab4aa --- /dev/null +++ b/variants/DISCO_F746NG/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PA_2, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = PC_1, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = PI_8, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = PI_11, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/DISCO_L072CZ_LRWAN1/PinNamesVar.h b/variants/DISCO_L072CZ_LRWAN1/PinNamesVar.h new file mode 100644 index 0000000000..0b7fa5cc33 --- /dev/null +++ b/variants/DISCO_L072CZ_LRWAN1/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/DISCO_L475VG_IOT/PinNamesVar.h b/variants/DISCO_L475VG_IOT/PinNamesVar.h new file mode 100644 index 0000000000..c4331ecd62 --- /dev/null +++ b/variants/DISCO_L475VG_IOT/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = PE_6, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = PA_2, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = PC_5, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/MAPLEMINI_F103CB/PinNamesVar.h b/variants/MAPLEMINI_F103CB/PinNamesVar.h new file mode 100644 index 0000000000..b65ff1991e --- /dev/null +++ b/variants/MAPLEMINI_F103CB/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/MAPLEMINI_F103CB/stm32f1xx_hal_conf.h b/variants/MAPLEMINI_F103CB/stm32f1xx_hal_conf.h index 9369936ed5..b466615b2f 100644 --- a/variants/MAPLEMINI_F103CB/stm32f1xx_hal_conf.h +++ b/variants/MAPLEMINI_F103CB/stm32f1xx_hal_conf.h @@ -70,7 +70,7 @@ /*#define HAL_NOR_MODULE_ENABLED*/ /*#define HAL_PCCARD_MODULE_ENABLED*/ /*#define HAL_PCD_MODULE_ENABLED*/ -/*#define HAL_PWR_MODULE_ENABLED*/ +#define HAL_PWR_MODULE_ENABLED #define HAL_RCC_MODULE_ENABLED #define HAL_RTC_MODULE_ENABLED /*#define HAL_SD_MODULE_ENABLED*/ diff --git a/variants/NUCLEO_F030R8/PinNamesVar.h b/variants/NUCLEO_F030R8/PinNamesVar.h new file mode 100644 index 0000000000..0b7fa5cc33 --- /dev/null +++ b/variants/NUCLEO_F030R8/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_F030R8/stm32f0xx_hal_conf.h b/variants/NUCLEO_F030R8/stm32f0xx_hal_conf.h index d455dc3986..31cbb5dc00 100644 --- a/variants/NUCLEO_F030R8/stm32f0xx_hal_conf.h +++ b/variants/NUCLEO_F030R8/stm32f0xx_hal_conf.h @@ -66,7 +66,7 @@ //#define HAL_IRDA_MODULE_ENABLED //#define HAL_IWDG_MODULE_ENABLED //#define HAL_PCD_MODULE_ENABLED -//#define HAL_PWR_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED #define HAL_RCC_MODULE_ENABLED #define HAL_RTC_MODULE_ENABLED //#define HAL_SMARTCARD_MODULE_ENABLED diff --git a/variants/NUCLEO_F091RC/PinNamesVar.h b/variants/NUCLEO_F091RC/PinNamesVar.h new file mode 100644 index 0000000000..ec995a0089 --- /dev/null +++ b/variants/NUCLEO_F091RC/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = PE_6, /* manually updated */ +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = PA_2, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = PC_5, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = PB_5, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = PB_15, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = PF_2, /* manually updated */ +#endif diff --git a/variants/NUCLEO_F091RC/stm32f0xx_hal_conf.h b/variants/NUCLEO_F091RC/stm32f0xx_hal_conf.h index c7c47dcb91..45a08eabe7 100644 --- a/variants/NUCLEO_F091RC/stm32f0xx_hal_conf.h +++ b/variants/NUCLEO_F091RC/stm32f0xx_hal_conf.h @@ -66,7 +66,7 @@ //#define HAL_IRDA_MODULE_ENABLED //#define HAL_IWDG_MODULE_ENABLED //#define HAL_PCD_MODULE_ENABLED -//#define HAL_PWR_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED #define HAL_RCC_MODULE_ENABLED #define HAL_RTC_MODULE_ENABLED //#define HAL_SMARTCARD_MODULE_ENABLED diff --git a/variants/NUCLEO_F103RB/PinNamesVar.h b/variants/NUCLEO_F103RB/PinNamesVar.h new file mode 100644 index 0000000000..b65ff1991e --- /dev/null +++ b/variants/NUCLEO_F103RB/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_F103RB/stm32f1xx_hal_conf.h b/variants/NUCLEO_F103RB/stm32f1xx_hal_conf.h index 9369936ed5..b466615b2f 100644 --- a/variants/NUCLEO_F103RB/stm32f1xx_hal_conf.h +++ b/variants/NUCLEO_F103RB/stm32f1xx_hal_conf.h @@ -70,7 +70,7 @@ /*#define HAL_NOR_MODULE_ENABLED*/ /*#define HAL_PCCARD_MODULE_ENABLED*/ /*#define HAL_PCD_MODULE_ENABLED*/ -/*#define HAL_PWR_MODULE_ENABLED*/ +#define HAL_PWR_MODULE_ENABLED #define HAL_RCC_MODULE_ENABLED #define HAL_RTC_MODULE_ENABLED /*#define HAL_SD_MODULE_ENABLED*/ diff --git a/variants/NUCLEO_F207ZG/PinNamesVar.h b/variants/NUCLEO_F207ZG/PinNamesVar.h new file mode 100644 index 0000000000..b65ff1991e --- /dev/null +++ b/variants/NUCLEO_F207ZG/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_F302R8/PinNamesVar.h b/variants/NUCLEO_F302R8/PinNamesVar.h new file mode 100644 index 0000000000..0b7fa5cc33 --- /dev/null +++ b/variants/NUCLEO_F302R8/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_F302R8/stm32f3xx_hal_conf.h b/variants/NUCLEO_F302R8/stm32f3xx_hal_conf.h index 9585e0e819..39ab432930 100644 --- a/variants/NUCLEO_F302R8/stm32f3xx_hal_conf.h +++ b/variants/NUCLEO_F302R8/stm32f3xx_hal_conf.h @@ -72,7 +72,7 @@ // #define HAL_IWDG_MODULE_ENABLED // #define HAL_OPAMP_MODULE_ENABLED // #define HAL_PCD_MODULE_ENABLED -// #define HAL_PWR_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED #define HAL_RCC_MODULE_ENABLED #define HAL_RTC_MODULE_ENABLED // #define HAL_SDADC_MODULE_ENABLED diff --git a/variants/NUCLEO_F303K8/PinNamesVar.h b/variants/NUCLEO_F303K8/PinNamesVar.h new file mode 100644 index 0000000000..51e79ef6a5 --- /dev/null +++ b/variants/NUCLEO_F303K8/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PC_13, /* manually updated */ +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_F303RE/PinNamesVar.h b/variants/NUCLEO_F303RE/PinNamesVar.h new file mode 100644 index 0000000000..45099dfe6c --- /dev/null +++ b/variants/NUCLEO_F303RE/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = PE_6, /* manually updated */ +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_F303RE/stm32f3xx_hal_conf.h b/variants/NUCLEO_F303RE/stm32f3xx_hal_conf.h index 3a09bb6299..ecb7c07a8d 100644 --- a/variants/NUCLEO_F303RE/stm32f3xx_hal_conf.h +++ b/variants/NUCLEO_F303RE/stm32f3xx_hal_conf.h @@ -72,7 +72,7 @@ // #define HAL_IWDG_MODULE_ENABLED // #define HAL_OPAMP_MODULE_ENABLED // #define HAL_PCD_MODULE_ENABLED -// #define HAL_PWR_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED #define HAL_RCC_MODULE_ENABLED #define HAL_RTC_MODULE_ENABLED // #define HAL_SDADC_MODULE_ENABLED diff --git a/variants/NUCLEO_F401RE/PinNamesVar.h b/variants/NUCLEO_F401RE/PinNamesVar.h new file mode 100644 index 0000000000..b65ff1991e --- /dev/null +++ b/variants/NUCLEO_F401RE/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_F411RE/PinNamesVar.h b/variants/NUCLEO_F411RE/PinNamesVar.h new file mode 100644 index 0000000000..b65ff1991e --- /dev/null +++ b/variants/NUCLEO_F411RE/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_F429ZI/PinNamesVar.h b/variants/NUCLEO_F429ZI/PinNamesVar.h new file mode 100644 index 0000000000..b65ff1991e --- /dev/null +++ b/variants/NUCLEO_F429ZI/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_F446RE/PinNamesVar.h b/variants/NUCLEO_F446RE/PinNamesVar.h new file mode 100644 index 0000000000..3acc637167 --- /dev/null +++ b/variants/NUCLEO_F446RE/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, /* SYS_WKUP0 */ +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PC_13, /* SYS_WKUP1 */ +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_L031K6/PinNamesVar.h b/variants/NUCLEO_L031K6/PinNamesVar.h new file mode 100644 index 0000000000..43ae409097 --- /dev/null +++ b/variants/NUCLEO_L031K6/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = PA_2, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_L053R8/PinNamesVar.h b/variants/NUCLEO_L053R8/PinNamesVar.h new file mode 100644 index 0000000000..0b7fa5cc33 --- /dev/null +++ b/variants/NUCLEO_L053R8/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_L152RE/PinNamesVar.h b/variants/NUCLEO_L152RE/PinNamesVar.h new file mode 100644 index 0000000000..0b7fa5cc33 --- /dev/null +++ b/variants/NUCLEO_L152RE/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_L432KC/PinNamesVar.h b/variants/NUCLEO_L432KC/PinNamesVar.h new file mode 100644 index 0000000000..43ca21646a --- /dev/null +++ b/variants/NUCLEO_L432KC/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PC_13, /* manually updated */ +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = PA_2, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = PC_5, /* manually updated */ +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif diff --git a/variants/NUCLEO_L476RG/PinNamesVar.h b/variants/NUCLEO_L476RG/PinNamesVar.h new file mode 100644 index 0000000000..f712d8ac24 --- /dev/null +++ b/variants/NUCLEO_L476RG/PinNamesVar.h @@ -0,0 +1,25 @@ + /* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = PE_6, /* manually updated */ +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = PA_2, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = PC_5, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif