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 */
18#ifndef NRF24L01P_NG_COMMUNICATION_H
19#define NRF24L01P_NG_COMMUNICATION_H
20
21#include "nrf24l01p_ng.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
30#define NRF24L01P_NG_ADDR_MASK (0x1F)
31
35#define NRF24L01P_NG_PIPE_MASK (0x07)
36
41#define NRF24L01P_NG_CMD_R_REGISTER(reg) \
42 (0x00 | ((reg) & NRF24L01P_NG_ADDR_MASK))
43
48#define NRF24L01P_NG_CMD_W_REGISTER(reg) \
49 (0x20 | ((reg) & NRF24L01P_NG_ADDR_MASK))
50
55#define NRF24L01P_NG_CMD_R_RX_PAYLOAD (0x61)
56
61#define NRF24L01P_NG_CMD_W_TX_PAYLOAD (0xA0)
62
67#define NRF24L01P_NG_CMD_FLUSH_TX (0xE1)
68
73#define NRF24L01P_NG_CMD_FLUSH_RX (0xE2)
74
79#define NRF24L01P_NG_CMD_REUSE_TX_PL (0xE3)
80
85#define NRF24L01P_NG_CMD_R_RX_PL_WID (0x60)
86
91#define NRF24L01P_NG_CMD_W_ACK_PAYLOAD(pipe) \
92 (0xA8 | ((pipe) & NRF24L01P_NG_PIPE_MASK))
93
97#define NRF24L01P_NG_CMD_W_TX_PAYLOAD_NO_ACK (0xB0)
98
102#define NRF24L01P_NG_CMD_NOP (0xFF)
103
110
117
128uint8_t nrf24l01p_ng_read_reg(const nrf24l01p_ng_t *dev, uint8_t reg,
129 uint8_t *dest, size_t len);
130
141uint8_t nrf24l01p_ng_write_reg(const nrf24l01p_ng_t *dev, uint8_t reg,
142 const uint8_t *src, size_t len);
143
153uint8_t nrf24l01p_ng_read_rx_payload(const nrf24l01p_ng_t *dev, void *dest,
154 size_t len);
155
166 const void *src, size_t len);
167
176
185
197
207 uint8_t *dest);
208
219uint8_t nrf24l01p_ng_write_ack_pl(const nrf24l01p_ng_t *dev, const void *src,
220 size_t len, uint8_t pipe);
221
233 const void *src, size_t len);
234
243
244#ifdef __cplusplus
245}
246#endif
247
248#endif /* NRF24L01P_NG_COMMUNICATION_H */
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.
NRF24L01+ device struct.