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.

Row_IOE.h 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef ROWIOE_H
  2. #define ROWIOE_H
  3. #include <RowBase.h>
  4. #include <RowScanner_PinsBitwise.h>
  5. #include <Debouncer_4Samples.h>
  6. /* Row_DH_IOE is a row connected to an Input/Output Expander.
  7. Configuration
  8. -------------
  9. Define and initilize DELAY_MICROSECONDS in sketch. Detailed how to is in RowBase.cpp.
  10. Instantiation
  11. -------------
  12. Example instantiation of a row:
  13. const uint8_t IOExpanderPort::ADDR = 0x18;
  14. IOExpanderPort port1(1, 0);
  15. RowPort_PCA9655E rowPort1(port1);
  16. IOExpanderPort port0(0, 0);
  17. ColPort_PCA9655E colPort0(port0, 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 );
  18. Key* const ptrsKeys_0[] = { &k_00, &k_01, &k_02, &k_03, &k_04, &k_05 };
  19. Row_IOE row_0(rowPort1, 1<<0, colPort0, ptrsKeys_0);
  20. Number of pins in colPort0 should equal number of keys in ptrsKeys_0[] array.
  21. if a pin is missing, a key will be unresposive
  22. if a Key pointer is missing, the keyboard will fail in an unprdictable way
  23. */
  24. class Row_IOE : public RowBase
  25. {
  26. private:
  27. RowScanner_PinsBitwise scanner;
  28. Debouncer_4Samples debouncer;
  29. public:
  30. Row_IOE( RowPort& refRowPort, const uint8_t strobePin,
  31. ColPort& refColPort, Key *const ptrsKeys[])
  32. : RowBase(ptrsKeys), scanner(refRowPort, strobePin, refColPort) { }
  33. uint8_t scan(uint16_t& rowEnd);
  34. uint8_t debounce(const uint8_t rowState, uint8_t& debounced);
  35. };
  36. #endif