nrf24L01
1.0
nrf24L01 library
|
Test program for sending data with a Nordic NRF24L01p and a Xmega. More...
#include <avr/io.h>
#include <util/delay.h>
#include "nrf24/nrf24spiXM2.h"
#include "nrf24/nrf24L01.h"
Macros | |
#define | F_CPU 2000000UL |
Functions | |
void | init_nrf (void) |
Initializes nrf24L01+. More... | |
void | init_adc (void) |
Initializes ADC. More... | |
int16_t | read_adc (void) |
read ADC More... | |
int | main (void) |
main routine for sender More... | |
Variables | |
uint8_t | pipe [5] = {0x48, 0x76, 0x41, 0x30, 0x31} |
pipe address "HvA01" More... | |
Test program for sending data with a Nordic NRF24L01p and a Xmega.
The hardware configuration consists of a sender and a receiver. This file contains the program for the sender. The receiver is in file nrf24_test_receiver.c. The sender is a HvA-Xmegaboard with a external potmeter.
#include
lines.This test program is based on the example in paragraph E.1 from 'De taal C en de Xmega'
#define F_CPU 2000000UL |
void init_adc | ( | void | ) |
Initializes ADC.
It initializes PA0 as channel 0 of ADCA in a signed single ended coversion.
This routine is almost (it uses PA0 in stead of PA2) equal to init_adc() of code 20.3 from 'De taal C en de Xmega' second edition, see Voorbeelden uit 'De taal C en de Xmega'
void init_nrf | ( | void | ) |
Initializes nrf24L01+.
This function is almost the same as the init_nrf() of the receiver. There are two pipes. One for sending the value and one for the acknowledge
This routine is code E.1 from 'De taal C en de Xmega' second edition, see Voorbeelden uit 'De taal C en de Xmega'
int main | ( | void | ) |
main routine for sender
It initializes the nrf24L01+ and the ADC. Every 20 ms the program measures the input value and send the value with the nrf24L01+. The least significant byte is send first.
This routine is code E.2 from 'De taal C en de Xmega' second edition, see Voorbeelden uit 'De taal C en de Xmega'
int16_t read_adc | ( | void | ) |
read ADC
This function reads a value from channel 0 of ADCA.
This routine is equal to read_adc() of code 20.3 from 'De taal C en de Xmega' second edition, see Voorbeelden uit 'De taal C en de Xmega'
uint8_t pipe[5] = {0x48, 0x76, 0x41, 0x30, 0x31} |
pipe address "HvA01"