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 @@
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
* Easy for beginners to use
* Consumed with a public interface that's similiar to other Arduino standard libraries
......@@ -14,6 +14,7 @@ April 2014: Optimization nearing completion
* Changes to read() functionality have increased reliability and response
* Extended timeout periods have been added to aid in noisy or otherwise unreliable environments
* 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.
Please refer to:
......
This diff is collapsed.
......@@ -54,7 +54,6 @@ private:
bool dynamic_payloads_enabled; /**< Whether dynamic payloads are enabled. */
uint8_t ack_payload_length; /**< Dynamic size of pending ack payload. */
uint64_t pipe0_reading_address; /**< Last address set on pipe 0 for reading. */
bool avail;
public:
......@@ -360,7 +359,7 @@ public:
* @return True if transmission is successful
*
*/
bool txStandBy(unsigned long timeout);
bool txStandBy(uint32_t timeout);
/**
* Write an ack payload for the specified pipe
......@@ -699,7 +698,7 @@ private:
*
* @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
......@@ -707,7 +706,7 @@ private:
* @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.
*/
void ce(int level);
void ce(bool level);
/**
* Read a chunk of data in from a register
......
......@@ -24,9 +24,9 @@
//#define MINIMAL
// 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
#ifdef SERIAL_DEBUG
......@@ -35,27 +35,29 @@
#define IF_SERIAL_DEBUG(x)
#endif
// Avoid spurious warnings
#if 1
#if ! defined( NATIVE ) && defined( ARDUINO ) && ! defined(__arm__)
#undef PROGMEM
#define PROGMEM __attribute__(( section(".progmem.data") ))
#undef PSTR
#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))
#endif
#endif
// Progmem is Arduino-specific
#if defined(ARDUINO) && ! defined(__arm__)
#include <avr/pgmspace.h>
#define PRIPSTR "%S"
#else
// Avoid spurious warnings
// Arduino DUE is arm and uses traditional PROGMEM constructs
#if 1
#if ! defined( NATIVE ) && defined( ARDUINO ) && ! defined(__arm__)
#undef PROGMEM
#define PROGMEM __attribute__(( section(".progmem.data") ))
#undef PSTR
#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))
#endif
#endif
// Progmem is Arduino-specific
// Arduino DUE is arm and does not include avr/pgmspace
#if defined(ARDUINO) && ! defined(__arm__)
#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;
#define PSTR(x) (x)
#define printf_P printf
......@@ -66,14 +68,18 @@
#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
#if !defined ARDUINO
#if !defined (ARDUINO)
#include <stdint.h>
#include <stdio.h>
#include <string.h>
extern HardwareSPI SPI;
#define _BV(x) (1<<(x))
#else
#if !defined( __AVR_ATtiny85__ ) || defined( __AVR_ATtiny84__)
......
......@@ -61,10 +61,10 @@ void loop(void) {
if (role == role_ping_out){ // Radio is in ping mode
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.
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.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