Demo (Nucleo L476RG)
Application
-
const uint8_t a_ParamDefault[]
This array define the parameter default value.
-
const uint16_t u16_ParamValueSz = PARAM_DEFAULT_SZ
The parameters values table size.
This external variable hold the parameters table value size.
-
const uint8_t u8_ParamAccessCfgSz = PARAM_ACCESS_CFG_SZ
The parameters access table size.
This external variable hold the parameters access table size.
-
const uint8_t u8_ParamRestrCfgSz = PARAM_RESTR_CFG_SZ
The restriction table size.
This external variable hold the parameters restriction table size.
- const key_s sDefaultKey [KEY_MAX_NB] ={[0] = {.key = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}},[KEY_ENC_MIN+1] = {.key = {0x55, 0x22, 0x19, 0xe2, 0x65, 0xeb, 0xb4, 0x8c,0x8a, 0xdf, 0x58, 0x71, 0x79, 0xd9, 0xc6, 0xb0,0x63, 0xd5, 0x7c, 0xa8, 0xd3, 0x7e, 0xd6, 0xcb,0x11, 0x51, 0xa7, 0x59, 0xcc, 0xad, 0xba, 0x40}},[KEY_MAC_ID] = {.key = {0x88, 0xe3, 0x35, 0x63, 0x8f, 0x52, 0x19, 0x46,0xc3, 0x8e, 0x32, 0xee, 0xba, 0xa3, 0xc9, 0x9f,0x4a, 0xe7, 0x0b, 0xfb, 0x2b, 0xb2, 0x53, 0x40,0x25, 0x04, 0x85, 0x76, 0xe3, 0x81, 0xfe, 0xad}}}
This define some hard-coded default keys.
-
void Storage_Init(uint8_t bForce)
-
void Storage_SetDefault(void)
Set to defaults device id, all parameters and all keys.
- Return values:
None –
-
void Sys_Init(void)
This function initialize the “system part”.
-
void Sys_Start(void)
-
void App_Init(void)
Called to initialize application before starting the scheduler.
-
void app_entry(void)
The application entry point.
- Return values:
None –
-
static void Main_Task(void const *argument)
This is the demo application task.
- PERM_SECTION (".param")
Table of parameters values.
This define hard-coded default device id
- KEY_SECTION (".data.keys")
Table of keys.
This initialize the storage area
- Parameters:
bForce – [in] Force to defaults.
- Return values:
None –
System
-
static fakeuart_device_t fakeuart_ctx
This is the context for the uart use as fake phy.
-
inline void _timer_set_handler(const uint8_t u8TimerId, pfTimeEvt_HandlerCB_t const pfCb)
Set the RTC Alarm callback handler.
- Parameters:
u8TimerId – [in] Alarm Id
pfCb – [in] Pointer on the callback function
-
inline void _timer_start(const uint8_t u8TimerId, uint64_t u64Value)
Start the RTC Alarm.
- Parameters:
u8TimerId – [in] Alarm Id
u64Value – [in] Time in millisecond until alarm occurs
-
inline void _timer_stop(const uint8_t u8TimerId)
Stop the RTC Alarm.
- Parameters:
u8TimerId – [in] Alarm Id
-
inline void _get_current_time_ms(uint64_t *u64MsTime)
Get the current epoch in millisecond.
- Parameters:
u64MsTime – [in] Pointer to hold epoch value
-
inline void _get_current_time(time_t *t)
Get the current epoch en second.
- Parameters:
t – [in] Pointer to hold epoch value
-
inline void _set_current_time(time_t t)
Set the current epoch in second.
- Parameters:
t – [in] Epoch value to set
-
inline void _time_wakeup_enable(void)
Enable the RTC wake-up timer.
-
inline void _time_wakeup_reload(void)
Reload the RTC wake-up timer.
-
inline void _time_update_set_handler(pfTimeEvt_HandlerCB_t const pfCb)
Set the time update callback handler.
- Parameters:
pfCb – [in] Pointer on the callback function
-
inline void _time_wakeup_force(void)
Force the RTC wake-up timer notify.
-
void Sys_Init(void)
This function initialize the “system part”.
-
void Sys_Fini(void)
This function finalize the “system part”.
- __attribute__ ((always_inline))
Start the RTOS scheduler.
Board Support Package
Common
-
enum dev_res_e
This enum define the common return code from devices.
Values:
-
enumerator DEV_SUCCESS
Generic success
-
enumerator DEV_FAILURE
Generic Failure
-
enumerator DEV_BUSY
Device is Busy
-
enumerator DEV_TIMEOUT
Device Timeout
-
enumerator DEV_INVALID_PARAM
Parameter is invalid
-
enumerator DEV_SUCCESS
-
boot_state_t gBootState
-
uint8_t ascii2hex(uint16_t u16Char)
Function convert a hexa represented as 2 bytes char into hexa value (1 byte).
- Parameters:
u16Char – [in] Two byte char to convert
- Returns:
converted one byte hex value
-
uint16_t hex2ascii(uint8_t u8Hex)
Function convert a hexa value (1 byte) into its 2 bytes char representation.
- Parameters:
u8Hex – [in] One byte hexa value to convert
- Returns:
converted two bytes char representation
-
void msleep(uint32_t milisecond)
Alias for HAL_Delay function.
- Parameters:
milisecond – [in] Number of milisecond to wait
-
void Error_Handler(void)
This function is executed in case of error occurrence.
- Return values:
None –
-
void BSP_Init(uint32_t u32BootState)
This function initialize the bsp.
- Parameters:
u32BootState – [in] The current boot state
- Returns:
None
Platform
Boot
-
enum boot_reason_e
This enum define the reset (boot) reason as is in mcu reset register.
Values:
-
enumerator FW_RSTF
Firewall reset
-
enumerator OBL_RSTF
Option Byte reset
-
enumerator PIN_RSTF
Pin reset
-
enumerator BOR_RSTF
Power On Reset (power was lost or exit from Shutdown/Stdby LP)
-
enumerator SFT_RSTF
Software reset
-
enumerator IWWG_RSTF
Independent window watchdog reset
-
enumerator WWDG_RSTF
Window watchdog reset
-
enumerator LPWR_RSTF
Low power reset
-
enumerator FW_RSTF
-
void BSP_Boot_Reboot(uint8_t bReset)
Reboot.
- Parameters:
bReset – [in] Reset the backup domain (1 ;yes, 0: no)
- Returns:
None
-
uint32_t BSP_Boot_GetState(void)
Get the boot state.
- Returns:
the boot state as u32 (see boot_state_t)
-
union boot_state_t
- #include <bsp_boot.h>
This union hold the boot state.
Public Members
-
uint32_t state
Boot State
-
uint32_t reason
boot reason (see boot_reason_e)
-
uint32_t standby
wake-up from standby
-
uint32_t backup
backup-up domain has been cleared
-
uint32_t internal
wake-up from internal
-
uint32_t __pad0__
not used
-
uint32_t wkup_pin
wake-up from pin
-
uint32_t __pad1__
not used
-
uint32_t wkup_alra
wake-up from rtc alarm A
-
uint32_t wkup_alrb
wake-up from rtc alarm B
-
uint32_t wkup_timer
wake-up from rtc wake-up timer
-
uint32_t calendar
calendar configuration required
-
struct boot_state_t::[anonymous] [anonymous]
-
uint32_t state
Flash
-
dev_res_e BSP_Flash_Erase(uint32_t u32PageId)
Erase the given flash page area.
- Parameters:
u32PageId – Flash Page Id
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_FAILURE – if failed (see dev_res_e::DEV_FAILURE)
-
dev_res_e BSP_Flash_EraseArea(uint32_t u32Address, uint32_t u32NbBytes)
Erase the related flash memory area.
- Parameters:
u32Address – [in] Start address of area to erase
u32NbBytes – [in] Area size to erase
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_FAILURE – if failed (see dev_res_e::DEV_FAILURE)
-
dev_res_e BSP_Flash_Write(uint32_t u32Address, uint64_t *pData, uint32_t u32NbDword)
Write double-word aligned data.
- Parameters:
u32Address – Flash Address
pData – Pointer on data sto store
u32NbDword – The number of double-word of data to store
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_FAILURE – if failed (see dev_res_e::DEV_FAILURE)
-
uint32_t BSP_Flash_Store(uint32_t u32Address, void *pData, uint32_t u32NbBytes)
Store the given data into Flash memory.
Note
: If the number of byte to write is not double-word aligned, the rest is filled with padding (0xFF).
- Parameters:
u32Address – Flash Address
pData – Pointer on data to store
u32NbBytes – The number of byte of data to store
- Return values:
the – next 64 bits aligned flash address if everything is fine.
0xFFFFFFFF – if failed.
-
uint32_t BSP_Flash_GetPage(uint32_t u32Address)
Obtains the page id from the given address.
- Parameters:
u32Address – Flash Address
- Return values:
The – Flash page id
Gpio interrupt
-
enum gpio_irq_trg_cond_e
This enum define the GPIO trigger condition
Values:
-
enumerator GPIO_IRQ_NONE_EDGE
Trigger an interrupt on a none edge.
-
enumerator GPIO_IRQ_RISING_EDGE
Trigger an interrupt on a rising edge.
-
enumerator GPIO_IRQ_FALLING_EDGE
Trigger an interrupt on a falling edge.
-
enumerator GPIO_IRQ_EITHER_EDGE
Trigger an interrupt on either edge.
-
enumerator GPIO_IRQ_HIGH_LEVEL
Trigger an interrupt on a high level.
-
enumerator GPIO_IRQ_LOW_LEVEL
Trigger an interrupt on a low level.
-
enumerator GPIO_IRQ_EITHERLEVEL
Trigger an interrupt on a low level.
-
enumerator GPIO_IRQ_NONE_EDGE
-
enum gpio_port_e
This enum define GPIO port.
Values:
-
enumerator GPIO_PORTA
Port 000
-
enumerator GPIO_PORTB
Port 001
-
enumerator GPIO_PORTC
Port 010
-
enumerator GPIO_PORTD
Port 011
-
enumerator GPIO_PORTE
Port 100
-
enumerator GPIO_NUM_PORTS
maximum number of ports
-
enumerator GPIO_PORTA
-
int8_t BSP_GpioIt_GetLineId(const uint16_t u16Pin)
Get EXTI line id from gpio pin number.
- Parameters:
u16Pin – [in] Gpio pin number
- Returns:
the corresponding exti line
-
uint8_t BSP_GpioIt_ConfigLine(const uint32_t u32Port, const uint16_t u16Pin, const gpio_irq_trg_cond_e ePol)
Configure the gpio interruption.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
ePol – [in] Interrupt polarity
- Return values:
DEV_SUCCESS – if success (see dev_res_e::DEV_SUCCESS)
DEV_FAILURE – if fail (see dev_res_e::DEV_FAILURE)
-
uint8_t BSP_GpioIt_SetLine(const uint32_t u32Port, const uint16_t u16Pin, const bool bEnable)
Enable the gpio interruption.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
bEnable – [in] Enable/Disable interrupt
- Return values:
DEV_SUCCESS – if success (see dev_res_e::DEV_SUCCESS)
DEV_FAILURE – if fail (see dev_res_e::DEV_FAILURE)
-
uint8_t BSP_GpioIt_SetCallback(const uint32_t u32Port, const uint16_t u16Pin, pf_cb_t const pfCb, void *const pCbParam)
Set the gpio interruption callback.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
pfCb – [in] Pointer on the Callback function
pCbParam – [in] Pointer on the Callback parameter
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
-
uint8_t BSP_GpioIt_SetGpioCpy(const uint8_t u8ItLineId, const uint32_t u32Port, const uint16_t u16Pin)
Set/Enable the gpio as copy of interrupt of the given exti line.
- Parameters:
u8ItLineId – [in] EXTI line to copy
u32Port – [in] Gpio port on which to copy
u16Pin – [in] Gpio pin on which to copy
- Return values:
DEV_SUCCESS – if success (see dev_res_e::DEV_SUCCESS)
-
uint8_t BSP_GpioIt_ClrGpioCpy(const uint8_t u8ItLineId)
Clr/Disable the gpio as copy of interrupt of the given exti line.
- Parameters:
u8ItLineId – [in] EXTI line to disable the copy
- Return values:
DEV_SUCCESS – if success (see dev_res_e::DEV_SUCCESS)
-
void BSP_GpioIt_Handler(int8_t i8_ItLineId)
This is the gpio (exti) interrupt handler.
- Parameters:
i8_ItLineId – [in] The “interrupted” exti line
-
static uint32_t _bsp_gpioit_getport_(uint32_t u32Line)
Retrieve GPIO port address from exti line.
- Parameters:
u32Line – [in] EXTI line number
- Returns:
the gpio port address
-
static gpio_port_e _bsp_gpioit_getnumport_(const uint32_t u32Port)
Retrieve GPIO port number from port address.
- Parameters:
u32Port – [in] Gpio port address
- Returns:
the gpio port number
-
struct gpio_it_t
This struct define the gpio interrupt.
Gpio
-
uint8_t BSP_Gpio_InputEnable(const uint32_t u32Port, const uint16_t u16Pin, const uint8_t b_Flag)
This function set as input (or analog mode) the given gpio.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
b_Flag – [in] 1 : set as input, 0: set in analog mode
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
-
uint8_t BSP_Gpio_OutputEnable(const uint32_t u32Port, const uint16_t u16Pin, const uint8_t b_Flag)
This function set as output (or analog mode) the given gpio.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
b_Flag – [in] 1 : set as output, 0: set in analog mode
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
-
inline uint8_t BSP_Gpio_Get(const uint32_t u32Port, const uint16_t u16Pin, uint8_t *b_Level)
This function get the value of the given gpio.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
b_Level – [inout] Will hold the gpio current value
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
-
inline uint8_t BSP_Gpio_Set(const uint32_t u32Port, const uint16_t u16Pin, uint8_t b_Level)
This function set the value of the given gpio.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
b_Level – [in] The value to set
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
-
inline uint8_t BSP_Gpio_SetLow(const uint32_t u32Port, const uint16_t u16Pin)
This function set to 0 the given gpio.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
-
inline uint8_t BSP_Gpio_SetHigh(const uint32_t u32Port, const uint16_t u16Pin)
This function set to 1 the given gpio.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
Low Power
-
enum lp_mode_e
This enum define the sleep mode.
Values:
-
enumerator LP_SLEEP_MODE
Sleep mode (CPU is sleeping)
-
enumerator LP_STOP1_MODE
Stop 1 mode
-
enumerator LP_STOP2_MODE
Stop 2 mode
-
enumerator LP_STDBY_MODE
Standby mode
-
enumerator LP_SHTDWN_MODE
Shutdown mode
-
enumerator LP_SLEEP_MODE
-
RTC_HandleTypeDef hrtc
-
UART_HandleTypeDef *paUART_BusHandle[UART_ID_MAX]
-
void BSP_LowPower_Enter(lp_mode_e eLpMode)
This function enter in the given low power mode.
- Parameters:
eLpMode – [in] The low power mode (see lp_mode_e)
-
WAKEUP_PIN
This define the current wake-up pin.
RTC
-
RTC_HandleTypeDef hrtc
-
void BSP_Rtc_Setup_Clk(uint32_t clock_sel)
This function setup the RTC clock.
- Parameters:
clock_sel – [in] RTC clock selection
- Returns:
None
-
void BSP_Rtc_Setup(uint16_t div_s, uint8_t div_a)
This function setup the RTC divider.
- Parameters:
div_s – [in] DIV_S factor
div_a – [in] DIV_A factor
- Returns:
None
-
void BSP_Rtc_Backup_Write(uint32_t regNum, uint32_t data)
This function write to backup register.
- Parameters:
regNum – [in] The backup register numbre to write
data – [in] The value to write in
- Returns:
None
-
uint32_t BSP_Rtc_Backup_Read(uint32_t regNum)
This function read from backup register.
- Parameters:
regNum – [in] The backup register numbre to read from
- Returns:
The read value
-
void BSP_Rtc_Time_Write(time_t t)
This function set the current time.
- Parameters:
t – [in] The current time to set (in epoch)
- Returns:
None
-
void BSP_Rtc_Time_ReadMicro(struct timeval *tp)
This function read the current time.
- Parameters:
tp – [in] Pointer on timeval structure to hold the read time
- Returns:
None
-
uint64_t BSP_Rtc_Time_GetEpochMs(void)
This function get the millisecond epoch time.
- Returns:
the millisecond epoch time
-
time_t BSP_Rtc_Time_Read(void)
This function get the epoch time.
- Returns:
the epoch time
-
void BSP_Rtc_Time_UpdateDaylight(daylight_sav_e daylight_sav)
This function update the RTC clock with summer/winter time.
- Parameters:
daylight_sav – [in] The daylight
- Returns:
None
-
void BSP_Rtc_Time_Update(time_t t)
-
void BSP_Rtc_Time_ForceNotify(void)
This function force the RTC wake-up interrupt (in one second)
-
void BSP_Rtc_Alarm_ForceNotify(void)
This function is not implemented.
-
void BSP_Rtc_Time_Update_SetCallback(pfEventCB_t const pfCb)
This function set the callback for “time changed”.
- Parameters:
pfCb – [in] Callback function
-
void BSP_Rtc_WakeUpTimer_Enable(void)
This function enable the RTC wake-up timer.
-
void BSP_Rtc_WakeUpTimer_Disable(void)
This function disable the RTC wake-up timer.
-
void BSP_Rtc_WakeUptimer_Reload(void)
This function reload the RTC wake-up timer to the next wake-up event (i.e. the next midnight)
-
void BSP_Rtc_WakeUpTimer_SetCallback(pfEventCB_t const pfCb)
This function set the callback for the wake-up timer event.
- Parameters:
pfCb – [in] Callback funtion
-
void BSP_Rtc_WakeUpTimer_SetHandler(pfHandlerCB_t const pfCb)
This function set the RTC wake-up timer interrupt handler.
- Parameters:
pfCb – [in] Interrupt handler
-
void BSP_Rtc_Alarm_Start(const uint8_t u8AlarmId, uint32_t u32Elapse)
This function start the given alarm.
- Parameters:
u8AlarmId – [in] The alarm id to start
u32Elapse – [in] The elapse time in second before alarm occurs
-
void BSP_Rtc_Alarm_StartMs(const uint8_t u8AlarmId, uint64_t u64Elapse)
This function start the given alarm at milisecond scale.
- Parameters:
u8AlarmId – [in] The alarm id to start
u64Elapse – [in] The elapse time in millisecond before alarm occurs
-
void BSP_Rtc_Alarm_Stop(const uint8_t u8AlarmId)
This function stop the given alarm.
- Parameters:
u8AlarmId – [in] The alarm id to stop
-
void BSP_Rtc_Alarm_SetHandler(const uint8_t u8AlarmId, pfHandlerCB_t const pfCb)
This function set the alarm interrupt handler.
- Parameters:
u8AlarmId – [in] The alarm id
pfCb – [in] The interrupt handler
-
void Error_Handler(void)
This function is executed in case of error occurrence.
- Return values:
None –
-
static void _rtc_wakeUptimer_handler_(void)
This function is default RTC wake-up timer interrupt handler.
When wake-up interrupt occurs, both pfUpdateTimeCallBack and pfWakeUpTimerCallBack callback function will be called. The first one is intended to treat the time update (time management). The second one is free to be used.
UART
-
enum uart_evt_e
This enum define possible events from UART.
Values:
-
enumerator UART_EVT_NONE
None
-
enumerator UART_EVT_TX_CPLT
Transmition is complete
-
enumerator UART_EVT_RX_CPLT
Reception is complete
-
enumerator UART_EVT_RX_HCPLT
-
enumerator UART_EVT_RX_ABT
-
enumerator UART_EVT_NONE
-
enum uart_flag_e
This enum define flags … from UART.
Values:
-
enumerator UART_FLG_NONE
-
enumerator UART_FLG_RX_TMO
-
enumerator UART_FLG_RX_OVFL
-
enumerator UART_FLG_RX_SOB
-
enumerator UART_FLG_RX_EOB
-
enumerator UART_FLG_NONE
-
enum uart_mode_e
This enum define the “detection” mode for UART.
Values:
-
enumerator UART_MODE_NONE
None (wait until the buffer reach the geiven size)
-
enumerator UART_MODE_EOB
Event is sent when character match the end of block
-
enumerator UART_MODE_ADDR
Event is sent when character match the start of block
-
enumerator UART_MODE_NONE
-
typedef uart_dev_t *p_uart_dev_t
This type define a pointer on UART device structure.
-
uart_dev_t aDevUart[UART_ID_MAX]
-
int __io_putchar(int ch)
-
int __io_getchar(void)
-
void BSP_Console_SetTXCallback(pfHandlerCB_t const pfCb)
-
void BSP_Console_SetRXCallback(pfHandlerCB_t const pfCb)
-
void BSP_Console_SetWakupCallback(pfHandlerCB_t const pfCb)
-
uint8_t BSP_Console_Send(uint8_t *pData, uint16_t u16Length)
-
uint8_t BSP_Uart_SetCallback(uint8_t u8DevId, pfEvtCb_t const pfEvtCb, void *pCbParam)
Set the Uart interrupt callback.
- Parameters:
u8DevId – [in] Uart device id (see uart_id_e)
pfEvtCb – [in] Pointer on the callback function
pCbParam – [in] Pointer on the callback parameter
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given paramater is in valid (see dev_res_e::DEV_INVALID_PARAM)
-
uint8_t BSP_Uart_Init(uint8_t u8DevId, uint8_t u8CharMatch, uint8_t u8Mode, uint32_t u32Tmo)
Configure the given uart (interrupt mode)
- Parameters:
u8DevId – [in] Uart device id (see uart_id_e)
u8CharMatch – [in] Character to match
u8Mode – [in] Uart detection mode (see uart_mode_e)
u32Tmo – [in] Timeout (0 : timeout is not used)
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given parameter is invalid (see dev_res_e::DEV_INVALID_PARAM)
-
uint8_t BSP_Uart_Transmit(uint8_t u8DevId, uint8_t *pData, uint16_t u16Length)
Start to transmit on the given uart (interrupt mode)
- Parameters:
u8DevId – [in] Uart device id (see uart_id_e)
pData – [in] Pointer on the buffer to send
u16Length – [in] Size of the message
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given parameter is invalid (see dev_res_e::DEV_INVALID_PARAM)
DEV_BUSY – if the given device is busy (see dev_res_e::DEV_BUSY)
-
uint8_t BSP_Uart_Receive(uint8_t u8DevId, uint8_t *pData, uint16_t u16Length)
Start to receive on the given uart (interrupt mode)
- Parameters:
u8DevId – [in] Uart device id (see uart_id_e)
pData – [in] Pointer on receiving buffer
u16Length – [in] Size of expected message
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given parameter is invalid (see dev_res_e::DEV_INVALID_PARAM)
DEV_BUSY – if the given device is busy (see dev_res_e::DEV_BUSY)
-
uint8_t BSP_Uart_AbortReceive(uint8_t u8DevId)
Abort the UART receive (interrupt mode)
- Parameters:
u8DevId – [in] Uart device id (see uart_id_e)
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given parameter is invalid (see dev_res_e::DEV_INVALID_PARAM)
-
uint8_t BSP_Console_Init(void)
-
uint8_t BSP_Console_Received(uint8_t *pData, uint16_t u16Length)
-
static void _bsp_com_TxISR_8BIT(UART_HandleTypeDef *huart)
TX interrupt handler.
- Parameters:
huart – [in] Pointer on the uart handle
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given paramater is in valid (see dev_res_e::DEV_INVALID_PARAM)
-
static void _bsp_com_RxISR_8BIT(UART_HandleTypeDef *huart)
RX interrupt handler.
- Parameters:
huart – [in] Pointer on the uart handle
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given paramater is in valid (see dev_res_e::DEV_INVALID_PARAM)
-
CONSOLE_TX_TIMEOUT
-
CONSOLE_RX_TIMEOUT
-
struct uart_dev_t
- #include <bsp_uart.h>
This structure define the UART device.
Board
Warning
doxygengroup: Cannot find group “nucleo_L476_board” in doxygen xml output for project “OpenWize Developer Documentation” from directory: _build/xml
Devices
PhyFake
-
enum fakeuart_state_e
This enum defines the PḧyFake state.
Values:
-
enumerator IDLE_STATE
-
enumerator INITIALIZED_STATE
-
enumerator CONFIGURED_STATE
-
enumerator TRANSMITTING_STATE
-
enumerator RECEIVING_STATE
-
enumerator IDLE_STATE
-
enum fakeuart_error_e
This enum defines the PhyFake error.
Values:
-
enumerator FAKEUART_ERR_NONE
-
enumerator FAKEUART_FAILURE
-
enumerator FAKEUART_BUSY
-
enumerator FAKEUART_TIMEOUT
-
enumerator FAKEUART_INVALID_PARAM
-
enumerator FAKEUART_ERR_NONE
- const char *const phyfake_error_msgs [] ={[FAKEUART_ERR_NONE] = "PhyFake ERR_NONE",[FAKEUART_FAILURE] = "PhyFake FAILURE",[FAKEUART_BUSY] = "PhyFake BUSY",[FAKEUART_TIMEOUT] = "PhyFake TIMEOUT",[FAKEUART_INVALID_PARAM] = "PhyFake INVALID_PARAM",}
This convenient table hold the human error representation.
- const char *const aChanStr [PHY_NB_CH] = {[PHY_CH100] = "100",[PHY_CH110] = "110",[PHY_CH120] = "120",[PHY_CH130] = "130",[PHY_CH140] = "140",[PHY_CH150] = "150",}
This convenient table hold the human channel representation.
- const char *const aModulationStr [PHY_NB_MOD] = {[PHY_WM2400] = "WM2400",[PHY_WM4800] = "WM4800",[PHY_WM6400] = "WM6400",}
This convenient table hold the human modulation representation.
- const char *const aTestModeStr [PHY_NB_TST_MODE] = {[PHY_TST_MODE_NONE] = "Disable",[PHY_TST_MODE_RX] = "RX",[PHY_TST_MODE_PER_RX] = "RX PER",[PHY_TST_MODE_TX] = "TX",}
This convenient table hold the human test mode representation.
- static const phy_if_t _phy_if = {.pfInit = _init,.pfUnInit = _uninit,.pfTx = _do_TX,.pfRx = _do_RX,.pfNoise = _do_CCA,.pfSetSend = _set_send,.pfGetRecv = _get_recv,.pfIoctl = _ioctl}
This structure hold the Phy device interface.
-
int32_t Phy_PhyFake_setup(phydev_t *pPhydev, fakeuart_device_t *pCtx)
This function prepare the Phy device with constant configuration.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
pCtx – [in] Pointer on the Phy device context
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _init(phydev_t *pPhydev)
This function initialize the Phy device.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _uninit(phydev_t *pPhydev)
This function un-initialize the Phy device. (Power OFF and Reset released)
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _do_TX(phydev_t *pPhydev, phy_chan_e eChannel, phy_mod_e eModulation)
This function execute a TX sequence.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
eChannel – [in] Channel use to TX
eModulation – [in] Modulation use to TX
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _do_RX(phydev_t *pPhydev, phy_chan_e eChannel, phy_mod_e eModulation)
This function execute an RX sequence.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
eChannel – [in] Channel use to RX
eModulation – [in] Modulation use to RX
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _do_CCA(phydev_t *pPhydev, phy_chan_e eChannel, phy_mod_e eModulation)
This function execute a Noise Measurement sequence.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
eChannel – [in] Channel on which the Noise must be measured
eModulation – [in] Modulation on which the Noise must be measured
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _set_send(phydev_t *pPhydev, uint8_t *pBuf, uint8_t u8Len)
This function set the packet to send.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
pBuf – [in] Pointer to get data to send
u8Len – [in] Reference on the data length to send
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _get_recv(phydev_t *pPhydev, uint8_t *pBuf, uint8_t *u8Len)
This function get the received packet.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
pBuf – [in] Pointer on buffer to get received data
u8Len – [in] Reference on received number of bytes
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _ioctl(phydev_t *pPhydev, uint32_t eCtl, uint32_t args)
This function Get/Set internal configuration variable.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
eCtl – [in] Id of configuration variable to get/set (see phy_ctl_e)
args – [inout] scalar or pointer that hold the value to set/get
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _do_cmd(phydev_t *pPhydev, uint8_t eCmd)
This is the main FSM.
This function ensure that transition between state are respected. … :
Wake-up, (re)configuration,
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
eCmd – [in] Requested command to execute
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static void _frame_it(void *p_CbParam, void *p_Arg)
Interruption handler to treat the frame event.
- Parameters:
p_CbParam – [in] Pointer on call-back parameter
p_Arg – [in] Pointer on call-back argument
- Returns:
None
-
struct fakeuart_device_t
- #include <phy_layer_private.h>
This struct defines PhyFake device context.