Loading...
Searching...
No Matches
nrf24l01p_ng_communication.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 Otto-von-Guericke-Universität Magdeburg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#include "nrf24l01p_ng.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
28#define NRF24L01P_NG_ADDR_MASK (0x1F)
29
33#define NRF24L01P_NG_PIPE_MASK (0x07)
34
39#define NRF24L01P_NG_CMD_R_REGISTER(reg) \
40 (0x00 | ((reg) & NRF24L01P_NG_ADDR_MASK))
41
46#define NRF24L01P_NG_CMD_W_REGISTER(reg) \
47 (0x20 | ((reg) & NRF24L01P_NG_ADDR_MASK))
48
53#define NRF24L01P_NG_CMD_R_RX_PAYLOAD (0x61)
54
59#define NRF24L01P_NG_CMD_W_TX_PAYLOAD (0xA0)
60
65#define NRF24L01P_NG_CMD_FLUSH_TX (0xE1)
66
71#define NRF24L01P_NG_CMD_FLUSH_RX (0xE2)
72
77#define NRF24L01P_NG_CMD_REUSE_TX_PL (0xE3)
78
83#define NRF24L01P_NG_CMD_R_RX_PL_WID (0x60)
84
89#define NRF24L01P_NG_CMD_W_ACK_PAYLOAD(pipe) \
90 (0xA8 | ((pipe) & NRF24L01P_NG_PIPE_MASK))
91
95#define NRF24L01P_NG_CMD_W_TX_PAYLOAD_NO_ACK (0xB0)
96
100#define NRF24L01P_NG_CMD_NOP (0xFF)
101
108
115
126uint8_t nrf24l01p_ng_read_reg(const nrf24l01p_ng_t *dev, uint8_t reg,
127 uint8_t *dest, size_t len);
128
139uint8_t nrf24l01p_ng_write_reg(const nrf24l01p_ng_t *dev, uint8_t reg,
140 const uint8_t *src, size_t len);
141
151uint8_t nrf24l01p_ng_read_rx_payload(const nrf24l01p_ng_t *dev, void *dest,
152 size_t len);
153
164 const void *src, size_t len);
165
174
183
195
205 uint8_t *dest);
206
217uint8_t nrf24l01p_ng_write_ack_pl(const nrf24l01p_ng_t *dev, const void *src,
218 size_t len, uint8_t pipe);
219
231 const void *src, size_t len);
232
241
242#ifdef __cplusplus
243}
244#endif
245
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