/* * ---------------------------------------------------------------------------- * “THE COFFEEWARE LICENSE” (Revision 1): * wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a coffee in return. * ----------------------------------------------------------------------------- * This library is based on this library: * https://github.com/aaronds/arduino-nrf24l01 * Which is based on this library: * http://www.tinkerer.eu/AVRLib/nRF24L01 * ----------------------------------------------------------------------------- */ #ifndef NRF24 #define NRF24 #include #include #ifdef TURTLE #define NRF24_IO_PORT PORTB #define NRF24_IO_PINREG PINB #define NRF24_IO_DDR DDRB #else #define NRF24_IO_PORT PORTC #define NRF24_IO_PINREG PINC #define NRF24_IO_DDR DDRC #endif #define NRF24_CE_PIN 0 #define NRF24_CSN_PIN 1 #define NRF24_SCK_PIN 2 #define NRF24_MOSI_PIN 3 #define NRF24_MISO_PIN 4 /* IO Helpers */ #define nrf24_set_bit(reg,bit) reg |= (1< Pin HIGH * - state:0 => Pin LOW */ /* -------------------------------------------------------------------------- */ extern void nrf24_ce_digitalWrite(uint8_t state); /* -------------------------------------------------------------------------- */ /* nrf24 CE pin control function * - state:1 => Pin HIGH * - state:0 => Pin LOW */ /* -------------------------------------------------------------------------- */ extern void nrf24_csn_digitalWrite(uint8_t state); /* -------------------------------------------------------------------------- */ /* nrf24 SCK pin control function * - state:1 => Pin HIGH * - state:0 => Pin LOW */ /* -------------------------------------------------------------------------- */ extern void nrf24_sck_digitalWrite(uint8_t state); /* -------------------------------------------------------------------------- */ /* nrf24 MOSI pin control function * - state:1 => Pin HIGH * - state:0 => Pin LOW */ /* -------------------------------------------------------------------------- */ extern void nrf24_mosi_digitalWrite(uint8_t state); /* -------------------------------------------------------------------------- */ /* nrf24 MISO pin read function /* - returns: Non-zero if the pin is high */ /* -------------------------------------------------------------------------- */ extern uint8_t nrf24_miso_digitalRead(); #endif