Ein Roboter mit bürstenlosem Antrieb, differenzial und NRF24L01 Funk. Großflächig gebaut um ein großes Solarpanel aufzunehmen. https://gitlab.informatik.hs-fulda.de/fdai5253/roboter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
5.6 KiB

  1. /*
  2. Copyright (C)
  3. 2011 J. Coliz <maniacbug@ymail.com>
  4. 2015-2019 TMRh20
  5. 2015 spaniakos <spaniakos@gmail.com>
  6. 2015 nerdralph
  7. 2015 zador-blood-stained
  8. 2016 akatran
  9. 2017-2019 Avamander <avamander@gmail.com>
  10. 2019 IkpeohaGodson
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. version 2 as published by the Free Software Foundation.
  14. */
  15. #ifndef __RF24_CONFIG_H__
  16. #define __RF24_CONFIG_H__
  17. /*** USER DEFINES: ***/
  18. #define FAILURE_HANDLING
  19. //#define SERIAL_DEBUG
  20. //#define MINIMAL
  21. //#define SPI_UART // Requires library from https://github.com/TMRh20/Sketches/tree/master/SPI_UART
  22. //#define SOFTSPI // Requires library from https://github.com/greiman/DigitalIO
  23. /**********************/
  24. #define rf24_max(a,b) (a>b?a:b)
  25. #define rf24_min(a,b) (a<b?a:b)
  26. #if defined (SPI_HAS_TRANSACTION) && !defined (SPI_UART) && !defined (SOFTSPI)
  27. #define RF24_SPI_TRANSACTIONS
  28. #endif // defined (SPI_HAS_TRANSACTION) && !defined (SPI_UART) && !defined (SOFTSPI)
  29. //ATXMega
  30. #if defined (__AVR_ATxmega64D3__) || defined (__AVR_ATxmega128D3__) || defined (__AVR_ATxmega192D3__) || defined (__AVR_ATxmega256D3__) || defined (__AVR_ATxmega384D3__) // In order to be available both in Windows and Linux this should take presence here.
  31. #define XMEGA
  32. #define XMEGA_D3
  33. #include "utility/ATXMegaD3/RF24_arch_config.h"
  34. #elif ( !defined (ARDUINO) ) // Any non-arduino device is handled via configure/Makefile
  35. // The configure script detects device and copies the correct includes.h file to /utility/includes.h
  36. // This behavior can be overridden by calling configure with respective parameters
  37. // The includes.h file defines either RF24_RPi, MRAA, LITTLEWIRE or RF24_SPIDEV and includes the correct RF24_arch_config.h file
  38. #include "utility/includes.h"
  39. //ATTiny
  40. #elif defined (__AVR_ATtiny25__) || defined (__AVR_ATtiny45__) || defined (__AVR_ATtiny85__) || defined (__AVR_ATtiny24__) || defined (__AVR_ATtiny44__) || defined (__AVR_ATtiny84__) || defined (__AVR_ATtiny2313__) || defined (__AVR_ATtiny4313__) || defined (__AVR_ATtiny861__)
  41. #define RF24_TINY
  42. #include "utility/ATTiny/RF24_arch_config.h"
  43. #elif defined (LITTLEWIRE) //LittleWire
  44. #include "utility/LittleWire/RF24_arch_config.h"
  45. #elif defined (TEENSYDUINO) //Teensy
  46. #include "utility/Teensy/RF24_arch_config.h"
  47. #else //Everything else
  48. #include <Arduino.h>
  49. // RF modules support 10 Mhz SPI bus speed
  50. const uint32_t RF24_SPI_SPEED = 10000000;
  51. #if defined (ARDUINO) && !defined (__arm__) && !defined (__ARDUINO_X86__)
  52. #if defined SPI_UART
  53. #include <SPI_UART.h>
  54. #define _SPI uspi
  55. #elif defined (SOFTSPI)
  56. // change these pins to your liking
  57. //
  58. #ifndef SOFT_SPI_MISO_PIN
  59. #define SOFT_SPI_MISO_PIN 9
  60. #endif // SOFT_SPI_MISO_PIN
  61. #ifndef SOFT_SPI_MOSI_PIN
  62. #define SOFT_SPI_MOSI_PIN 8
  63. #endif // SOFT_SPI_MOSI_PIN
  64. #ifndef SOFT_SPI_SCK_PIN
  65. #define SOFT_SPI_SCK_PIN 7
  66. #endif // SOFT_SPI_SCK_PIN
  67. const uint8_t SPI_MODE = 0;
  68. #define _SPI spi
  69. #else // !defined (SPI_UART) && !defined (SOFTSPI)
  70. #include <SPI.h>
  71. #define _SPI SPI
  72. #endif // !defined (SPI_UART) && !defined (SOFTSPI)
  73. #else // defined (ARDUINO) && !defined (__arm__) && !defined (__ARDUINO_X86__)
  74. // Define _BV for non-Arduino platforms and for Arduino DUE
  75. #include <stdint.h>
  76. #include <stdio.h>
  77. #include <string.h>
  78. #if defined(__arm__) || defined (__ARDUINO_X86__)
  79. #if defined (__arm__) && defined (SPI_UART)
  80. #include <SPI_UART.h>
  81. #define _SPI uspi
  82. #else // !defined (__arm__) || !defined (SPI_UART)
  83. #include <SPI.h>
  84. #define _SPI SPI
  85. #endif // !defined (__arm__) || !defined (SPI_UART)
  86. #elif !defined(__arm__) && !defined (__ARDUINO_X86__)
  87. extern HardwareSPI SPI;
  88. #endif // !defined(__arm__) && !defined (__ARDUINO_X86__)
  89. #define _BV(x) (1<<(x))
  90. #endif // defined (ARDUINO) && !defined (__arm__) && !defined (__ARDUINO_X86__)
  91. #ifdef SERIAL_DEBUG
  92. #define IF_SERIAL_DEBUG(x) ({x;})
  93. #else
  94. #define IF_SERIAL_DEBUG(x)
  95. #if defined(RF24_TINY)
  96. #define printf_P(...)
  97. #endif // defined(RF24_TINY)
  98. #endif // SERIAL_DEBUG
  99. #if defined (__ARDUINO_X86__)
  100. #define printf_P printf
  101. #define _BV(bit) (1<<(bit))
  102. #endif // defined (__ARDUINO_X86__)
  103. // Progmem is Arduino-specific
  104. // Arduino DUE is arm and does not include avr/pgmspace
  105. #if defined (ARDUINO_ARCH_ESP8266) || defined (ESP32)
  106. #include <pgmspace.h>
  107. #define PRIPSTR "%s"
  108. #elif defined (ESP32)
  109. #include <pgmspace.h>
  110. #define PRIPSTR "%s"
  111. #elif defined (ARDUINO) && !defined (ESP_PLATFORM) && ! defined (__arm__) && !defined (__ARDUINO_X86__) || defined (XMEGA)
  112. #include <avr/pgmspace.h>
  113. #define PRIPSTR "%S"
  114. #else // !defined (ARDUINO) || defined (ESP_PLATFORM) || defined (__arm__) || defined (__ARDUINO_X86__) && !defined (XMEGA)
  115. #if !defined (ARDUINO) // This doesn't work on Arduino DUE
  116. typedef char const char;
  117. #else // Fill in pgm_read_byte that is used, but missing from DUE
  118. #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
  119. #endif // !defined (ARDUINO)
  120. typedef uint16_t prog_uint16_t;
  121. #define PSTR(x) (x)
  122. #define printf_P printf
  123. #define strlen_P strlen
  124. #define PROGMEM
  125. #define pgm_read_word(p) (*(p))
  126. #define pgm_read_ptr(p) (*(p))
  127. #define PRIPSTR "%s"
  128. #endif // !defined (ARDUINO) || defined (ESP_PLATFORM) || defined (__arm__) || defined (__ARDUINO_X86__) && !defined (XMEGA)
  129. #endif //Everything else
  130. #endif // __RF24_CONFIG_H__