Commit e1aaa571 authored by TMRh20's avatar TMRh20

Full Due support, maskIRQ function

- Tested and now fully functional on Arduino Due
- Added support for the extended SPI functions: brings Due performance
up to par with Due managing the CSN   pin and settings
- Corrected issues with printDetails() on Due
- Changed added variables to staticly defined types: ie: uint16_t
instead of unsigned int
- I think this will work on all ARM based boards that use the Arduino
libs
- Added maskIRQ function - to be used in RF24Network sleep mode
- Changed csn(int mode) to csn(bool mode)
- Updated GettingStarted_CallResponse.ino example: Capture start time
AFTER printing to serial so measurement is more accurate
parent 3455e489
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Design Goals: This library is designed to be... Design Goals: This library is designed to be...
* More complianct with the manufacturer specified operation of the chip * More compliant with the manufacturer specified operation of the chip
* More reliable and feature rich * More reliable and feature rich
* Easy for beginners to use * Easy for beginners to use
* Consumed with a public interface that's similiar to other Arduino standard libraries * Consumed with a public interface that's similiar to other Arduino standard libraries
...@@ -14,6 +14,7 @@ April 2014: Optimization nearing completion ...@@ -14,6 +14,7 @@ April 2014: Optimization nearing completion
* Changes to read() functionality have increased reliability and response * Changes to read() functionality have increased reliability and response
* Extended timeout periods have been added to aid in noisy or otherwise unreliable environments * Extended timeout periods have been added to aid in noisy or otherwise unreliable environments
* Delays have been removed where possible to ensure maximum efficiency * Delays have been removed where possible to ensure maximum efficiency
* Arduino Due fully supported with extended SPI functions
* More! See the links below and class documentation for more info. * More! See the links below and class documentation for more info.
Please refer to: Please refer to:
......
This diff is collapsed.
...@@ -54,7 +54,6 @@ private: ...@@ -54,7 +54,6 @@ private:
bool dynamic_payloads_enabled; /**< Whether dynamic payloads are enabled. */ bool dynamic_payloads_enabled; /**< Whether dynamic payloads are enabled. */
uint8_t ack_payload_length; /**< Dynamic size of pending ack payload. */ uint8_t ack_payload_length; /**< Dynamic size of pending ack payload. */
uint64_t pipe0_reading_address; /**< Last address set on pipe 0 for reading. */ uint64_t pipe0_reading_address; /**< Last address set on pipe 0 for reading. */
bool avail;
public: public:
...@@ -360,7 +359,7 @@ public: ...@@ -360,7 +359,7 @@ public:
* @return True if transmission is successful * @return True if transmission is successful
* *
*/ */
bool txStandBy(unsigned long timeout); bool txStandBy(uint32_t timeout);
/** /**
* Write an ack payload for the specified pipe * Write an ack payload for the specified pipe
...@@ -699,7 +698,7 @@ private: ...@@ -699,7 +698,7 @@ private:
* *
* @param mode HIGH to take this unit off the SPI bus, LOW to put it on * @param mode HIGH to take this unit off the SPI bus, LOW to put it on
*/ */
void csn(int mode); void csn(bool mode);
/** /**
* Set chip enable * Set chip enable
...@@ -707,7 +706,7 @@ private: ...@@ -707,7 +706,7 @@ private:
* @param level HIGH to actively begin transmission or LOW to put in standby. Please see data sheet * @param level HIGH to actively begin transmission or LOW to put in standby. Please see data sheet
* for a much more detailed description of this pin. * for a much more detailed description of this pin.
*/ */
void ce(int level); void ce(bool level);
/** /**
* Read a chunk of data in from a register * Read a chunk of data in from a register
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
//#define MINIMAL //#define MINIMAL
// Define _BV for non-Arduino platforms and for Arduino DUE // Define _BV for non-Arduino platforms and for Arduino DUE
#if ! defined(ARDUINO) || (defined(ARDUINO) && defined(__arm__))
#define _BV(x) (1<<(x))
#endif
#undef SERIAL_DEBUG #undef SERIAL_DEBUG
#ifdef SERIAL_DEBUG #ifdef SERIAL_DEBUG
...@@ -35,27 +35,29 @@ ...@@ -35,27 +35,29 @@
#define IF_SERIAL_DEBUG(x) #define IF_SERIAL_DEBUG(x)
#endif #endif
// Avoid spurious warnings // Avoid spurious warnings
#if 1 // Arduino DUE is arm and uses traditional PROGMEM constructs
#if ! defined( NATIVE ) && defined( ARDUINO ) && ! defined(__arm__) #if 1
#undef PROGMEM #if ! defined( NATIVE ) && defined( ARDUINO ) && ! defined(__arm__)
#define PROGMEM __attribute__(( section(".progmem.data") )) #undef PROGMEM
#undef PSTR #define PROGMEM __attribute__(( section(".progmem.data") ))
#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) #undef PSTR
#endif #define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))
#endif #endif
#endif
// Progmem is Arduino-specific
#if defined(ARDUINO) && ! defined(__arm__) // Progmem is Arduino-specific
#include <avr/pgmspace.h> // Arduino DUE is arm and does not include avr/pgmspace
#define PRIPSTR "%S" #if defined(ARDUINO) && ! defined(__arm__)
#else #include <avr/pgmspace.h>
#define PRIPSTR "%S"
#else
#if ! defined(ARDUINO) // This doesn't work on Arduino DUE
typedef char const char;
#else // Fill in pgm_read_byte that is used, but missing from DUE
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#endif
#if ! defined(ARDUINO)
typedef char const char;
else // Fill in pgm_read_byte that is used, but missing from DUE
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#endif
typedef uint16_t prog_uint16_t; typedef uint16_t prog_uint16_t;
#define PSTR(x) (x) #define PSTR(x) (x)
#define printf_P printf #define printf_P printf
...@@ -66,14 +68,18 @@ ...@@ -66,14 +68,18 @@
#endif #endif
// Define _BV for non-Arduino platforms and for Arduino DUE
#if ! defined(ARDUINO) || (defined(ARDUINO) && defined(__arm__))
#define _BV(x) (1<<(x))
#endif
// Stuff that is normally provided by Arduino // Stuff that is normally provided by Arduino
#if !defined ARDUINO #if !defined (ARDUINO)
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
extern HardwareSPI SPI; extern HardwareSPI SPI;
#define _BV(x) (1<<(x))
#else #else
#if !defined( __AVR_ATtiny85__ ) || defined( __AVR_ATtiny84__) #if !defined( __AVR_ATtiny85__ ) || defined( __AVR_ATtiny84__)
......
...@@ -61,10 +61,10 @@ void loop(void) { ...@@ -61,10 +61,10 @@ void loop(void) {
if (role == role_ping_out){ // Radio is in ping mode if (role == role_ping_out){ // Radio is in ping mode
byte gotByte; // Initialize a variable for the incoming response byte gotByte; // Initialize a variable for the incoming response
unsigned long time = micros(); // Record the current microsecond count
radio.stopListening(); // First, stop listening so we can talk. radio.stopListening(); // First, stop listening so we can talk.
printf("Now sending %d as payload. ",counter); // Use a simple byte counter as payload printf("Now sending %d as payload. ",counter); // Use a simple byte counter as payload
unsigned long time = micros(); // Record the current microsecond count
if ( radio.write(&counter,1) ){ // Send the counter variable to the other radio if ( radio.write(&counter,1) ){ // Send the counter variable to the other radio
if(!radio.available()){ // If nothing in the buffer, we got an ack but it is blank if(!radio.available()){ // If nothing in the buffer, we got an ack but it is blank
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment