|
L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
|
: Header for main.c file. This file contains the common defines of the application. More...
Go to the source code of this file.
Macros | |
| #define | RTC_N_PREDIV_S 10 |
| #define | RTC_PREDIV_S ((1<<RTC_N_PREDIV_S)-1) |
| #define | RTC_PREDIV_A ((1<<(15-RTC_N_PREDIV_S))-1) |
| #define | NFC_INT_Pin GPIO_PIN_0 |
| #define | NFC_INT_GPIO_Port GPIOA |
| #define | NFC_INT_EXTI_IRQn EXTI0_IRQn |
| #define | SPI1_CS_Pin GPIO_PIN_4 |
| #define | SPI1_CS_GPIO_Port GPIOA |
| #define | USER_LED_Pin GPIO_PIN_8 |
| #define | USER_LED_GPIO_Port GPIOA |
Enumerations | |
| enum | modeDevice_t { MODEDEVICE_SLEEP , MODEDEVICE_STOP , MODEDEVICE_OFF } |
| Device power/sleep mode selector. More... | |
Functions | |
| void | writeLogNL (const char *buf) |
| Send a pre-formatted C string to the UART log followed by a newline. | |
| void | writeLogVA (const char *format, va_list argList) |
| Format and send a log message using a va_list argument list. Used internally by writeLog(); can also be called from wrapper functions that accept a variadic argument list. | |
| void | writeLog (const char *format,...) |
| Format and send a log message over UART (printf-style). Available only when WRITELOG is defined; compiles to nothing otherwise. | |
| void | Error_Handler (void) |
| Default error handler called by HAL on unrecoverable errors. Disables interrupts and enters an infinite loop; attach a debugger or add custom recovery logic inside the USER CODE section in main.c. | |
| void | SystemClock_Config (void) |
| Re-configure all system clocks after waking from STOP or OFF mode. Called automatically during the startup/reset sequence; may also be called after exiting low-power modes to restore the full clock tree. | |
| void | uart_Start () |
| start of UART reading | |
| void | togle_LedOff (int off) |
| togle led | |
| void | setModeDevice (modeDevice_t mod) |
| set new device mode | |
: Header for main.c file. This file contains the common defines of the application.
Copyright (c) 2025 STMicroelectronics. All rights reserved.
This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.
Definition in file main.h.
| #define NFC_INT_GPIO_Port GPIOA |
Definition at line 140 of file main.h.
Referenced by MX_GPIO_Init().
| #define NFC_INT_Pin GPIO_PIN_0 |
Definition at line 139 of file main.h.
Referenced by EXTI0_IRQHandler(), HAL_GPIO_EXTI_Callback(), MX_GPIO_Init(), and PWR_EnterOffMode().
| #define RTC_N_PREDIV_S 10 |
Definition at line 136 of file main.h.
Referenced by TIMER_IF_Convert_ms2Tick(), TIMER_IF_Convert_Tick2ms(), and TIMER_IF_GetTime().
| #define RTC_PREDIV_A ((1<<(15-RTC_N_PREDIV_S))-1) |
Definition at line 138 of file main.h.
Referenced by MX_RTC_Init().
| #define RTC_PREDIV_S ((1<<RTC_N_PREDIV_S)-1) |
Definition at line 137 of file main.h.
Referenced by TIMER_IF_GetTime().
| #define SPI1_CS_GPIO_Port GPIOA |
Definition at line 143 of file main.h.
Referenced by MX_GPIO_Init().
| #define SPI1_CS_Pin GPIO_PIN_4 |
Definition at line 142 of file main.h.
Referenced by MX_GPIO_Init().
| #define USER_LED_GPIO_Port GPIOA |
Definition at line 145 of file main.h.
Referenced by Error_Handler(), main(), MX_GPIO_Init(), and togle_LedOff().
| #define USER_LED_Pin GPIO_PIN_8 |
Definition at line 144 of file main.h.
Referenced by Error_Handler(), main(), MX_GPIO_Init(), and togle_LedOff().
| enum modeDevice_t |
Device power/sleep mode selector.
Passed to setModeDevice() to request a specific power state transition. The sequencer ensures in-flight LoRaWAN transmissions complete before the mode switch is executed.
| void Error_Handler | ( | void | ) |
Default error handler called by HAL on unrecoverable errors. Disables interrupts and enters an infinite loop; attach a debugger or add custom recovery logic inside the USER CODE section in main.c.
Default error handler called by HAL on unrecoverable errors. Disables interrupts and enters an infinite loop; attach a debugger or add custom recovery logic inside the USER CODE section in main.c.
| None |
Definition at line 505 of file main.c.
References HAL_Delay(), USER_LED_GPIO_Port, and USER_LED_Pin.
Referenced by ADC_ReadChannels(), EnvSensors_Init(), flash_at25_Write(), flash_WritePage(), HAL_ADC_MspInit(), HAL_I2C_MspInit(), HAL_RTC_MspInit(), HAL_UART_MspInit(), mems_Check(), mems_Init(), mems_SetOffset(), MX_ADC_Init(), MX_I2C2_Init(), MX_RTC_Init(), MX_SPI1_Init(), MX_SUBGHZ_Init(), MX_USART1_UART_Init(), sensors_WriteFromBckToDataBlock(), sensorsBase_Init(), SystemClock_Config(), TIMER_IF_StartTimer(), and vcom_Resume().
| void setModeDevice | ( | modeDevice_t | mod | ) |
set new device mode
Definition at line 159 of file main.c.
References _modeDevice, CFG_LPM_APPLI_Id, MODEDEVICE_OFF, MODEDEVICE_SLEEP, and MODEDEVICE_STOP.
Referenced by main(), and sensorsBase_StopTimerToOff().
| void SystemClock_Config | ( | void | ) |
Re-configure all system clocks after waking from STOP or OFF mode. Called automatically during the startup/reset sequence; may also be called after exiting low-power modes to restore the full clock tree.
System Clock Configuration.
| None |
Re-configure all system clocks after waking from STOP or OFF mode. Called automatically during the startup/reset sequence; may also be called after exiting low-power modes to restore the full clock tree.
| None |
Configure LSE Drive Capability
Configure the main internal regulator output voltage
Initializes the CPU, AHB and APB buses clocks
Configure the SYSCLKSource, HCLK, PCLK1 and PCLK2 clocks dividers
Definition at line 453 of file main.c.
References Error_Handler().
Referenced by main(), and PWR_ExitStopMode().
| void togle_LedOff | ( | int | off | ) |
togle led
| off | - 0 - led is toggled, 1 - led is OFF |
Definition at line 151 of file main.c.
References USER_LED_GPIO_Port, and USER_LED_Pin.
Referenced by sensors_Work().
| void uart_Start | ( | ) |
start of UART reading
Definition at line 142 of file main.c.
References huart1, Uart_StartReceving(), and writeLog().
Referenced by main(), and PWR_ExitStopMode().
| void writeLog | ( | const char * | format, |
| ... ) |
Format and send a log message over UART (printf-style). Available only when WRITELOG is defined; compiles to nothing otherwise.
| format | printf-compatible format string followed by optional arguments. |
Definition at line 97 of file main.c.
References writeLogVA().
Referenced by checkResetRestart(), flash_at25_Write(), flash_WritePage(), I2C_Scan(), LoRaWAN_SendConfirmedData(), main(), mems_Check(), mems_Init(), mems_ReadMainBlock(), mems_SetOffset(), myLoraWan_LastDataSend(), myloraWan_MeasureFinish(), myLoraWan_Reconnect(), myLoraWan_StartReconnect(), nfc_Init(), OnLoRaWanConnected(), OnLoRaWANRxData(), OnLoRaWANTxData(), OnTimeSynchronized(), PWR_EnterSleepMode(), PWR_EnterStopMode(), PWR_ExitSleepMode(), PWR_ExitStopMode(), sensors_Init(), sensors_NFCInt(), sensors_OnOff(), sensors_WriteFromBckToDataBlock(), sensorsBase_Init(), sps30_Service(), systemParams_Log(), and uart_Start().
| void writeLogNL | ( | const char * | buf | ) |
Send a pre-formatted C string to the UART log followed by a newline.
| buf | Null-terminated string to transmit. |
Definition at line 80 of file main.c.
References Uart_Info().
Referenced by sensBuffer_Send(), and writeLogVA().
| void writeLogVA | ( | const char * | format, |
| va_list | argList ) |
Format and send a log message using a va_list argument list. Used internally by writeLog(); can also be called from wrapper functions that accept a variadic argument list.
| format | printf-compatible format string. |
| argList | Initialised va_list of format arguments. |
Definition at line 85 of file main.c.
References writeLogNL().
Referenced by writeLog().