|
L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
|
: Main program body More...
#include "main.h"#include "dma.h"#include "i2c.h"#include "app_lorawan.h"#include "rtc.h"#include "spi.h"#include "usart.h"#include "gpio.h"#include <stdio.h>#include "mysensors.h"#include "mysensors_base.h"#include "mymems.h"#include "usart_if.h"#include "stm32_seq.h"#include "stm32_lpm.h"#include "mylora_process.h"#include "timer_if.h"#include "nfc.h"#include "sys_app.h"#include "lora_app.h"#include "utils/utils.h"#include "adc_if.h"Go to the source code of this file.
Functions | |
| void | SystemClock_Config (void) |
| System Clock Configuration. | |
| 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 | I2C_Scan (I2C_HandleTypeDef *hi2c) |
| void | HAL_GPIO_EXTI_Callback (uint16_t GPIO_Pin) |
| called from GPIO interrupt | |
| void | uart_Start () |
| start of UART reading | |
| void | togle_LedOff (int off) |
| togle led | |
| void | setModeDevice (modeDevice_t mod) |
| set new device mode | |
| static void | Uart_RxProcessing () |
| static void | sensors_NFCInt () |
| The interrupt of NFC4 tag. | |
| static void | checkResetRestart () |
| static void | ledBlink (int count, uint32_t ms) |
| void | Power3v3_On () |
| The peripheries - flash, NFC & sensors are controlled by _3V3_Enb_GPIO_Port, _3V3_Enb_Pin Cumulative processing. | |
| void | Power3v3_Off () |
| Cumulative processing of peripheries to turn OFF. | |
| int | main (void) |
| The application entry point. | |
| void | Error_Handler (void) |
| This function is executed in case of error occurrence. | |
Variables | |
| struct { | |
| modeDevice_t ModeDevice | |
| volatile uint16_t NfcTagged | |
| UTIL_TIMER_Object_t NfcAfterTrigger | |
| uint16_t Powering3v3 | |
| } | _ |
: Main program body
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.c.
|
static |
@bried check the data from NFC. Function is called from timer _nfcAfterTrigger or directly
Definition at line 207 of file main.c.
References _systemParams, hi2c2, mems_Reset(), nfc_FactoryReset(), nfc_ReadSystemParams(), nfc_WriteSystemParams(), systemRestart(), and writeLog().
Referenced by main().
| void Error_Handler | ( | void | ) |
This function is executed in case of error occurrence.
| None |
Definition at line 589 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 HAL_GPIO_EXTI_Callback | ( | uint16_t | GPIO_Pin | ) |
called from GPIO interrupt
Definition at line 141 of file main.c.
References CFG_SEQ_Prio_0, CFG_SEQ_Task_NFC_INT, and NFC_INT_Pin.
| void I2C_Scan | ( | I2C_HandleTypeDef * | hi2c | ) |
Definition at line 115 of file main.c.
References HAL_Delay(), and writeLog().
|
static |
Definition at line 234 of file main.c.
References HAL_Delay(), USER_LED_GPIO_Port, and USER_LED_Pin.
Referenced by main().
| int main | ( | void | ) |
The application entry point.
| int |
Definition at line 277 of file main.c.
References _, _batPercLevel, _systemParams, Bat_Mon_Enb_GPIO_Port, Bat_Mon_Enb_Pin, CFG_SEQ_Task_MyLora, CFG_SEQ_Task_NFC_INT, CFG_SEQ_Task_Sensors, CFG_SEQ_Task_Uart_RX, checkResetRestart(), GetBatteryLevel(), HAL_GetTick(), hi2c2, i2c_OnOff(), ledBlink(), LoRaWAN_Init(), mems_Init(), mems_ReadFromSystemParams(), mems_WriteToSystemParams(), MODEDEVICE_OFF, MODEDEVICE_STOP, MX_DMA_Init(), MX_GPIO_Init(), MX_I2C2_Init(), MX_LoRaWAN_Init(), MX_LoRaWAN_Process(), MX_RTC_Init(), MX_SPI1_Init(), MX_USART1_UART_Init(), myloraWan_Init(), nfc_Init(), NFC_LPD_Enb_GPIO_Port, NFC_LPD_Enb_Pin, nfc_ReadSystemParams(), nfc_WriteSystemParams(), Power3v3_On(), sensors_Init(), sensors_NFCInt(), sensors_Retiming(), sensorsBase_Init(), sensorsSeq_Init(), setModeDevice(), SYS_GetBatteryLevel(), SystemApp_Init(), SystemClock_Config(), systemParams_CorrectSystemTime(), systemParams_Log(), systemParams_SetLoRaWanParams(), systemRestart(), Uart_RxProcessing(), uart_Start(), and writeLog().
| void Power3v3_Off | ( | ) |
Cumulative processing of peripheries to turn OFF.
Cumulative turn the all peripheries to OFF state - pull-down the _3V3_Enb_Pin pin.
Definition at line 262 of file main.c.
References _, _3V3_Enb_GPIO_Port, and _3V3_Enb_Pin.
Referenced by flash_at25_Init(), flash_at25_Read(), flash_at25_Write(), and i2c_OnOff().
| void Power3v3_On | ( | ) |
The peripheries - flash, NFC & sensors are controlled by _3V3_Enb_GPIO_Port, _3V3_Enb_Pin
Cumulative processing.
Cumulative turn the all peripheries to ON state - pull-up the _3V3_Enb_Pin pin.
Definition at line 250 of file main.c.
References _, _3V3_Enb_GPIO_Port, _3V3_Enb_Pin, and HAL_Delay().
Referenced by flash_at25_Init(), flash_at25_Read(), flash_at25_Write(), i2c_OnOff(), and main().
|
static |
The interrupt of NFC4 tag.
Definition at line 196 of file main.c.
References _, and writeLog().
Referenced by main().
| void setModeDevice | ( | modeDevice_t | mod | ) |
set new device mode
Definition at line 167 of file main.c.
References _, CFG_LPM_APPLI_Id, MODEDEVICE_OFF, MODEDEVICE_SLEEP, and MODEDEVICE_STOP.
Referenced by main(), and sensorsBase_StopTimerToOff().
| void SystemClock_Config | ( | void | ) |
System Clock Configuration.
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 537 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 159 of file main.c.
References USER_LED_GPIO_Port, and USER_LED_Pin.
Referenced by sensors_Work().
|
static |
Definition at line 187 of file main.c.
References Uart_NextReceving().
Referenced by main().
| void uart_Start | ( | ) |
start of UART reading
Definition at line 150 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 105 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(), nfc_WriteMeasureData(), OnLoRaWanConnected(), OnLoRaWANRxData(), OnLoRaWANTxData(), OnTimeSynchronized(), PWR_EnterSleepMode(), PWR_EnterStopMode(), PWR_ExitSleepMode(), PWR_ExitStopMode(), sensors_Init(), sensors_NFCInt(), sensors_OnOff(), sensors_WriteFromBckToDataBlock(), sensorsBase_Init(), systemParams_Log(), systemParams_SetFromPart(), 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 88 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 93 of file main.c.
References writeLogNL().
Referenced by writeLog().
| struct { ... } _ |
Referenced by LoRaWAN_SendConfirmedData(), main(), myloraWan_Init(), myLoraWan_LastDataSend(), myloraWan_MeasureFinish(), myloraWan_PrepareSendingBuffer(), myLoraWan_Reconnect(), myLoraWan_ResetDataDefault(), myLoraWan_StartReconnect(), OnLoRaWanConnected(), OnLoRaWANRxData(), OnLoRaWANTxData(), Power3v3_Off(), Power3v3_On(), sensors_CayennelFromBckData(), sensors_Init(), sensors_NextGroup(), sensors_NFCInt(), sensors_OnOff(), sensors_Read(), sensors_ReadToBckFromDataBlock(), sensors_Retiming(), sensors_Service(), sensors_Start(), sensors_Work(), sensors_WriteFromBckToDataBlock(), sensorsSeq_Init(), setModeDevice(), tasksensors_OnTimeout(), and tasksensors_Work().
| modeDevice_t ModeDevice |