keybrd library is an open source library for creating custom-keyboard firmware.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
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.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* keybrd_6_active_high.ino
  2. This sketch:
  3. is the tutorial 2 sketch with STROBE_ON/STROBE_OFF values swapped
  4. is active high 1-layer keyboard
  5. runs on the first two rows and columns of a active-high breadboard keyboard
  6. | Layout | **0** | **1** |
  7. |:------:|-------|-------|
  8. | **0** | shift | a |
  9. | **1** | b | c |
  10. */
  11. // ################## GLOBAL ###################
  12. // ================= INCLUDES ==================
  13. #include <ScanDelay.h>
  14. #include <Code_Sc.h>
  15. #include <Row_uC.h>
  16. // ============ SPEED CONFIGURATION ============
  17. ScanDelay scanDelay(9000);
  18. /* ================ ACTIVE STATE ===============
  19. STROBE_ON and STROBE_OFF define the logic levels for the strobe.
  20. "Active high" means that if a switch is pressed (active), the read pin is high.
  21. To make this sketch active high, STROBE_ON should be HIGH.
  22. Compared active low, STROBE_ON/STROBE_OFF values swapped.
  23. */
  24. const bool Scanner_uC::STROBE_ON = HIGH; //set matrix for active high
  25. const bool Scanner_uC::STROBE_OFF = LOW;
  26. // ================= PINS =================
  27. uint8_t readPins[] = {14, 15};
  28. uint8_t READ_PIN_COUNT = sizeof(readPins)/sizeof(*readPins);
  29. // =================== CODES ===================
  30. Code_Sc s_a(KEY_A);
  31. Code_Sc s_b(KEY_B);
  32. Code_Sc s_c(KEY_C);
  33. Code_Sc s_shift(MODIFIERKEY_LEFT_SHIFT);
  34. // =================== ROWS ====================
  35. Key* ptrsKeys_0[] = { &s_shift, &s_a };
  36. Row_uC row_0(0, readPins, READ_PIN_COUNT, ptrsKeys_0);
  37. Key* ptrsKeys_1[] = { &s_b, &s_c };
  38. Row_uC row_1(1, readPins, READ_PIN_COUNT, ptrsKeys_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. }