keybrd library is an open source library for creating custom-keyboard firmware.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
Ce dépôt est archivé. Vous pouvez voir les fichiers et le cloner, mais vous ne pouvez pas pousser ni ouvrir de ticket/demande d'ajout.

Scanner_IOE.cpp 867B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "Scanner_IOE.h"
  2. /* Row constructor calls every Scanner's init().
  3. */
  4. void Scanner_IOE::init(const uint8_t strobePin)
  5. {
  6. //emty function
  7. }
  8. /* begin() should be called once from sketch setup().
  9. */
  10. void Scanner_IOE::begin()
  11. {
  12. Wire.begin();
  13. refPortWrite.begin();
  14. refPortRead.begin();
  15. }
  16. /* scan() strobes the row's strobePin and retuns state of port's input pins.
  17. Bitwise variables are 1 bit per key.
  18. */
  19. uint8_t Scanner_IOE::scan(const uint8_t strobePin)
  20. {
  21. uint8_t readState; //bitwise, 1 means key is pressed, 0 means released
  22. //strobe on
  23. refPortWrite.write(strobePin, strobeOn);
  24. delayMicroseconds(3); //time to stabilize voltage
  25. //read the port pins
  26. readState = refPortRead.read();
  27. //strobe off
  28. refPortWrite.write(strobePin, strobeOff);
  29. return readState;
  30. }