Tdma_server#

group drv_tdma_server

Driver for Time-Division-Multiple-Access for the Gateway radio.

Author

Said Alvarado-Marin said-alexander.alvarado-marin@inria.fr

Copyright

Inria, 2024-now

Defines

TDMA_SERVER_MAX_CLIENTS#

Max number of clients that can register with this server.

TDMA_SERVER_TIME_SLOT_DURATION_US#

default timeslot for a tdma slot in microseconds

TDMA_SERVER_MAX_GATEWAY_TX_DELAY_US#

Max amount of microseconds that can elapse between gateway transmissions

TDMA_SERVER_MAX_TABLE_SLOTS#

Total amount of slots available in the tdma table, adds extra slots to MAX_CLIENTS to accomodate the gateway slots.

Typedefs

typedef void (*tdma_server_cb_t)(uint8_t *packet, uint8_t length)#

Function pointer to the callback function called on packet receive.

Functions

void db_tdma_server_init(tdma_server_cb_t callback, db_radio_mode_t radio_mode, uint8_t radio_freq, application_type_t default_radio_app)#

Initializes the TDMA scheme.

Starts advertising registration packets, set a default tdma table and inits the radio

Parameters:
  • callback[in] pointer to a function that will be called each time a packet is received.

  • radio_mode[in] BLE mode used by the radio (1MBit, 2MBit, LR125KBit, LR500Kbit)

  • radio_freq[in] Frequency of the radio [0, 100]

  • default_radio_app[in] Which application to use for registration and sync messages

void db_tdma_server_get_table_info(uint32_t *frame_duration_us, uint16_t *num_clients, uint16_t *table_index)#

Get general info about the current TDMA table.

Parameters:
  • frame_duration_us[out] pointer to the frame duration

  • num_clients[out] pointer to the number of clients

  • table_index[out] pointer to the last index of the TDMA table

void db_tdma_server_get_client_info(tdma_table_entry_t *client, uint8_t client_id)#

Get information about one client.

Parameters:
  • client_id[in] first client_id to copy

  • client[out] copy of the table entry of a single client

void db_tdma_server_tx(const uint8_t *packet, uint8_t length)#

Queues a single packet to send through the Radio.

Parameters:
  • packet[in] pointer to the array of data to send over the radio (max size = 32)

  • length[in] Number of bytes to send (max size = 32)

void db_tdma_server_flush(void)#

Ignore TDMA table and send all pending packets immediatly.

void db_tdma_server_empty(void)#

Erase all pending packets in the TDMA queue.

struct tdma_table_entry_t#

Data type to store the info about a single TDMA Client.

Public Members

uint64_t client#

ID of the client registered to in this time slot.

uint32_t rx_start#

Time between the start of the frame and when the gateway starts transmitting.

uint32_t rx_duration#

Duration the gateway will transmit messages.

uint32_t tx_start#

Time between the start of the frame and the start of the DotBot’s alloted frame.

uint32_t tx_duration#

Duration of the DotBot’s alloted frame.

struct tdma_server_table_t#

Data type to store the TDMA table.

Public Members

uint32_t frame_duration_us#

Duration of the entire TDMA frame [microseconds].

uint16_t num_clients#

Number of clients currently connected to the tdma server.

uint16_t table_index#

index of the last entry in the tdma table, includes slots taken by the gateway

tdma_table_entry_t table[TDMA_SERVER_MAX_CLIENTS]#

array of tdma clients