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.

38 lines
1.3 KiB

  1. /* Copyright 2020 sekigon-gonnoc
  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. //
  17. // Scan EC switch matrix using 74HC7051
  18. // Define MUX_SEL_PINS, DISCHARGE_PIN, and ANALOG_PORT to compile
  19. //
  20. #pragma once
  21. #include <stdint.h>
  22. #include <stdbool.h>
  23. #include "matrix.h"
  24. typedef struct {
  25. uint16_t low_threshold; // threshold for key release
  26. uint16_t high_threshold; // threshold for key press
  27. } ecsm_config_t;
  28. int ecsm_init(ecsm_config_t const* const ecsm_config);
  29. bool ecsm_matrix_scan(matrix_row_t current_matrix[]);
  30. void ecsm_print_matrix(void);
  31. uint16_t ecsm_readkey_raw(uint8_t row, uint8_t col);
  32. bool ecsm_update_key(matrix_row_t* current_row, uint8_t col, uint16_t sw_value);