keybrd library is an open source library for creating custom-keyboard firmware.
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

RowPort_AVR_Optic.h 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef ROWPORT_AVR_OPTIC_H
  2. #define ROWPORT_AVR_OPTIC_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <RowPort.h>
  6. /* One AVR microcontroller port connected to matrix rows.
  7. setActivePinHigh() has a delay to allow phototransistors time to sense strobe
  8. (DodoHand has optic switches with phototransistors).
  9. Instantiation
  10. ------------
  11. The constructor configures all pins of port as output (for strobe pins and LED).
  12. The 'x' in parameters DDRx, PORTx, and PINx should all be the same letter.
  13. Example instantiation for row port F:
  14. RowPort_AVR_Optic rowPortF(DDRF, PORTF);
  15. Diode orientation
  16. ----------------
  17. Rows, columns, and diode orientation are explained in Matrix.h
  18. */
  19. class RowPort_AVR_Optic : public RowPort
  20. {
  21. private:
  22. const volatile unsigned char& DDR; //Data Direction Register
  23. protected:
  24. volatile unsigned char& PORT; //PORT register
  25. public:
  26. //The constructor initialization list is in .cpp
  27. RowPort_AVR_Optic(volatile unsigned char& DDRx, volatile unsigned char& PORTx);
  28. virtual void setActivePinLow(const uint8_t activePin); //activePin is a port mask
  29. virtual void setActivePinHigh(const uint8_t activePin);
  30. };
  31. #endif