-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_network.h
61 lines (51 loc) · 2.02 KB
/
app_network.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/***************************************************************************//**
* @file app_network.h
* @brief This file contains headers which facilitate the wireless communication
* between different Thunderboards.
* @author Georgios Apostolakis
******************************************************************************/
#ifndef APP_NETWORK_H
#define APP_NETWORK_H
#include "rail_types.h"
#include "app_config.h"
///The size of the payload (i.e., bytes with useful information) in the exchanged packets. It should get values between 16 or greater
#define TX_PAYLOAD_LENGTH 16
/// The size of the TX & RX FIFOs.
#define RAIL_FIFO_SIZE (256U)
///A buffer with the payload of the transmitted packet.
uint8_t tx_packet[TX_PAYLOAD_LENGTH];
/** Set up the rail TX FIFO for later usage.
*
* @date 10/01/2023
* @param rail_handle A handle to the RAIL instance to be updated.
*/
void set_up_tx_fifo(RAIL_Handle_t rail_handle);
/** This function prepares a packet with the payload stored in {@link tx_packet}
* buffer, and transmits it.
*
* @date 10/01/2023
* @param rail_handle The RAIL instance to be used for TX FIFO writing.
* @param destination The channel that will be used to transmit the message.
*/
void send_packet(RAIL_Handle_t rail_handle, uint16_t destination);
/** This function opens this board's channel for receiving.
*
* @date 10/01/2023
* @param rail_handle The RAIL instance to be used for receiving packets.
*/
void start_receiving (RAIL_Handle_t rail_handle);
/** This function receives the packet, processes it and frees the RX FIFO.
*
* @date 10/01/2023
* @param rail_handle The RAIL instance used for receiving packets.
*/
void handle_received_packet (RAIL_Handle_t rail_handle);
/** The RAIL callback, which is called if a RAIL event occurs.
*
* @date 10/01/2023
* @param rail_handle The RAIL handle associated with the RAIL event
* notification.
* @param events The RAIL events having occurred.
*/
void sl_rail_util_on_event(RAIL_Handle_t rail_handle, RAIL_Events_t events);
#endif // APP_NETWORK_H