diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2017-02-07 13:27:41 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-07 13:27:41 -0500 |
| commit | c0c69a1a7cb232538e99cb4b9cf00370e8c6ce5c (patch) | |
| tree | ddfe2ef236c3e230fa57560fc2a6dca447ca31a0 /quantum | |
| parent | 3c7fa0acc10305a573bc3bb29243a7a3d601579b (diff) | |
| parent | 06d21009b2198a2941f4c341807ad2290b5967f6 (diff) | |
| download | qmk_firmware-c0c69a1a7cb232538e99cb4b9cf00370e8c6ce5c.tar.gz qmk_firmware-c0c69a1a7cb232538e99cb4b9cf00370e8c6ce5c.zip | |
Merge pull request #1068 from adzenith/master
Minor cleanup
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/config_common.h | 6 | ||||
| -rwxr-xr-x | quantum/light_ws2812.c | 6 | ||||
| -rw-r--r-- | quantum/matrix.c | 14 | ||||
| -rw-r--r-- | quantum/template/config.h | 2 |
4 files changed, 15 insertions, 13 deletions
diff --git a/quantum/config_common.h b/quantum/config_common.h index 4bdb2065d..28f68b9c7 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h | |||
| @@ -2,8 +2,10 @@ | |||
| 2 | #define CONFIG_DEFINITIONS_H | 2 | #define CONFIG_DEFINITIONS_H |
| 3 | 3 | ||
| 4 | /* diode directions */ | 4 | /* diode directions */ |
| 5 | #define COL2ROW 0 | 5 | #define COL2ROW 0 |
| 6 | #define ROW2COL 1 | 6 | #define ROW2COL 1 |
| 7 | #define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */ | ||
| 8 | |||
| 7 | /* I/O pins */ | 9 | /* I/O pins */ |
| 8 | #ifndef F0 | 10 | #ifndef F0 |
| 9 | #define B0 0x30 | 11 | #define B0 0x30 |
diff --git a/quantum/light_ws2812.c b/quantum/light_ws2812.c index a883b1388..55bdd9cd8 100755 --- a/quantum/light_ws2812.c +++ b/quantum/light_ws2812.c | |||
| @@ -70,7 +70,7 @@ void I2C_WriteBit(unsigned char c) | |||
| 70 | 70 | ||
| 71 | // Inits bitbanging port, must be called before using the functions below | 71 | // Inits bitbanging port, must be called before using the functions below |
| 72 | // | 72 | // |
| 73 | void I2C_Init() | 73 | void I2C_Init(void) |
| 74 | { | 74 | { |
| 75 | I2C_PORT &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK)); | 75 | I2C_PORT &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK)); |
| 76 | 76 | ||
| @@ -82,7 +82,7 @@ void I2C_Init() | |||
| 82 | 82 | ||
| 83 | // Send a START Condition | 83 | // Send a START Condition |
| 84 | // | 84 | // |
| 85 | void I2C_Start() | 85 | void I2C_Start(void) |
| 86 | { | 86 | { |
| 87 | // set both to high at the same time | 87 | // set both to high at the same time |
| 88 | I2C_DDR &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK)); | 88 | I2C_DDR &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK)); |
| @@ -97,7 +97,7 @@ void I2C_Start() | |||
| 97 | 97 | ||
| 98 | // Send a STOP Condition | 98 | // Send a STOP Condition |
| 99 | // | 99 | // |
| 100 | void I2C_Stop() | 100 | void I2C_Stop(void) |
| 101 | { | 101 | { |
| 102 | I2C_CLOCK_HI(); | 102 | I2C_CLOCK_HI(); |
| 103 | _delay_us(I2C_DELAY); | 103 | _delay_us(I2C_DELAY); |
diff --git a/quantum/matrix.c b/quantum/matrix.c index 07eb87bc3..ac523482a 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c | |||
| @@ -60,13 +60,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 60 | extern const matrix_row_t matrix_mask[]; | 60 | extern const matrix_row_t matrix_mask[]; |
| 61 | #endif | 61 | #endif |
| 62 | 62 | ||
| 63 | #if (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW) | ||
| 63 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | 64 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; |
| 64 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | 65 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; |
| 66 | #endif | ||
| 65 | 67 | ||
| 66 | /* matrix state(1:on, 0:off) */ | 68 | /* matrix state(1:on, 0:off) */ |
| 67 | static matrix_row_t matrix[MATRIX_ROWS]; | 69 | static matrix_row_t matrix[MATRIX_ROWS]; |
| 68 | 70 | ||
| 69 | static matrix_row_t matrix_raw[MATRIX_ROWS]; | ||
| 70 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | 71 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; |
| 71 | 72 | ||
| 72 | 73 | ||
| @@ -76,7 +77,7 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | |||
| 76 | static void unselect_rows(void); | 77 | static void unselect_rows(void); |
| 77 | static void select_row(uint8_t row); | 78 | static void select_row(uint8_t row); |
| 78 | static void unselect_row(uint8_t row); | 79 | static void unselect_row(uint8_t row); |
| 79 | #else // ROW2COL | 80 | #elif (DIODE_DIRECTION == ROW2COL) |
| 80 | static void init_rows(void); | 81 | static void init_rows(void); |
| 81 | static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col); | 82 | static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col); |
| 82 | static void unselect_cols(void); | 83 | static void unselect_cols(void); |
| @@ -133,7 +134,7 @@ uint8_t matrix_cols(void) { | |||
| 133 | // /* PORTxn */ | 134 | // /* PORTxn */ |
| 134 | // _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF); | 135 | // _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF); |
| 135 | // } | 136 | // } |
| 136 | // #else | 137 | // #elif (DIODE_DIRECTION == ROW2COL) |
| 137 | // for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { | 138 | // for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { |
| 138 | // /* DDRxn */ | 139 | // /* DDRxn */ |
| 139 | // _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF); | 140 | // _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF); |
| @@ -158,7 +159,7 @@ void matrix_init(void) { | |||
| 158 | #if (DIODE_DIRECTION == COL2ROW) | 159 | #if (DIODE_DIRECTION == COL2ROW) |
| 159 | unselect_rows(); | 160 | unselect_rows(); |
| 160 | init_cols(); | 161 | init_cols(); |
| 161 | #else // ROW2COL | 162 | #elif (DIODE_DIRECTION == ROW2COL) |
| 162 | unselect_cols(); | 163 | unselect_cols(); |
| 163 | init_rows(); | 164 | init_rows(); |
| 164 | #endif | 165 | #endif |
| @@ -166,7 +167,6 @@ void matrix_init(void) { | |||
| 166 | // initialize matrix state: all keys off | 167 | // initialize matrix state: all keys off |
| 167 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | 168 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { |
| 168 | matrix[i] = 0; | 169 | matrix[i] = 0; |
| 169 | matrix_raw[i] = 0; | ||
| 170 | matrix_debouncing[i] = 0; | 170 | matrix_debouncing[i] = 0; |
| 171 | } | 171 | } |
| 172 | 172 | ||
| @@ -194,7 +194,7 @@ uint8_t matrix_scan(void) | |||
| 194 | 194 | ||
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | #else // ROW2COL | 197 | #elif (DIODE_DIRECTION == ROW2COL) |
| 198 | 198 | ||
| 199 | // Set col, read rows | 199 | // Set col, read rows |
| 200 | for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { | 200 | for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { |
| @@ -336,7 +336,7 @@ static void unselect_rows(void) | |||
| 336 | } | 336 | } |
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | #else // ROW2COL | 339 | #elif (DIODE_DIRECTION == ROW2COL) |
| 340 | 340 | ||
| 341 | static void init_rows(void) | 341 | static void init_rows(void) |
| 342 | { | 342 | { |
diff --git a/quantum/template/config.h b/quantum/template/config.h index b02f0c7eb..c61c4a618 100644 --- a/quantum/template/config.h +++ b/quantum/template/config.h | |||
| @@ -46,7 +46,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 46 | #define MATRIX_COL_PINS { F1, F0, B0 } | 46 | #define MATRIX_COL_PINS { F1, F0, B0 } |
| 47 | #define UNUSED_PINS | 47 | #define UNUSED_PINS |
| 48 | 48 | ||
| 49 | /* COL2ROW or ROW2COL */ | 49 | /* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ |
| 50 | #define DIODE_DIRECTION COL2ROW | 50 | #define DIODE_DIRECTION COL2ROW |
| 51 | 51 | ||
| 52 | // #define BACKLIGHT_PIN B7 | 52 | // #define BACKLIGHT_PIN B7 |
