@@ -49,10 +49,6 @@ static uint8_t debouncing = DEBOUNCE_RELOAD;
4949static matrix_row_t matrix [MATRIX_ROWS ];
5050static matrix_row_t matrix_debouncing [MATRIX_ROWS ];
5151
52- static matrix_row_t read_cols (void );
53- static void select_row (uint8_t row );
54- static void unselect_rows (uint8_t row );
55-
5652#ifdef ROW_IN
5753#define READ_COL (pin ) (!nrf_gpio_pin_read(pin))
5854#else
@@ -63,7 +59,7 @@ static void unselect_rows(uint8_t row);
6359 * @brief 初始化键盘阵列
6460 *
6561 */
66- void matrix_init (void )
62+ __attribute__(( weak )) void matrix_init (void )
6763{
6864 for (uint_fast8_t i = MATRIX_COLS ; i -- ;) {
6965#ifdef ROW_IN
@@ -74,7 +70,7 @@ void matrix_init(void)
7470 }
7571}
7672/** read all rows */
77- static matrix_row_t read_cols (void )
73+ __attribute__(( weak )) matrix_row_t read_cols (void )
7874{
7975 matrix_row_t result = 0 ;
8076
@@ -86,7 +82,7 @@ static matrix_row_t read_cols(void)
8682 return result ;
8783}
8884
89- static void select_row (uint8_t row )
85+ __attribute__(( weak )) void select_row (uint8_t row )
9086{
9187 if ((uint32_t )row_pin_array [row ] > 31 )
9288 return ;
@@ -108,7 +104,7 @@ nrf_gpio_cfg(
108104#endif
109105}
110106
111- static void unselect_rows (uint8_t row )
107+ __attribute__(( weak )) void unselect_rows (uint8_t row )
112108{
113109 if ((uint32_t )row_pin_array [row ] > 31 )
114110 return ;
@@ -133,7 +129,7 @@ static inline void delay_us(void)
133129 }
134130}
135131
136- uint8_t matrix_scan (void )
132+ __attribute__(( weak )) uint8_t matrix_scan (void )
137133{
138134 for (uint8_t i = 0 ; i < MATRIX_ROWS ; i ++ ) {
139135 select_row (i );
@@ -165,7 +161,7 @@ uint8_t matrix_scan(void)
165161 return 1 ;
166162}
167163
168- bool matrix_is_modified (void )
164+ __attribute__(( weak )) bool matrix_is_modified (void )
169165{
170166 if (debouncing )
171167 return false;
@@ -245,7 +241,7 @@ uint8_t matrix_key_count(void)
245241 * @brief 禁用所有阵列针脚
246242 *
247243 */
248- void matrix_deinit (void )
244+ __attribute__(( weak )) void matrix_deinit (void )
249245{
250246 for (uint8_t i = 0 ; i < MATRIX_COLS ; i ++ ) {
251247 nrf_gpio_cfg_default (column_pin_array [i ]);
@@ -259,7 +255,7 @@ void matrix_deinit(void)
259255 * @brief 阵列准备睡眠
260256 *
261257 */
262- void matrix_wakeup_prepare (void )
258+ __attribute__(( weak )) void matrix_wakeup_prepare (void )
263259{
264260// 这里监听所有按键作为唤醒按键,所以真正的唤醒判断应该在main的初始化过程中
265261#ifdef ROW_IN
0 commit comments