nrf24L01  1.0
nrf24L01 library
 All Files Functions Variables Typedefs Enumerations Enumerator Macros
nrf24spiXM2.c File Reference

Spi driver for Nordic NRF24L01p on HvA Xmegaboard-version2. More...

#include "nrf24spiXM2.h"

Functions

void nrfspiInit (void)
 Initialization of SPI. More...
 
uint8_t nrfspiTransfer (uint8_t iData)
 SPI transfer. More...
 

Detailed Description

Spi driver for Nordic NRF24L01p on HvA Xmegaboard-version2.

Author
Wim Dolman (w.e.dolman@hva.nl)
Date
18-02-2016
Version
1.0

This file contains the routines for interfacing a Nordic NRF24L01p on HvA Xmegaboard-version2 from july 2015.

This driver uses UARTC0 as SPI-interface. The baudrate is the maximum rate. This is 8 MHz with Fcpu 32MHz and doesn't exceed the maximum speed 10 MHz from the NRF24L01p.

The interface exists of six signals:

  • Nordic NRF24L01p | Xmegaboard-version2
  • 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

Function Documentation

void nrfspiInit ( void  )

Initialization of SPI.

This routines has no parameters. It Initializes UARTC0 as SPI and the signals IRQ and CE

Returns
void
uint8_t nrfspiTransfer ( uint8_t  iData)

SPI transfer.

Parameters
iDatadata 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

Returns
Data received from slave (status of the nrf24L01p)