diff options
| author | Kenneth Aloysius <krusli@users.noreply.github.com> | 2018-06-01 01:32:05 +1000 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-05-31 08:32:05 -0700 |
| commit | d27855665a349f9afe5c1b457461078f85cf6ffb (patch) | |
| tree | dfa82603c5ed7fea9227e9f6370644aa3003044a /keyboards/ps2avrGB/matrix.c | |
| parent | ee9a7aba396160929604aca54a23ad5534d59940 (diff) | |
| download | qmk_firmware-d27855665a349f9afe5c1b457461078f85cf6ffb.tar.gz qmk_firmware-d27855665a349f9afe5c1b457461078f85cf6ffb.zip | |
Updated matrix.c for some PS2AVRGB boards and templates for new_project script (#2992)
* Add M6-A keymap
* Update XD60 keymap
* Update XD60 keymap readme
* Update JJ40 and Let's Split keymaps
* Add readme for M6-A
* Fix typo, update JJ40 README
* Update jj40 readme
* Cleanup jj40 keymap
* Revert Let's Split QWERTY layer to default before #2010
* Update numpad layers
* Fix: Let's Split keymap getting stuck mods due to having keycodes assigned on the Raise layer
* Keep ASCII art consistent with keymap
* Staryu: initial port
* Add personal keymap
* Added and updated READMEs
* Fix: default keymap for staryu
* Rudimentary backlight support.
* Enabled mousekeys for default keymap
* use QMK_KEYBOARD_H and LAYOUT
* Update readme.md for NIU mini: flash using avrdude
* Fix missing linebreaks for Staryu README
* Update readme.md
* Update PS2AVRGB boards with new matrix.c
* Update canoe matrix.c; untested
* Fix canoe.c for building (needs matrix_scan_user and matrix_init_user)
* Add personal Iris keymap
* Update keymap
* Update keymap
* Update keymap, disable backlighting and underglow
* Move PrintScreen button
* Add README
Diffstat (limited to 'keyboards/ps2avrGB/matrix.c')
| -rw-r--r-- | keyboards/ps2avrGB/matrix.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/keyboards/ps2avrGB/matrix.c b/keyboards/ps2avrGB/matrix.c index 57aa36b5f..245813dfd 100644 --- a/keyboards/ps2avrGB/matrix.c +++ b/keyboards/ps2avrGB/matrix.c | |||
| @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 21 | #include "matrix.h" | 21 | #include "matrix.h" |
| 22 | 22 | ||
| 23 | #ifndef DEBOUNCE | 23 | #ifndef DEBOUNCE |
| 24 | #define DEBOUNCE 5 | 24 | # define DEBOUNCE 5 |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | static uint8_t debouncing = DEBOUNCE; | 27 | static uint8_t debouncing = DEBOUNCE; |
| @@ -29,6 +29,9 @@ static uint8_t debouncing = DEBOUNCE; | |||
| 29 | static matrix_row_t matrix[MATRIX_ROWS]; | 29 | static matrix_row_t matrix[MATRIX_ROWS]; |
| 30 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | 30 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; |
| 31 | 31 | ||
| 32 | void matrix_set_row_status(uint8_t row); | ||
| 33 | uint8_t bit_reverse(uint8_t x); | ||
| 34 | |||
| 32 | void matrix_init(void) { | 35 | void matrix_init(void) { |
| 33 | // all outputs for rows high | 36 | // all outputs for rows high |
| 34 | DDRB = 0xFF; | 37 | DDRB = 0xFF; |
| @@ -47,18 +50,8 @@ void matrix_init(void) { | |||
| 47 | matrix[row] = 0x00; | 50 | matrix[row] = 0x00; |
| 48 | matrix_debouncing[row] = 0x00; | 51 | matrix_debouncing[row] = 0x00; |
| 49 | } | 52 | } |
| 50 | } | ||
| 51 | |||
| 52 | void matrix_set_row_status(uint8_t row) { | ||
| 53 | DDRB = (1 << row); | ||
| 54 | PORTB = ~(1 << row); | ||
| 55 | } | ||
| 56 | 53 | ||
| 57 | uint8_t bit_reverse(uint8_t x) { | 54 | matrix_init_quantum(); |
| 58 | x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); | ||
| 59 | x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); | ||
| 60 | x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); | ||
| 61 | return x; | ||
| 62 | } | 55 | } |
| 63 | 56 | ||
| 64 | uint8_t matrix_scan(void) { | 57 | uint8_t matrix_scan(void) { |
| @@ -93,11 +86,24 @@ uint8_t matrix_scan(void) { | |||
| 93 | } | 86 | } |
| 94 | } | 87 | } |
| 95 | 88 | ||
| 96 | matrix_scan_user(); | 89 | matrix_scan_quantum(); |
| 97 | 90 | ||
| 98 | return 1; | 91 | return 1; |
| 99 | } | 92 | } |
| 100 | 93 | ||
| 94 | // declarations | ||
| 95 | void matrix_set_row_status(uint8_t row) { | ||
| 96 | DDRB = (1 << row); | ||
| 97 | PORTB = ~(1 << row); | ||
| 98 | } | ||
| 99 | |||
| 100 | uint8_t bit_reverse(uint8_t x) { | ||
| 101 | x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); | ||
| 102 | x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); | ||
| 103 | x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); | ||
| 104 | return x; | ||
| 105 | } | ||
| 106 | |||
| 101 | inline matrix_row_t matrix_get_row(uint8_t row) { | 107 | inline matrix_row_t matrix_get_row(uint8_t row) { |
| 102 | return matrix[row]; | 108 | return matrix[row]; |
| 103 | } | 109 | } |
