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.

Scanner_Port.cpp 566B

123456789101112131415161718192021
  1. #include "Scanner_Port.h"
  2. /* scan() strobes the row's strobePin and retuns state of port's input pins.
  3. Bitwise variables are 1 bit per key.
  4. */
  5. uint8_t Scanner_Port::scan()
  6. {
  7. uint8_t readState; //bitwise, 1 means key is pressed, 0 means released
  8. //strobe on
  9. refPortWrite.write(strobePin, STROBE_ON);
  10. delayMicroseconds(3); //time to stabilize voltage
  11. //read the port pins
  12. readState = refPortRead.read();
  13. //strobe off
  14. refPortWrite.write(strobePin, STROBE_OFF);
  15. return readState;
  16. }