TMRh20 ported to MBED

Fork of TMRh20 by BME SmartLab

Revision:
6:15a3bbf90fe9
Parent:
4:c741eb877a4e
--- a/RF24_config.h	Mon Mar 28 18:13:17 2016 +0000
+++ b/RF24_config.h	Fri Oct 06 20:20:33 2017 +0000
@@ -6,9 +6,9 @@
  modify it under the terms of the GNU General Public License
  version 2 as published by the Free Software Foundation.
  */
-
-/* spaniakos <spaniakos@gmail.com>
- Added __ARDUINO_X86__ support
+ 
+ /* spaniakos <spaniakos@gmail.com>
+  Added __ARDUINO_X86__ support
 */
 
 #ifndef __RF24_CONFIG_H__
@@ -16,29 +16,51 @@
 
 #include <stdint.h>
 
-#define rf24_max(a,b) (a>b?a:b)
-#define rf24_min(a,b) (a<b?a:b)
-
-#define RF24_SPI_TRANSACTIONS
+  /*** USER DEFINES:  ***/  
+  //#define FAILURE_HANDLING
+  //#define SERIAL_DEBUG
+  //#define MINIMAL
+  
+  /**********************/
+  #define rf24_max(a,b) (a>b?a:b)
+  #define rf24_min(a,b) (a<b?a:b)
 
-// RF modules support 10 Mhz SPI bus speed
-const uint32_t RF24_SPI_SPEED = 8000000;
-
-//typedef char const char;
+  #if defined SPI_HAS_TRANSACTION && !defined SPI_UART && !defined SOFTSPI
+    #define RF24_SPI_TRANSACTIONS
+  #endif
+ 
 
-typedef uint16_t prog_uint16_t;
-#define PSTR(x) (x)
-#define printf_P printf
-#define strlen_P strlen
-#define PROGMEM
-#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
-#define pgm_read_word(p) (*(p))
+  #define RF24_MBED
+   
+  #define HIGH 1
+  #define LOW 0
+  
+  // Define _BV for non-Arduino platforms and for Arduino DUE
+  #include <stdint.h>
+  #include <stdio.h>
+  #include <string.h>
+ 
+  #define _BV(x) (1<<(x))
 
-#define PRIPSTR "%s"
+  #ifdef SERIAL_DEBUG
+    #define IF_SERIAL_DEBUG(x) ({x;})
+  #else
+    #define IF_SERIAL_DEBUG(x)
+  #endif
+    
+  #define PSTR(x) (x)
+  //#define printf Serial.printf
+  //#define sprintf(...) os_sprintf( __VA_ARGS__ )
+  #define printf_P printf
+  #define strlen_P strlen  
+  #define PROGMEM
+  #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
+  #define pgm_read_word(p) (*(p))
+  #define PRIPSTR "%s"
 
-#define HIGH        1
-#define LOW         0
-#define _BV(n) (1 << n)
+  #define millis() (us_ticker_read() / 1000)
+  #define delay(t) wait_ms(t)
+  #define delayMicroseconds(t) wait_us(t) 
 
 #endif // __RF24_CONFIG_H__