PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
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.

led_sysdefs_avr.h 2.2KB

3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef __INC_LED_SYSDEFS_AVR_H
  2. #define __INC_LED_SYSDEFS_AVR_H
  3. #define FASTLED_AVR
  4. #ifndef INTERRUPT_THRESHOLD
  5. #define INTERRUPT_THRESHOLD 2
  6. #endif
  7. #define FASTLED_SPI_BYTE_ONLY
  8. #include <avr/io.h>
  9. #include <avr/interrupt.h> // for cli/se definitions
  10. // Define the register types
  11. typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */
  12. typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */
  13. // Default to disallowing interrupts (may want to gate this on teensy2 vs. other arm platforms, since the
  14. // teensy2 has a good, fast millis interrupt implementation)
  15. #ifndef FASTLED_ALLOW_INTERRUPTS
  16. #define FASTLED_ALLOW_INTERRUPTS 0
  17. #endif
  18. #if FASTLED_ALLOW_INTERRUPTS == 1
  19. #define FASTLED_ACCURATE_CLOCK
  20. #endif
  21. // Default to using PROGMEM here
  22. #ifndef FASTLED_USE_PROGMEM
  23. #define FASTLED_USE_PROGMEM 1
  24. #endif
  25. #if defined(ARDUINO_AVR_DIGISPARK) || defined(ARDUINO_AVR_DIGISPARKPRO)
  26. #ifndef NO_CORRECTION
  27. #define NO_CORRECTION 1
  28. #endif
  29. #endif
  30. extern "C" {
  31. # if defined(CORE_TEENSY) || defined(TEENSYDUINO)
  32. extern volatile unsigned long timer0_millis_count;
  33. # define MS_COUNTER timer0_millis_count
  34. # elif defined(ATTINY_CORE)
  35. extern volatile unsigned long millis_timer_millis;
  36. # define MS_COUNTER millis_timer_millis
  37. # else
  38. extern volatile unsigned long timer0_millis;
  39. # define MS_COUNTER timer0_millis
  40. # endif
  41. };
  42. // special defs for the tiny environments
  43. #if defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny167__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtinyX41__) || defined(__AVR_ATtiny841__) || defined(__AVR_ATtiny441__)
  44. #define LIB8_ATTINY 1
  45. #define FASTLED_NEEDS_YIELD
  46. #endif
  47. #if defined(ARDUINO) && (ARDUINO > 150) && !defined(IS_BEAN) && !defined (ARDUINO_AVR_DIGISPARK) && !defined (LIB8_TINY) && !defined (ARDUINO_AVR_LARDU_328E)
  48. // don't need YIELD defined by the library
  49. #else
  50. #define FASTLED_NEEDS_YIELD
  51. extern "C" void yield();
  52. #endif
  53. #endif