PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

29 lines
1.2KB

  1. #ifndef TLC_pin_functions_h
  2. #define TLC_pin_functions_h
  3. #if defined(__AVR__)
  4. #define pulse_pin(port, pin) port |= _BV(pin); port &= ~_BV(pin)
  5. #define set_pin(port, pin) port |= _BV(pin)
  6. #define clear_pin(port, pin) port &= ~_BV(pin)
  7. #define output_pin(ddr, pin) ddr |= _BV(pin)
  8. #define pullup_pin(ddr, port, pin) ddr &= ~_BV(pin); port |= _BV(pin)
  9. #elif defined(TEENSYDUINO)
  10. #if F_CPU > 48000000
  11. #define pulse_pin(port, pin) digitalWriteFast(pin, HIGH); asm("nop"); digitalWriteFast(pin, LOW)
  12. #else
  13. #define pulse_pin(port, pin) digitalWriteFast(pin, HIGH); digitalWriteFast(pin, LOW)
  14. #endif
  15. #define set_pin(port, pin) digitalWriteFast(pin, HIGH)
  16. #define clear_pin(port, pin) digitalWriteFast(pin, LOW)
  17. #define output_pin(ddr, pin) pinMode(pin, OUTPUT)
  18. #define pullup_pin(ddr, port, pin) pinMode(pin, INPUT_PULLUP)
  19. #else
  20. #define pulse_pin(port, pin) digitalWrite(pin, HIGH); digitalWrite(pin, LOW)
  21. #define set_pin(port, pin) digitalWrite(pin, HIGH)
  22. #define clear_pin(port, pin) digitalWrite(pin, LOW)
  23. #define output_pin(ddr, pin) pinMode(pin, OUTPUT)
  24. #define pullup_pin(ddr, port, pin) pinMode(pin, INPUT_PULLUP)
  25. #endif
  26. #endif