nRF5 SDK for Mesh v5.0.0
Functions
Serial hardware abstraction layer

Functions

void serial_bearer_init (void)
 Initializes the serial interface.
 
uint32_t serial_bearer_packet_buffer_get (uint16_t packet_len, serial_packet_t **pp_packet)
 Allocates a serial packet from the serial_bearer buffer. More...
 
uint32_t serial_bearer_blocking_buffer_get (uint16_t packet_len, serial_packet_t **pp_packet)
 Allocates a serial packet from the serial_bearer buffer. More...
 
void serial_bearer_tx (const serial_packet_t *p_packet)
 Transmits a serial packet. More...
 
bool serial_bearer_rx_get (serial_packet_t *p_packet)
 Get a packet from the RX queue. More...
 
bool serial_bearer_rx_pending (void)
 Check if any serial packets have been received from the peer. More...
 

Detailed Description

Function Documentation

◆ serial_bearer_packet_buffer_get()

uint32_t serial_bearer_packet_buffer_get ( uint16_t  packet_len,
serial_packet_t **  pp_packet 
)

Allocates a serial packet from the serial_bearer buffer.

Parameters
[in]packet_lenThe value of the packet length field for the serial packet.
[out]pp_packetThe allocated packet pointer.
Return values
NRF_SUCCESSThe packet is reserved successfully, and pp_packet points to a valid packet pointer.
NRF_ERROR_NO_MEMThe packet buffer does not have enough available memory.
NRF_ERROR_INVALID_LENGTHThe length of the packet requested cannot be 0 or greater than the maximum available packet size.

◆ serial_bearer_blocking_buffer_get()

uint32_t serial_bearer_blocking_buffer_get ( uint16_t  packet_len,
serial_packet_t **  pp_packet 
)

Allocates a serial packet from the serial_bearer buffer.

This call will not return until a buffer is available.

Warning
This function must be called below timer IRQ context so that timeslot does not trip up.
Parameters
[in]packet_lenThe value of the packet length field for the serial packet.
[out]pp_packetThe allocated packet pointer.
Return values
NRF_SUCCESSThe packet is reserved successfully, and pp_packet points to a valid packet pointer.
NRF_ERROR_INVALID_LENGTHThe length of the packet requested cannot be 0 or greater than the maximum available packet size.

◆ serial_bearer_tx()

void serial_bearer_tx ( const serial_packet_t p_packet)

Transmits a serial packet.

Parameters
[in]p_packetThe pointer to the serial packet that shall be transmitted

◆ serial_bearer_rx_get()

bool serial_bearer_rx_get ( serial_packet_t p_packet)

Get a packet from the RX queue.

Parameters
[in,out]p_packetPointer to a packet structure to copy the packet into.
Returns
true if a complete RX packet is available.

◆ serial_bearer_rx_pending()

bool serial_bearer_rx_pending ( void  )

Check if any serial packets have been received from the peer.

Returns
Whether there are some unprocessed RX packets queued.

Documentation feedback | Developer Zone | Subscribe | Updated