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.

RowScanner_SPIShiftRegisters.h 944B

12345678910111213141516171819202122232425
  1. #ifndef ROWSCANNER_SPI_SHIFTREGISTERS_H
  2. #define ROWSCANNER_SPI_SHIFTREGISTERS_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <SPI.h>
  6. #include <RowScannerInterface.h>
  7. #include <RowPort.h>
  8. #include <ColPort.h>
  9. /* RowScanner_SPIShiftRegisters reads all shift registers in a daisy chain.
  10. //todo delete: Assumes only one row of shift registers is connected (no Slave Select).
  11. */
  12. class RowScanner_SPIShiftRegisters : public RowScannerInterface
  13. {
  14. private:
  15. const uint8_t SS; //Slave Select, pin on master
  16. const uint8_t BYTE_COUNT; //number of shift registers
  17. const uint8_t KEY_COUNT; //number of keys in row
  18. public:
  19. RowScanner_SPIShiftRegisters(const uint8_t SS, uint8_t BYTE_COUNT, uint16_t KEY_COUNT)
  20. : SS(SS), BYTE_COUNT(BYTE_COUNT), KEY_COUNT(KEY_COUNT) {}
  21. virtual uint8_t scan(uint16_t& rowEnd);
  22. void begin();
  23. };
  24. #endif