nRF5 SDK for Mesh v5.0.0
Macros | Functions
Serial interface

Macros

#define SERIAL_API_VERSION   10
 Serial API version. More...
 

Functions

uint32_t serial_init (void)
 Initializes the serial interface abstraction layer. More...
 
uint32_t serial_start (void)
 Starts the serial interface by sending a device started event to the host. More...
 
uint32_t serial_packet_buffer_get (uint16_t packet_len, serial_packet_t **pp_packet)
 Returns a serial packet buffer of the requested length. More...
 
void serial_tx (const serial_packet_t *p_packet)
 Queues a packet for transmission on the serial interface. More...
 
void serial_process (void)
 Schedule processing for serial RX/TX.
 
uint8_t serial_translate_error (uint32_t status)
 Translates an NRF_* error code into an ACI error code. More...
 
nrf_mesh_serial_state_t serial_state_get (void)
 Get current state of the serial module. More...
 
void serial_cmd_rsp_send (uint8_t opcode, uint8_t status, const uint8_t *p_data, uint16_t length)
 Send a simple command response to the given opcode, with the given serial status. More...
 

Detailed Description

Macro Definition Documentation

◆ SERIAL_API_VERSION

#define SERIAL_API_VERSION   10

Serial API version.

Definition at line 60 of file serial.h.

Function Documentation

◆ serial_init()

uint32_t serial_init ( void  )

Initializes the serial interface abstraction layer.

Return values
NRF_SUCCESSThe serial interface was successfully initialized.
NRF_ERROR_INVALID_STATEThe serial module has already been initialized.

◆ serial_start()

uint32_t serial_start ( void  )

Starts the serial interface by sending a device started event to the host.

Return values
NRF_SUCCESSThe serial interface was successfully started.
NRF_ERROR_INVALID_STATEThe serial interface has not been initialized, or has been started before.
NRF_ERROR_NO_MEMThe packet queue is full.

◆ serial_packet_buffer_get()

uint32_t serial_packet_buffer_get ( uint16_t  packet_len,
serial_packet_t **  pp_packet 
)

Returns a serial packet buffer of the requested length.

Parameters
[in]packet_lenThe serial packet length (excludes the length field of the packet).
[out]pp_packetThe serial packet instance pointer, returns the allocated buffer.
Return values
NRF_SUCCESSThe packet is reserved successfully, and pp_packet points to a valid packet pointer.
NRF_ERROR_INVALID_STATEThe serial module has not been started.
NRF_ERROR_INVALID_LENGTHThe length of the packet requested cannot be 0 or greater than the maximum available packet size

◆ serial_tx()

void serial_tx ( const serial_packet_t p_packet)

Queues a packet for transmission on the serial interface.

Parameters
[in]p_packetPointer to the packet to transmit.

◆ serial_translate_error()

uint8_t serial_translate_error ( uint32_t  status)

Translates an NRF_* error code into an ACI error code.

Parameters
statusthe status code to translate.
Returns
The ACI error code corresponding to the specified NRF error code.

◆ serial_state_get()

nrf_mesh_serial_state_t serial_state_get ( void  )

Get current state of the serial module.

Returns
Current state of the serial module.

◆ serial_cmd_rsp_send()

void serial_cmd_rsp_send ( uint8_t  opcode,
uint8_t  status,
const uint8_t *  p_data,
uint16_t  length 
)

Send a simple command response to the given opcode, with the given serial status.

Parameters
[in]opcodeOpcode to reply to.
[in]statusReply status code.
[in]p_dataAdditional data to be added to the reply (optional).
[in]lengthLength of additional data.

Documentation feedback | Developer Zone | Subscribe | Updated