Loading...
Searching...
No Matches
nrf24l01p_ng_communication.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019 Otto-von-Guericke-Universität Magdeburg
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
9#pragma once
10
21
22#include "nrf24l01p_ng.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
31#define NRF24L01P_NG_ADDR_MASK (0x1F)
32
36#define NRF24L01P_NG_PIPE_MASK (0x07)
37
42#define NRF24L01P_NG_CMD_R_REGISTER(reg) \
43 (0x00 | ((reg) & NRF24L01P_NG_ADDR_MASK))
44
49#define NRF24L01P_NG_CMD_W_REGISTER(reg) \
50 (0x20 | ((reg) & NRF24L01P_NG_ADDR_MASK))
51
56#define NRF24L01P_NG_CMD_R_RX_PAYLOAD (0x61)
57
62#define NRF24L01P_NG_CMD_W_TX_PAYLOAD (0xA0)
63
68#define NRF24L01P_NG_CMD_FLUSH_TX (0xE1)
69
74#define NRF24L01P_NG_CMD_FLUSH_RX (0xE2)
75
80#define NRF24L01P_NG_CMD_REUSE_TX_PL (0xE3)
81
86#define NRF24L01P_NG_CMD_R_RX_PL_WID (0x60)
87
92#define NRF24L01P_NG_CMD_W_ACK_PAYLOAD(pipe) \
93 (0xA8 | ((pipe) & NRF24L01P_NG_PIPE_MASK))
94
98#define NRF24L01P_NG_CMD_W_TX_PAYLOAD_NO_ACK (0xB0)
99
103#define NRF24L01P_NG_CMD_NOP (0xFF)
104
111
118
129uint8_t nrf24l01p_ng_read_reg(const nrf24l01p_ng_t *dev, uint8_t reg,
130 uint8_t *dest, size_t len);
131
142uint8_t nrf24l01p_ng_write_reg(const nrf24l01p_ng_t *dev, uint8_t reg,
143 const uint8_t *src, size_t len);
144
154uint8_t nrf24l01p_ng_read_rx_payload(const nrf24l01p_ng_t *dev, void *dest,
155 size_t len);
156
167 const void *src, size_t len);
168
177
186
198
208 uint8_t *dest);
209
220uint8_t nrf24l01p_ng_write_ack_pl(const nrf24l01p_ng_t *dev, const void *src,
221 size_t len, uint8_t pipe);
222
234 const void *src, size_t len);
235
244
245#ifdef __cplusplus
246}
247#endif
248
Public interface for NRF24L01+ (NG) devices.
uint8_t nrf24l01p_ng_write_reg(const nrf24l01p_ng_t *dev, uint8_t reg, const uint8_t *src, size_t len)
Write a register value.
uint8_t nrf24l01p_ng_reuse_tx_pl(const nrf24l01p_ng_t *dev)
Reuse TX payload in FIFO.
uint8_t nrf24l01p_ng_read_rx_pl_width(const nrf24l01p_ng_t *dev, uint8_t *dest)
Read received payload width.
uint8_t nrf24l01p_ng_get_status(const nrf24l01p_ng_t *dev)
Get status register value.
void nrf24l01p_ng_release(nrf24l01p_ng_t *dev)
Release the SPI bus of the transceiver.
uint8_t nrf24l01p_ng_write_tx_payload(const nrf24l01p_ng_t *dev, const void *src, size_t len)
Write payload to be transmitted.
uint8_t nrf24l01p_ng_flush_rx(const nrf24l01p_ng_t *dev)
Flush RX FIFO.
uint8_t nrf24l01p_ng_write_ack_pl(const nrf24l01p_ng_t *dev, const void *src, size_t len, uint8_t pipe)
Write Payload to be transmitted in an ACK frame.
uint8_t nrf24l01p_ng_read_reg(const nrf24l01p_ng_t *dev, uint8_t reg, uint8_t *dest, size_t len)
Read a register value.
uint8_t nrf24l01p_ng_write_tx_pl_no_ack(const nrf24l01p_ng_t *dev, const void *src, size_t len)
Write payload to be transmitted but do not expect an ACK for this frame.
void nrf24l01p_ng_acquire(nrf24l01p_ng_t *dev)
Acquire the SPI bus of the transceiver.
uint8_t nrf24l01p_ng_read_rx_payload(const nrf24l01p_ng_t *dev, void *dest, size_t len)
Read received payload.
uint8_t nrf24l01p_ng_flush_tx(const nrf24l01p_ng_t *dev)
Flush TX FIFO.
struct nrf24l01p_ng nrf24l01p_ng_t
typedef of forward declaration