Krolyxon
Commit 1d55752

Branches

Tags

Refs →

orion-rf.piolibdepsesp32-s3-n16r8RF24docsatxmega.md

57 lines · 1.5 KB · Markdown

1# ATXMEGA
2
3@tableofcontents
4
5The RF24 driver can be build as a static library with Atmel Studio 7 in order to be included as any other library in another program for the XMEGA family.
6
7Currently only the [ATXMEGA D3](https://www.microchip.com/wwwproducts/en/ATxmega64d3) family is implemented.
8
9## Preparation
10
11Create an empty GCC Static Library project in Atmel Studio 7.
12
13As not all files are required, copy the following directory structure in the project:
14
15```text
16utility\
17 ATXMegaD3\
18 compatibility.c
19 compatibility.h
20 gpio.cpp
21 gpio.h
22 gpio_helper.c
23 gpio_helper.h
24 includes.h
25 RF24_arch_config.h
26 spi.cpp
27 spi.h
28nRF24L01.h
29printf.h
30RF24.cpp
31RF24.h
32RF24_config.h
33```
34
35## Usage
36
37Add the library to your project!
38
39In the file where the `main()` is put the following in order to update the millisecond functionality:
40
41```cpp
42ISR(TCE0_OVF_vect)
43{
44 update_milisec();
45}
46```
47
48Declare the rf24 radio with `RF24 radio(XMEGA_PORTC_PIN3, XMEGA_SPI_PORT_C);`
49
501. First parameter is the CE pin which can be any available pin on the microcontroller.
512. Second parameter is the CS which can be on port C (**XMEGA_SPI_PORT_C**) or on port D (**XMEGA_SPI_PORT_D**).
52
53Call the `__start_timer()` to start the millisecond timer.
54
55@note The millisecond functionality is based on the TCE0 so don't use these pins as IO.
56
57@note The operating frequency of the uC is 32MHz. If you have a different frequency, change the TCE0 registers appropriately in function `__start_timer()` in **compatibility.c** file for your frequency.