Zpal-radio#
Defines a platform abstraction layer for the Z-Wave radio.
The ZPAL Radio module contains several APIs which are required to be implemented.
A user of this radio module shall first define all parameters of the Z-Wave Radio Profile (i.e., zpal_radio_profile_t) and initialise the radio using zpal_radio_init API.
After the initialisation of the radio is executed, the user can use any of the radio APIs to execute radio related paradigm for instance
zpal_radio_transmit shall be used to transmit a Z-Wave frame on radio
zpal_radio_start_receive shall be used to enable the reception of Z-Wave frame
The radio API assumes that the radio will return to receive mode with channel hopping enabled after transmitting a frame.
Initialization of the radio#
void
RXHandlerFromISR(zpal_radio_event_t rxStatus)
{
// Rx handle in ISR context
}
void
TXHandlerFromISR(zpal_radio_event_t txEvent)
{
// Tx complete handle in ISR context
}
void
RegionChangeHandler(zpal_radio_event_t regionChangeStatus)
{
// Region changed, make sure region specific data and statistics are cleared
}
void
RadioAssertHandler(zpal_radio_event_t assertVal)
{
// Radio driver or hardware asserted, handle it
}
initialize_radio()
{
static zpal_radio_profile_t RfProfile;
static zpal_radio_network_stats_t sNetworkStatistic = {0};
static uint8_t network_homeid[4] = {0xDE, 0xAD, 0xBE, 0xEF};
// Set radio for US always on mode
static zpal_radio_profile_t RfProfile = {.region = REGION_US,
.wakeup = ZPAL_RADIO_WAKEUP_ALWAYS_LISTEN,
.listen_before_talk_threshold = ELISTENBEFORETALKTRESHOLD_DEFAULT,
.tx_power_max = 0,
.tx_power_adjust = 33,
.tx_power_max_lr = 140,
.home_id = &network_homeid,
.rx_cb = RXHandlerFromISR,
.tx_cb = TXHandlerFromISR,
.region_change_cb = RegionChangeHandler,