rn2xx3_internal.h

Internal driver definitions for the RN2483/RN2903 LoRa modules.

void rn2xx3_hex_to_bytes(const char * hex, uint8_t * byte_array)

Convert a string of hex to an array of bytes.

This functions is faster than fmt_hex_bytes that doesn’t work if it is used in the module UART interrupt callback.

Parameters

hex:The string of hex to convert
byte_array:The resulting array of bytes

void rn2xx3_set_internal_state(rn2xx3_t * dev, uint8_t state)

Sets internal device state.

Parameters

dev:The device descriptor
state:The desired state

void rn2xx3_cmd_start(rn2xx3_t * dev)

Starts writing a command with the content of the device command buffer.

Parameters

dev:The device descriptor

void rn2xx3_cmd_append(rn2xx3_t * dev, const uint8_t * data, uint8_t data_len)

Appends data to a command.

Parameters

dev:The device descriptor
data:The data buffer
data_len:The data max length

int rn2xx3_cmd_finalize(rn2xx3_t * dev)

Finalize a command.

Parameters

dev:The device descriptor

Return values

  • RN2XX3_OK if the command succeeded
  • RN2XX3_ERR_* otherwise
void rn2xx3_mac_tx_start(rn2xx3_t * dev)

Starts writing a tx command.

Parameters

dev:The device descriptor

int rn2xx3_mac_tx_finalize(rn2xx3_t * dev)

Finalize the TX command.

Parameters

dev:The device descriptor

Return values

  • RN2XX3_OK if the command succeeded
  • RN2XX3_REPLY_* otherwise
int rn2xx3_process_response(rn2xx3_t * dev)

Process a command immediate response.

Parameters

dev:The device descriptor

Return values

  • RN2XX3_OK if the command succeeded
  • RN2XX3_ERR_* otherwise
int rn2xx3_process_reply(rn2xx3_t * dev)

Process a command network reply.

Parameters

dev:The device descriptor

Return values

  • RN2XX3_OK if the command succeeded
  • RN2XX3_REPLY_* otherwise