Kiibohd Controller
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.

matrix_scan.h 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* Copyright (C) 2011,2014-2015 by Jacob Alexander
  2. *
  3. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4. * of this software and associated documentation files (the "Software"), to deal
  5. * in the Software without restriction, including without limitation the rights
  6. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. * copies of the Software, and to permit persons to whom the Software is
  8. * furnished to do so, subject to the following conditions:
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. *
  13. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. * THE SOFTWARE.
  20. */
  21. #pragma once
  22. // ----- Includes -----
  23. // Compiler Includes
  24. #include <stdint.h>
  25. // Local Includes
  26. // ----- Defines -----
  27. // ----- Quick Map (don't change) -----
  28. #define pinA0 0
  29. #define pinA1 1
  30. #define pinA2 2
  31. #define pinA3 3
  32. #define pinA4 4
  33. #define pinA5 5
  34. #define pinA6 6
  35. #define pinA7 7
  36. #define pinB0 10
  37. #define pinB1 11
  38. #define pinB2 12
  39. #define pinB3 13
  40. #define pinB4 14
  41. #define pinB5 15
  42. #define pinB6 16
  43. #define pinB7 17
  44. #define pinC0 20
  45. #define pinC1 21
  46. #define pinC2 22
  47. #define pinC3 23
  48. #define pinC4 24
  49. #define pinC5 25
  50. #define pinC6 26
  51. #define pinC7 27
  52. #define pinD0 30
  53. #define pinD1 31
  54. #define pinD2 32
  55. #define pinD3 33
  56. #define pinD4 34
  57. #define pinD5 35
  58. #define pinD6 36
  59. #define pinD7 37
  60. #define pinE0 40
  61. #define pinE1 41
  62. #define pinE2 42
  63. #define pinE3 43
  64. #define pinE4 44
  65. #define pinE5 45
  66. #define pinE6 46
  67. #define pinE7 47
  68. #define pinF0 50
  69. #define pinF1 51
  70. #define pinF2 52
  71. #define pinF3 53
  72. #define pinF4 54
  73. #define pinF5 55
  74. #define pinF6 56
  75. #define pinF7 57
  76. #define pinNULL 128
  77. // ----- Scan Mode (usually dual-scan) -----
  78. // Ordered by increasing memory/CPU usage
  79. #define scanRow 0 // Needed for powered switches (Hall-Effect)
  80. #define scanCol 1 // Opposite of scanRow
  81. #define scanRow_powrCol 2 // NKRO supported matrix (simple detection)
  82. #define scanCol_powrRow 3 // Opposite of scanRow_powrCol
  83. #define scanDual 4 // Typical ~2KRO matrix
  84. #define powrRow 5 // Matrix setup for powering a row, initially the row would be set low
  85. #define powrCol 6 // Like powrRow but for columns
  86. // ----- Direction -----
  87. #define columnSet 0 // PIN_SET_COL for PIN_SET
  88. #define rowSet 1 // PIN_SET_ROW for PIN_SET
  89. // ----- Variables -----
  90. // ----- Functions -----
  91. void matrix_pinSetup( uint8_t *matrix, uint8_t scanType );
  92. void matrix_scan( uint8_t *matrix, uint8_t *detectArray );