ec_switch_matrix.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* Copyright 2023 Cipulot
  2. *
  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. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #pragma once
  17. #include <stdint.h>
  18. #include <stdbool.h>
  19. #include "matrix.h"
  20. typedef struct {
  21. uint16_t ecsm_actuation_threshold; // threshold for key release
  22. uint16_t ecsm_release_threshold; // threshold for key press
  23. } ecsm_config_t;
  24. ecsm_config_t ecsm_config;
  25. int ecsm_init(ecsm_config_t const* const ecsm_config);
  26. int ecsm_update(ecsm_config_t const* const ecsm_config);
  27. bool ecsm_matrix_scan(matrix_row_t current_matrix[]);
  28. uint16_t ecsm_readkey_raw(uint8_t channel, uint8_t row, uint8_t col);
  29. bool ecsm_update_key(matrix_row_t* current_row, uint8_t row, uint8_t col, uint16_t sw_value);
  30. void ecsm_print_matrix(void);