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.cpp 519B

1234567891011121314151617181920212223
  1. #include "RowScanner_SPIShiftRegisters.h"
  2. void RowScanner_SPIShiftRegisters::begin()
  3. {
  4. pinMode (SS, OUTPUT);
  5. digitalWrite (SS, HIGH);
  6. }
  7. /*
  8. Sets rowEnd and returns rowState.
  9. */
  10. read_pins_t RowScanner_SPIShiftRegisters::scan(read_pins_mask_t& rowEnd)
  11. {
  12. //todo rowEnd, rowState, return int size depend on BYTE_COUNT, like in send()
  13. read_pins_t rowState = 0;
  14. digitalWrite(SS, LOW);
  15. digitalWrite(SS, HIGH);
  16. SPI.transfer(&rowState, BYTE_COUNT);
  17. rowEnd = 1 << KEY_COUNT;
  18. return rowState;
  19. }