keybrd library is an open source library for creating custom-keyboard firmware.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
このリポジトリはアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュや、課題・プルリクエストのオープンはできません。

RowBase.h 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef ROWBASE_H
  2. #define ROWBASE_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <Key.h>
  6. #include <RowPort.h>
  7. #include <ColPort.h>
  8. /* RowBase is an abstract base class.
  9. */
  10. class RowBase
  11. {
  12. private:
  13. Key *const *const ptrsKeys; //array of Key pointers
  14. RowPort &refRowPort; //this row's IC port
  15. const uint8_t rowPin; //bitwise, 1 indicates IC pin connected to this row
  16. ColPort *const *const ptrsColPorts; //array of column ports
  17. const uint8_t colPortCount;
  18. void scan(const bool activeHigh);
  19. uint8_t getRowState(uint16_t& rowEnd, const bool activeHigh);
  20. virtual uint8_t debounce(const uint8_t rowState)=0;
  21. void pressRelease(const uint16_t rowEnd, const uint8_t debouncedChanged);
  22. virtual void keyWasPressed();
  23. protected:
  24. uint8_t previousDebounced; //bitwise, one bit per key
  25. public:
  26. RowBase( RowPort &refRowPort, const uint8_t rowPin,
  27. ColPort *const ptrsColPorts[], const uint8_t colPortCount,
  28. Key *const ptrsKeys[])
  29. : ptrsKeys(ptrsKeys), refRowPort(refRowPort), rowPin(rowPin),
  30. ptrsColPorts(ptrsColPorts), colPortCount(colPortCount),
  31. previousDebounced(0) { }
  32. //Key* getPtrKey(uint8_t col) const; todo delete, no longer needed 5/31/16
  33. void process(const bool activeHigh);
  34. };
  35. #endif