wireless.c File Reference
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include "wireless.h"
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
#include "semphr.h"
#include "mesh.h"
#include "nrf24L01Plus.h"
#include "sys_config.h"
#include "lpc_sys.h"
#include "eint.h"
Include dependency graph for wireless.c:

Functions | |
bool | wireless_init (void) |
char | wireless_get_rx_pkt (mesh_packet_t *pkt, const uint32_t timeout_ms) |
char | wireless_get_ack_pkt (mesh_packet_t *pkt, const uint32_t timeout_ms) |
Same as wireless_get_rx_pkt(), except this will retrieve an ACK response. More... | |
int | wireless_flush_rx (void) |
void | wireless_service (void) |
Function Documentation
int wireless_flush_rx | ( | void | ) |
Flush all received data of mesh (ACKs and RX packets)
- Returns
- the discarded packet count
char wireless_get_ack_pkt | ( | mesh_packet_t * | pkt, |
const uint32_t | timeout_ms | ||
) |
Same as wireless_get_rx_pkt(), except this will retrieve an ACK response.
char wireless_get_rx_pkt | ( | mesh_packet_t * | pkt, |
const uint32_t | timeout_ms | ||
) |
Call this function periodically to get a queued packet.
- Parameters
-
timeout_ms The number of milliseconds to wait for a packet. If FreeRTOS is running, then this becomes the queue wait time.
- Returns
- true if a packet was dequeued, or false if there is no packet.
Here is an example of how to send a packet and ensure the destined node received the data :
bool wireless_init | ( | void | ) |
Initializes nordic driver layer and the mesh network layer. This is already called before main() function is run.
- Returns
- true if everything is successful.
void wireless_service | ( | void | ) |
Calls mesh_service() routine. This is encapsulated because this function will only call mesh_service() when there is either a pending packet or a packet received as indicated by nordic interrupt. This function is called through RIT or through FreeRTOS tick hook, so you don't have to call it yourself.