I'm trying to follow the tutorial here: http://iteadstudio.com/application-note/nrf24l01-wireless-module-with-arduino/ but I'm trying to use (2x) ATtiny84's instead of a full Arduino board. Issue is that I have to remap the default arduino pins over to the ATtiny84's. The tutorial says to edit the "FRF24L01.h" file (contents below), but I can't make heads or tails of how... (newbie)...
They appear to be using Direct Port Addressing and software SPI.
Each port has 8 pins. The DDR (Data Direction Register) determines if a pin is INPUT or OUTPUT. The PORT register is how you write to the pins. The PIN register is how you read from the pins AND lets you toggle a pin by writing a 1.
They are using 5 pins that are all controlled by PORTB.
Looks like the ATtiny84 has PORTA and PORTB. You have to look at the available pins and find 5 on a single PORT that you can use. Since only 4 of the PORTB pins are connected to the outside world you will have to switch to PORTA/DDRA/PINA. Pick any 5 of the 8 you are not using for other things.
Thanks for the tip! So since I need a total of 6 pins (CE, CSN, SCK, MOSI, MISO, IRQ), from what you're saying I either have to use all on PortA or all on PortB--- so if I'd have to switch over to using the APort, what would I need to update? I'm really new to this direct port addressing and SPI's business...
#define SPI_PORT PORTA
#define SPI_DIR DDRA
#define SPI_IN PINA
Your connections will all be on one side of the chip:
14
13 PA0 ---- Chip Enable
12 PA1 ---- SPI Chip Select
11 PA2 ---- SPI Clock
10 PA3 ---- SPI MOSI
9 PA4 ---- SPI MISO
8 PA5 ---- IRQ