nrf24L01
1.0
nrf24L01 library
|
Header file SPI driver for Nordic NRF24L01p on Xmegaboard-version2. More...
#include <avr/io.h>
#include <util/delay.h>
Go to the source code of this file.
Macros | |
#define | F_CPU 32000000UL |
#define | NRF_SELECT 0 |
Spi slave selected. More... | |
#define | NRF_DESELECT 1 |
Spi slave deselected. More... | |
#define | NRF_ENABLE 1 |
NRF chip enable. More... | |
#define | NRF_DISABLE 0 |
NRF chip disable. More... | |
Functions | |
void | nrfspiInit (void) |
Initialization of SPI. More... | |
uint8_t | nrfspiTransfer (uint8_t iData) |
SPI transfer. More... | |
void | nrfCSn (uint8_t bSelected) |
Set chip select. More... | |
void | nrfCE (uint8_t bEnabled) |
Set chip enable. More... | |
Header file SPI driver for Nordic NRF24L01p on Xmegaboard-version2.
This file contains the definitions and prototypes for interfacing a Nordic NRF24L01p on Xmegaboard-version2 from july 2015.
This driver uses UARTC0 as SPI-interface. The baudrate is the maximum rate. This is 8 MHz @ Fcpu 32MHz. It doesn't exceed the maximum speed 10 MHz of the NRF24L01p.
The interface exists of six signals:
Nordic NRF24L01p | Xmegaboard-V2 | |
---|---|---|
IRQ | interrupt request | PF6 |
CE | chip enable | PF7 |
CSN | SPI slave select | PF5 |
SCK | SPI clock | PC1 |
MOSI | SPI MOSI | PC3 |
MISO | SPI MOSI | PC2 |
More information can be found in chapter 8 of the NRF24L01p datasheet.
#define F_CPU 32000000UL |
#define NRF_DESELECT 1 |
Spi slave deselected.
#define NRF_DISABLE 0 |
NRF chip disable.
#define NRF_ENABLE 1 |
NRF chip enable.
#define NRF_SELECT 0 |
Spi slave selected.
|
inline |
Set chip enable.
bEnabled | NRF_ENABLE enables transmission of Nordic chip NRF_DISABLE disables transmission of Nordic chip |
Level NRF_ENABLE (high) starts transmission and NRF_ENABLE (low) puts Nordic LOW in standby.
|
inline |
Set chip select.
bSelected | NRF_SELECT selects SPI bus, NRF_DESELECT deselect SPI bus |
void nrfspiInit | ( | void | ) |
Initialization of SPI.
This routines has no parameters. It Initializes UARTC0 as SPI and the signals IRQ and CE
uint8_t nrfspiTransfer | ( | uint8_t | iData | ) |
SPI transfer.
iData | data byte send to the slave |
This function send a byte IData to register to the slave, while data from the slave is received into the DATA register.
In this case, for the nrf24L01p, the value of status-register is shifted out