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.

keybrd_6_active_high.ino 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* keybrd_6_active_high.ino
  2. This sketch:
  3. is keybrd_2_single-layer.ino modified to be active high
  4. requires two external pull-down resistors on the first two columns
  5. | Layout | **0** | **1** |
  6. |:------:|-------|-------|
  7. | **0** | 1 | 2 |
  8. | **1** | a | b |
  9. */
  10. // ################## GLOBAL ###################
  11. // ================= INCLUDES ==================
  12. #include <Code_Sc.h>
  13. #include <Row.h>
  14. #include <Scanner_uC.h>
  15. #include <ScanDelay.h>
  16. // ============ SPEED CONFIGURATION ============
  17. ScanDelay scanDelay(9000);
  18. // ================== SCANNER ==================
  19. uint8_t readPins[] = {14, 15};
  20. uint8_t readPinCount = sizeof(readPins)/sizeof(*readPins);
  21. /*
  22. Scanner_uC constructor parameters are: activeState, readPins[], readPinCount.
  23. activeState defines the logic level for strobes, HIGH or LOW.
  24. "Active high" means that if a switch is pressed (active), the read pin is high.
  25. */
  26. Scanner_uC scanner(HIGH, readPins, readPinCount);
  27. // =================== CODES ===================
  28. Code_Sc s_a(KEY_A);
  29. Code_Sc s_b(KEY_B);
  30. Code_Sc s_1(KEY_1);
  31. Code_Sc s_2(KEY_2);
  32. // =================== ROWS ====================
  33. Key* ptrsKeys_0[] = { &s_1, &s_2 };
  34. uint8_t keyCount_0 = sizeof(ptrsKeys_0)/sizeof(*ptrsKeys_0);
  35. Row row_0(scanner, 0, ptrsKeys_0, keyCount_0);
  36. Key* ptrsKeys_1[] = { &s_a, &s_b };
  37. uint8_t keyCount_1 = sizeof(ptrsKeys_1)/sizeof(*ptrsKeys_1);
  38. Row row_1(scanner, 1, ptrsKeys_1, keyCount_1);
  39. // ################### MAIN ####################
  40. void setup()
  41. {
  42. Keyboard.begin();
  43. }
  44. void loop()
  45. {
  46. row_0.process();
  47. row_1.process();
  48. scanDelay.delay();
  49. }