Keyboard firmwares for Atmel AVR and Cortex-M
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.

matrix_skel.h 826B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef MATRIX_SKEL_H
  2. #define MATRIX_SKEL_H 1
  3. #include <stdbool.h>
  4. /* number of matrix rows */
  5. uint8_t matrix_rows(void);
  6. /* number of matrix columns */
  7. uint8_t matrix_cols(void);
  8. /* intialize matrix for scaning. should be called once. */
  9. void matrix_init(void);
  10. /* scan all key states on matrix */
  11. uint8_t matrix_scan(void);
  12. /* whether modified from previous scan. used after matrix_scan. */
  13. bool matrix_is_modified(void);
  14. /* whether ghosting occur on matrix. */
  15. bool matrix_has_ghost(void);
  16. /* whether a swtich is on */
  17. bool matrix_is_on(uint8_t row, uint8_t col);
  18. /* matrix state on row */
  19. #if (MATRIX_COLS <= 8)
  20. uint8_t matrix_get_row(uint8_t row);
  21. #else
  22. uint16_t matrix_get_row(uint8_t row);
  23. #endif
  24. /* count keys pressed */
  25. uint8_t matrix_key_count(void);
  26. /* print matrix for debug */
  27. void matrix_print(void);
  28. #endif