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.

117 lines
3.5 KiB

[Keyboard] Gingham (#6212) * Initial * Prepare for final release * Final * Update keyboards/gingham/matrix.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update keyboards/gingham/config.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hs60/v1/rules.mk Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Fixing copypastas * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * More thingies
5 years ago
[Keyboard] Gingham (#6212) * Initial * Prepare for final release * Final * Update keyboards/gingham/matrix.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update keyboards/gingham/config.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hs60/v1/rules.mk Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Fixing copypastas * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * More thingies
5 years ago
[Keyboard] Gingham (#6212) * Initial * Prepare for final release * Final * Update keyboards/gingham/matrix.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update keyboards/gingham/config.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hs60/v1/rules.mk Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Fixing copypastas * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * More thingies
5 years ago
[Keyboard] Gingham (#6212) * Initial * Prepare for final release * Final * Update keyboards/gingham/matrix.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update keyboards/gingham/config.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hs60/v1/rules.mk Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Fixing copypastas * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * More thingies
5 years ago
[Keyboard] Gingham (#6212) * Initial * Prepare for final release * Final * Update keyboards/gingham/matrix.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update keyboards/gingham/config.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hs60/v1/rules.mk Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Fixing copypastas * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * More thingies
5 years ago
[Keyboard] Gingham (#6212) * Initial * Prepare for final release * Final * Update keyboards/gingham/matrix.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update keyboards/gingham/config.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hs60/v1/rules.mk Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Fixing copypastas * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * More thingies
5 years ago
[Keyboard] Gingham (#6212) * Initial * Prepare for final release * Final * Update keyboards/gingham/matrix.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update keyboards/gingham/config.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hs60/v1/rules.mk Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Fixing copypastas * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * More thingies
5 years ago
[Keyboard] Gingham (#6212) * Initial * Prepare for final release * Final * Update keyboards/gingham/matrix.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update keyboards/gingham/config.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hs60/v1/rules.mk Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Fixing copypastas * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * More thingies
5 years ago
[Keyboard] Gingham (#6212) * Initial * Prepare for final release * Final * Update keyboards/gingham/matrix.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update keyboards/gingham/config.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hs60/v1/rules.mk Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Fixing copypastas * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * More thingies
5 years ago
[Keyboard] Gingham (#6212) * Initial * Prepare for final release * Final * Update keyboards/gingham/matrix.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update keyboards/gingham/config.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hs60/v1/rules.mk Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Fixing copypastas * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * More thingies
5 years ago
[Keyboard] Gingham (#6212) * Initial * Prepare for final release * Final * Update keyboards/gingham/matrix.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/gingham/rules.mk Co-Authored-By: fauxpark <fauxpark@gmail.com> * Update keyboards/gingham/config.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hs60/v1/rules.mk Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/gingham.h Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Fixing copypastas * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/gingham/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * More thingies
5 years ago
  1. /*
  2. Copyright 2012-2019 Jun Wako, Jack Humbert, Yiancar
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include <stdint.h>
  15. #include <stdbool.h>
  16. #include "wait.h"
  17. #include "quantum.h"
  18. #include "i2c_master.h"
  19. static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
  20. static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
  21. static void unselect_rows(void) {
  22. for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
  23. setPinInputHigh(row_pins[x]);
  24. }
  25. }
  26. static void select_row(uint8_t row) {
  27. setPinOutput(row_pins[row]);
  28. writePinLow(row_pins[row]);
  29. }
  30. static void unselect_row(uint8_t row) {
  31. setPinInputHigh(row_pins[row]);
  32. }
  33. static void init_pins(void) {
  34. unselect_rows();
  35. // Set I/O
  36. uint8_t send_data = 0x07;
  37. i2c_writeReg((PORT_EXPANDER_ADDRESS << 1), 0x00, &send_data, 1, 20);
  38. // Set Pull-up
  39. i2c_writeReg((PORT_EXPANDER_ADDRESS << 1), 0x06, &send_data, 1, 20);
  40. for (uint8_t x = 0; x < MATRIX_COLS; x++) {
  41. if ( (x > 0) && (x < 12) ) {
  42. setPinInputHigh(col_pins[x]);
  43. }
  44. }
  45. }
  46. void matrix_init_custom(void) {
  47. // TODO: initialize hardware here
  48. // Initialize I2C
  49. i2c_init();
  50. // initialize key pins
  51. init_pins();
  52. wait_ms(50);
  53. }
  54. static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
  55. // Store last value of row prior to reading
  56. matrix_row_t last_row_value = current_matrix[current_row];
  57. // Clear data in matrix row
  58. current_matrix[current_row] = 0;
  59. // Select row and wait for row selecton to stabilize
  60. select_row(current_row);
  61. wait_us(30);
  62. // For each col...
  63. for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
  64. uint8_t pin_state;
  65. // Select the col pin to read (active low)
  66. switch (col_index) {
  67. case 0 :
  68. i2c_readReg((PORT_EXPANDER_ADDRESS << 1), 0x09, &pin_state, 1, 20);
  69. pin_state = pin_state & 0x01;
  70. break;
  71. case 12 :
  72. i2c_readReg((PORT_EXPANDER_ADDRESS << 1), 0x09, &pin_state, 1, 20);
  73. pin_state = pin_state & (1 << 2);
  74. break;
  75. case 13 :
  76. i2c_readReg((PORT_EXPANDER_ADDRESS << 1), 0x09, &pin_state, 1, 20);
  77. pin_state = pin_state & (1 << 1);
  78. break;
  79. default :
  80. pin_state = readPin(col_pins[col_index]);
  81. }
  82. // Populate the matrix row with the state of the col pin
  83. current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index);
  84. }
  85. // Unselect row
  86. unselect_row(current_row);
  87. return (last_row_value != current_matrix[current_row]);
  88. }
  89. bool matrix_scan_custom(matrix_row_t current_matrix[]) {
  90. bool matrix_has_changed = false;
  91. // Set row, read cols
  92. for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
  93. matrix_has_changed |= read_cols_on_row(current_matrix, current_row);
  94. }
  95. return matrix_has_changed;
  96. }