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.

pin_functions.h 1.2KB

3 jaren geleden
12345678910111213141516171819202122232425262728
  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