27#include "stm32_systime.h"
49#define MAX_TS_SIZE (int) 16
54#define LORAWAN_MAX_BAT 254
83static void tiny_snprintf_like(
char *buf, uint32_t maxsize,
const char *strFormat, ...);
97 __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_MSI);
106 UTIL_ADV_TRACE_Init();
110 __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR);
126#if defined (LOW_POWER_DISABLE) && (LOW_POWER_DISABLE == 1)
129#elif !defined (LOW_POWER_DISABLE)
130#error LOW_POWER_DISABLE not defined
146 UTIL_LPM_EnterLowPower();
154 uint8_t batteryLevel = 0;
155 uint16_t batteryLevelmV;
168 else if (batteryLevelmV <
VDD_MIN)
186 int16_t temperatureLevel = 0;
191 temperatureLevel = (int16_t)(sensor_data.
temperature);
195 return temperatureLevel;
205 val = LL_FLASH_GetUDN();
206 if (val == 0xFFFFFFFF)
208 uint32_t ID_1_3_val = HAL_GetUIDw0() + HAL_GetUIDw2();
209 uint32_t ID_2_val = HAL_GetUIDw1();
211 id[7] = (ID_1_3_val) >> 24;
212 id[6] = (ID_1_3_val) >> 16;
213 id[5] = (ID_1_3_val) >> 8;
214 id[4] = (ID_1_3_val);
215 id[3] = (ID_2_val) >> 24;
216 id[2] = (ID_2_val) >> 16;
217 id[1] = (ID_2_val) >> 8;
223 id[6] = (val >> 8) & 0xFF;
224 id[5] = (val >> 16) & 0xFF;
225 id[4] = (val >> 24) & 0xFF;
226 val = LL_FLASH_GetDeviceID();
228 val = LL_FLASH_GetSTCompanyID();
230 id[1] = (val >> 8) & 0xFF;
231 id[0] = (val >> 16) & 0xFF;
245 *devAddr = LL_FLASH_GetUDN();
246 if (*devAddr == 0xFFFFFFFF)
248 *devAddr = ((HAL_GetUIDw0()) ^ (HAL_GetUIDw1()) ^ (HAL_GetUIDw2()));
267 SysTime_t curtime = SysTimeGet();
269 *size = strlen((
char *)buff);
305 va_start(vaArgs, strFormat);
Header for ADC interface configuration.
uint16_t SYS_GetBatteryLevel(void)
Get the current battery level.
void SYS_InitMeasurement(void)
Initializes the ADC input.
#define VDD_MIN
Minimum battery level in mV.
#define VDD_BAT
Maximum battery level in mV.
static void TimestampNow(uint8_t *buff, uint16_t *size)
Returns sec and msec based on the systime in use.
void SystemApp_Init(void)
initialize the system (dbg pins, trace, mbmux, sys timer, LPM, ...)
void UTIL_SEQ_Idle(void)
redefines __weak function in stm32_seq.c such to enter low power
void UTIL_ADV_TRACE_PreSendHook(void)
void GetDevAddr(uint32_t *devAddr)
callback to get the board 32 bits unique ID (LSB)
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
int16_t GetTemperatureLevel(void)
callback to get the current temperature in the MCU
static void tiny_snprintf_like(char *buf, uint32_t maxsize, const char *strFormat,...)
it calls UTIL_ADV_TRACE_VSNPRINTF
void GetUniqueId(uint8_t *id)
callback to get the board 64 bits unique ID
void HAL_Delay(__IO uint32_t Delay)
uint8_t GetBatteryLevel(void)
callback to get the battery level in % of full charge (254 full charge, 0 no charge)
static uint8_t SYS_TimerInitialisedFlag
uint32_t HAL_GetTick(void)
void UTIL_ADV_TRACE_PostSendHook(void)
Function prototypes for sys_app.c file.
#define VERBOSE_LEVEL
Verbose level for all trace logs.
Configuration of the debug.c instances.
void DBG_Init(void)
Initializes the SW probes pins and the monitor RF pins via Alternate Function.
Header for sensors application.
int32_t EnvSensors_Read(sensor_t *sensor_data)
Environmental sensor read.
int32_t EnvSensors_Init(void)
initialize the environmental sensor
configuration of the timer_if.c instances
void TIMER_IF_DelayMs(uint32_t delay)
a delay of delay ms by polling RTC
uint32_t TIMER_IF_GetTimerValue(void)
Get the timer value.
#define UTIL_ADV_TRACE_VSNPRINTF(...)
Definitions for modules requiring utilities.