1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #ifndef MATRIX_H
- #define MATRIX_H
- #include <stdint.h>
- #include <stdbool.h>
- #if MATRIX_COLS <= 8
- typedef uint8_t matrix_row_t;
- #elif MATRIX_COLS <= 16
- typedef uint16_t matrix_row_t;
- #elif MATRIX_COLS <= 32
- typedef uint32_t matrix_row_t;
- #else
- # error "There are too many columns."
- #endif
- #if DIODE_DIRECTION == ROW2COL
- # if MATRIX_ROWS <= 8
- typedef uint8_t matrix_col_t;
- # elif MATRIX_ROWS <= 16
- typedef uint16_t matrix_col_t;
- # elif MATRIX_ROWS <= 32
- typedef uint32_t matrix_col_t;
- # else
- # error "There are too many rows."
- # endif
- #endif
- typedef struct {
- uint8_t input_addr:4;
- uint8_t bit:4;
- } io_pin_t;
- #ifdef __cplusplus
- extern "C" {
- #endif
- uint8_t matrix_rows(void);
- uint8_t matrix_cols(void);
- void matrix_setup(void);
- void matrix_init(void);
- uint8_t matrix_scan(void);
- bool matrix_is_modified(void) __attribute__ ((deprecated));
- bool matrix_is_on(uint8_t row, uint8_t col);
- matrix_row_t matrix_get_row(uint8_t row);
- void matrix_print(void);
- uint8_t matrix_key_count(void);
- void matrix_power_up(void);
- void matrix_power_down(void);
- void matrix_init_quantum(void);
- void matrix_scan_quantum(void);
- #ifdef __cplusplus
- }
- #endif
- #endif
|