diff options
author | Jack Humbert <jack.humb@gmail.com> | 2018-06-12 10:59:35 -0400 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-06-12 10:59:35 -0400 |
commit | 998ddbb122c9d3e2a77bd4e88c881b225ca0d569 (patch) | |
tree | ca91ff7ad3c4866555d1e623fe9ea05276397e1c /quantum | |
parent | c0095710a7c7e9bd94aa9f4dd814dc28d718c731 (diff) | |
parent | 06487daaddf923d635e8a528d1eb644b875a73f6 (diff) |
Merge branch 'master' of github.com:qmk/qmk_firmware into hf/shinydox
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/audio/song_list.h | 14 | ||||
-rw-r--r-- | quantum/process_keycode/process_leader.c | 4 | ||||
-rw-r--r-- | quantum/process_keycode/process_leader.h | 5 | ||||
-rw-r--r-- | quantum/process_keycode/process_terminal.c | 2 | ||||
-rw-r--r-- | quantum/quantum.c | 7 | ||||
-rw-r--r-- | quantum/quantum_keycodes.h | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix.c | 5 | ||||
-rw-r--r-- | quantum/rgblight.c | 131 | ||||
-rw-r--r-- | quantum/rgblight.h | 13 | ||||
-rw-r--r-- | quantum/rgblight_list.h | 24 | ||||
-rw-r--r-- | quantum/template/ps2avrgb/matrix.c | 32 |
11 files changed, 193 insertions, 46 deletions
diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h index 1ddcfb345c..8bcc1a9220 100644 --- a/quantum/audio/song_list.h +++ b/quantum/audio/song_list.h @@ -187,7 +187,7 @@ Q__NOTE(_AS5 ), \ Q__NOTE(_B5), \ Q__NOTE(_C6 ), \ - Q__NOTE(_CS6 ), + Q__NOTE(_CS6 ), #define MAJOR_SOUND \ Q__NOTE(_A5 ), \ @@ -423,4 +423,16 @@ H__NOTE(_FS5), \ H__NOTE(_D5 ), \ +#define VICTORY_FANFARE_SHORT \ + ED_NOTE(_C6), \ + ED_NOTE(_C6), \ + ED_NOTE(_C6), \ + ED_NOTE(_C6), \ + W__NOTE(_REST), \ + QD_NOTE(_GS5), \ + QD_NOTE(_AS5), \ + Q__NOTE(_C6), \ + Q__NOTE(_AS5), \ + Q__NOTE(_C6), \ + #endif diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c index e0fe476548..c87ef115af 100644 --- a/quantum/process_keycode/process_leader.c +++ b/quantum/process_keycode/process_leader.c @@ -18,6 +18,10 @@ #include "process_leader.h" +#ifndef LEADER_TIMEOUT + #define LEADER_TIMEOUT 300 +#endif + __attribute__ ((weak)) void leader_start(void) {} diff --git a/quantum/process_keycode/process_leader.h b/quantum/process_keycode/process_leader.h index da7a3d2ef7..59c3eed1be 100644 --- a/quantum/process_keycode/process_leader.h +++ b/quantum/process_keycode/process_leader.h @@ -19,14 +19,13 @@ #include "quantum.h" + bool process_leader(uint16_t keycode, keyrecord_t *record); void leader_start(void); void leader_end(void); -#ifndef LEADER_TIMEOUT - #define LEADER_TIMEOUT 200 -#endif + #define SEQ_ONE_KEY(key) if (leader_sequence[0] == (key) && leader_sequence[1] == 0 && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0) #define SEQ_TWO_KEYS(key1, key2) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0) #define SEQ_THREE_KEYS(key1, key2, key3) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == 0 && leader_sequence[4] == 0) diff --git a/quantum/process_keycode/process_terminal.c b/quantum/process_keycode/process_terminal.c index bc365dddfa..6998639f20 100644 --- a/quantum/process_keycode/process_terminal.c +++ b/quantum/process_keycode/process_terminal.c @@ -158,7 +158,7 @@ void terminal_keymap(void) { for (int c = 0; c < MATRIX_COLS; c++) { uint16_t keycode = pgm_read_word(&keymaps[layer][r][c]); char keycode_s[8]; - sprintf(keycode_s, "0x%04x, ", keycode); + sprintf(keycode_s, "0x%04x,", keycode); send_string(keycode_s); } send_string(newline); diff --git a/quantum/quantum.c b/quantum/quantum.c index f9b3e2197d..cfa3df7418 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -442,7 +442,12 @@ bool process_record_quantum(keyrecord_t *record) { } } return false; - #endif + case RGB_MODE_RGBTEST: + if (record->event.pressed) { + rgblight_mode(35); + } + return false; + #endif // defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) #ifdef PROTOCOL_LUFA case OUT_AUTO: if (record->event.pressed) { diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 405741eb15..f2cdb8a3bf 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -423,6 +423,7 @@ enum quantum_keycodes { RGB_MODE_KNIGHT, RGB_MODE_XMAS, RGB_MODE_GRADIENT, + RGB_MODE_RGBTEST, // Left shift, open paren KC_LSPO, @@ -586,6 +587,7 @@ enum quantum_keycodes { #define RGB_M_K RGB_MODE_KNIGHT #define RGB_M_X RGB_MODE_XMAS #define RGB_M_G RGB_MODE_GRADIENT +#define RGB_M_T RGB_MODE_RGBTEST // L-ayer, T-ap - 256 keycode max, 16 layer max #define LT(layer, kc) (kc | QK_LAYER_TAP | ((layer & 0xF) << 8)) diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index 992ce99de9..8c41fc54d2 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c @@ -149,8 +149,9 @@ void rgb_matrix_set_suspend_state(bool state) { void rgb_matrix_test(void) { // Mask out bits 4 and 5 - // This 2-bit value will stay the same for 16 ticks. - switch ( (g_tick & 0x30) >> 4 ) + // Increase the factor to make the test animation slower (and reduce to make it faster) + uint8_t factor = 10; + switch ( (g_tick & (0b11 << factor)) >> factor ) { case 0: { diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 75512e97a7..8b2a3cd9f8 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -42,9 +42,10 @@ __attribute__ ((weak)) const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31}; __attribute__ ((weak)) const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90}; +__attribute__ ((weak)) +const uint16_t RGBLED_RGBTEST_INTERVALS[] PROGMEM = {1024}; rgblight_config_t rgblight_config; -rgblight_config_t inmem_config; LED_TYPE led[RGBLED_NUM]; uint8_t rgblight_inited = 0; @@ -161,7 +162,7 @@ void rgblight_init(void) { #endif if (rgblight_config.enable) { - rgblight_mode(rgblight_config.mode); + rgblight_mode_noeeprom(rgblight_config.mode); } } @@ -218,7 +219,7 @@ uint32_t rgblight_get_mode(void) { return rgblight_config.mode; } -void rgblight_mode(uint8_t mode) { +void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { if (!rgblight_config.enable) { return; } @@ -229,20 +230,25 @@ void rgblight_mode(uint8_t mode) { } else { rgblight_config.mode = mode; } - eeconfig_update_rgblight(rgblight_config.raw); - xprintf("rgblight mode: %u\n", rgblight_config.mode); + if (write_to_eeprom) { + eeconfig_update_rgblight(rgblight_config.raw); + xprintf("rgblight mode [EEPROM]: %u\n", rgblight_config.mode); + } else { + xprintf("rgblight mode [NOEEPROM]: %u\n", rgblight_config.mode); + } if (rgblight_config.mode == 1) { #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); #endif - } else if (rgblight_config.mode >= 2 && rgblight_config.mode <= 24) { + } else if ((rgblight_config.mode >= 2 && rgblight_config.mode <= 24) || + rgblight_config.mode == 35 ) { // MODE 2-5, breathing // MODE 6-8, rainbow mood // MODE 9-14, rainbow swirl // MODE 15-20, snake // MODE 21-23, knight // MODE 24, xmas - // MODE 25-34, static rainbow + // MODE 35 RGB test #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_enable(); @@ -254,11 +260,20 @@ void rgblight_mode(uint8_t mode) { rgblight_timer_disable(); #endif } - rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); + rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); } +void rgblight_mode(uint8_t mode) { + rgblight_mode_eeprom_helper(mode, true); +} + +void rgblight_mode_noeeprom(uint8_t mode) { + rgblight_mode_eeprom_helper(mode, false); +} + + void rgblight_toggle(void) { - xprintf("rgblight toggle: rgblight_config.enable = %u\n", !rgblight_config.enable); + xprintf("rgblight toggle [EEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable); if (rgblight_config.enable) { rgblight_disable(); } @@ -267,17 +282,34 @@ void rgblight_toggle(void) { } } +void rgblight_toggle_noeeprom(void) { + xprintf("rgblight toggle [NOEEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable); + if (rgblight_config.enable) { + rgblight_disable_noeeprom(); + } + else { + rgblight_enable_noeeprom(); + } +} + void rgblight_enable(void) { rgblight_config.enable = 1; - eeconfig_update_rgblight(rgblight_config.raw); - xprintf("rgblight enable: rgblight_config.enable = %u\n", rgblight_config.enable); + // No need to update EEPROM here. rgblight_mode() will do that, actually + //eeconfig_update_rgblight(rgblight_config.raw); + xprintf("rgblight enable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); rgblight_mode(rgblight_config.mode); } +void rgblight_enable_noeeprom(void) { + rgblight_config.enable = 1; + xprintf("rgblight enable [NOEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); + rgblight_mode_noeeprom(rgblight_config.mode); +} + void rgblight_disable(void) { rgblight_config.enable = 0; eeconfig_update_rgblight(rgblight_config.raw); - xprintf("rgblight disable: rgblight_config.enable = %u\n", rgblight_config.enable); + xprintf("rgblight disable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); #endif @@ -285,6 +317,17 @@ void rgblight_disable(void) { rgblight_set(); } +void rgblight_disable_noeeprom(void) { + rgblight_config.enable = 0; + xprintf("rgblight disable [noEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); + #ifdef RGBLIGHT_ANIMATIONS + rgblight_timer_disable(); + #endif + _delay_ms(50); + rgblight_set(); +} + + // Deals with the messy details of incrementing an integer uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) { int16_t new_value = value; @@ -358,23 +401,22 @@ void rgblight_decrease_speed(void) { eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this } -void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { - inmem_config.raw = rgblight_config.raw; +void rgblight_sethsv_noeeprom_old(uint16_t hue, uint8_t sat, uint8_t val) { if (rgblight_config.enable) { LED_TYPE tmp_led; sethsv(hue, sat, val, &tmp_led); - inmem_config.hue = hue; - inmem_config.sat = sat; - inmem_config.val = val; // dprintf("rgblight set hue [MEMORY]: %u,%u,%u\n", inmem_config.hue, inmem_config.sat, inmem_config.val); rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b); } } -void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) { + +void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) { if (rgblight_config.enable) { if (rgblight_config.mode == 1) { // same static color - rgblight_sethsv_noeeprom(hue, sat, val); + LED_TYPE tmp_led; + sethsv(hue, sat, val, &tmp_led); + rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b); } else { // all LEDs in same color if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) { @@ -399,11 +441,23 @@ void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) { rgblight_config.hue = hue; rgblight_config.sat = sat; rgblight_config.val = val; - eeconfig_update_rgblight(rgblight_config.raw); - xprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); + if (write_to_eeprom) { + eeconfig_update_rgblight(rgblight_config.raw); + xprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); + } else { + xprintf("rgblight set hsv [NOEEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); + } } } +void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) { + rgblight_sethsv_eeprom_helper(hue, sat, val, true); +} + +void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { + rgblight_sethsv_eeprom_helper(hue, sat, val, false); +} + uint16_t rgblight_get_hue(void) { return rgblight_config.hue; } @@ -528,6 +582,9 @@ void rgblight_task(void) { } else if (rgblight_config.mode == 24) { // mode = 24, christmas mode rgblight_effect_christmas(); + } else if (rgblight_config.mode == 35) { + // mode = 35, RGB test + rgblight_effect_rgbtest(); } } } @@ -546,7 +603,7 @@ void rgblight_effect_breathing(uint8_t interval) { // http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/ val = (exp(sin((pos/255.0)*M_PI)) - RGBLIGHT_EFFECT_BREATHE_CENTER/M_E)*(RGBLIGHT_EFFECT_BREATHE_MAX/(M_E-1/M_E)); - rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, val); + rgblight_sethsv_noeeprom_old(rgblight_config.hue, rgblight_config.sat, val); pos = (pos + 1) % 256; } void rgblight_effect_rainbow_mood(uint8_t interval) { @@ -557,7 +614,7 @@ void rgblight_effect_rainbow_mood(uint8_t interval) { return; } last_timer = timer_read(); - rgblight_sethsv_noeeprom(current_hue, rgblight_config.sat, rgblight_config.val); + rgblight_sethsv_noeeprom_old(current_hue, rgblight_config.sat, rgblight_config.val); current_hue = (current_hue + 1) % 360; } void rgblight_effect_rainbow_swirl(uint8_t interval) { @@ -683,4 +740,30 @@ void rgblight_effect_christmas(void) { rgblight_set(); } -#endif +void rgblight_effect_rgbtest(void) { + static uint8_t pos = 0; + static uint16_t last_timer = 0; + static uint8_t maxval = 0; + uint8_t g; uint8_t r; uint8_t b; + + if (timer_elapsed(last_timer) < pgm_read_word(&RGBLED_RGBTEST_INTERVALS[0])) { + return; + } + + if( maxval == 0 ) { + LED_TYPE tmp_led; + sethsv(0, 255, RGBLIGHT_LIMIT_VAL, &tmp_led); + maxval = tmp_led.r; + } + last_timer = timer_read(); + g = r = b = 0; + switch( pos ) { + case 0: r = maxval; break; + case 1: g = maxval; break; + case 2: b = maxval; break; + } + rgblight_setrgb(r, g, b); + pos = (pos + 1) % 3; +} + +#endif /* RGBLIGHT_ANIMATIONS */ diff --git a/quantum/rgblight.h b/quantum/rgblight.h index a6593af98b..e9c192a4ed 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -17,7 +17,7 @@ #define RGBLIGHT_H #ifdef RGBLIGHT_ANIMATIONS - #define RGBLIGHT_MODES 34 + #define RGBLIGHT_MODES 35 #else #define RGBLIGHT_MODES 1 #endif @@ -83,6 +83,7 @@ extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM; extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM; extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM; extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM; +extern const uint16_t RGBLED_RGBTEST_INTERVALS[1] PROGMEM; typedef union { uint32_t raw; @@ -134,7 +135,16 @@ void rgb_matrix_decrease(void); void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1); + void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); +void rgblight_mode_noeeprom(uint8_t mode); +void rgblight_toggle_noeeprom(void); +void rgblight_enable_noeeprom(void); +void rgblight_disable_noeeprom(void); + +void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom); +void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom); + #define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b); @@ -151,5 +161,6 @@ void rgblight_effect_rainbow_swirl(uint8_t interval); void rgblight_effect_snake(uint8_t interval); void rgblight_effect_knight(uint8_t interval); void rgblight_effect_christmas(void); +void rgblight_effect_rgbtest(void); #endif diff --git a/quantum/rgblight_list.h b/quantum/rgblight_list.h index 29b2802263..407fd8e9d3 100644 --- a/quantum/rgblight_list.h +++ b/quantum/rgblight_list.h @@ -77,6 +77,30 @@ #define rgblight_sethsv_pink() rgblight_sethsv (330, 128, 255) /* SET HSV List */ +/* If you're doing layer indication, this is best, as it won't */ +/* write to the eeprom, since it's limited (very high value). */ +/* If you want to use modes with this (since you can), then you */ +/* want to use rgblight_mode_noeeprom(x) instead. */ +#define rgblight_sethsv_noeeprom_white() rgblight_sethsv_noeeprom ( 0, 0, 255) +#define rgblight_sethsv_noeeprom_red() rgblight_sethsv_noeeprom ( 0, 255, 255) +#define rgblight_sethsv_noeeprom_coral() rgblight_sethsv_noeeprom ( 16, 176, 255) +#define rgblight_sethsv_noeeprom_orange() rgblight_sethsv_noeeprom ( 39, 255, 255) +#define rgblight_sethsv_noeeprom_goldenrod() rgblight_sethsv_noeeprom ( 43, 218, 218) +#define rgblight_sethsv_noeeprom_gold() rgblight_sethsv_noeeprom ( 51, 255, 255) +#define rgblight_sethsv_noeeprom_yellow() rgblight_sethsv_noeeprom ( 60, 255, 255) +#define rgblight_sethsv_noeeprom_chartreuse() rgblight_sethsv_noeeprom ( 90, 255, 255) +#define rgblight_sethsv_noeeprom_green() rgblight_sethsv_noeeprom (120, 255, 255) +#define rgblight_sethsv_noeeprom_springgreen() rgblight_sethsv_noeeprom (150, 255, 255) +#define rgblight_sethsv_noeeprom_turquoise() rgblight_sethsv_noeeprom (174, 90, 112) +#define rgblight_sethsv_noeeprom_teal() rgblight_sethsv_noeeprom (180, 255, 128) +#define rgblight_sethsv_noeeprom_cyan() rgblight_sethsv_noeeprom (180, 255, 255) +#define rgblight_sethsv_noeeprom_azure() rgblight_sethsv_noeeprom (186, 102, 255) +#define rgblight_sethsv_noeeprom_blue() rgblight_sethsv_noeeprom (240, 255, 255) +#define rgblight_sethsv_noeeprom_purple() rgblight_sethsv_noeeprom (270, 255, 255) +#define rgblight_sethsv_noeeprom_magenta() rgblight_sethsv_noeeprom (300, 255, 255) +#define rgblight_sethsv_noeeprom_pink() rgblight_sethsv_noeeprom (330, 128, 255) + +/* SET HSV List */ #define rgblight_sethsv_white_at(at) rgblight_sethsv_at ( 0, 0, 255, at) #define rgblight_sethsv_red_at(at) rgblight_sethsv_at ( 0, 255, 255, at) #define rgblight_sethsv_coral_at(at) rgblight_sethsv_at ( 16, 176, 255, at) diff --git a/quantum/template/ps2avrgb/matrix.c b/quantum/template/ps2avrgb/matrix.c index 57aa36b5ff..245813dfd2 100644 --- a/quantum/template/ps2avrgb/matrix.c +++ b/quantum/template/ps2avrgb/matrix.c @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "matrix.h" #ifndef DEBOUNCE -#define DEBOUNCE 5 +# define DEBOUNCE 5 #endif static uint8_t debouncing = DEBOUNCE; @@ -29,6 +29,9 @@ static uint8_t debouncing = DEBOUNCE; static matrix_row_t matrix[MATRIX_ROWS]; static matrix_row_t matrix_debouncing[MATRIX_ROWS]; +void matrix_set_row_status(uint8_t row); +uint8_t bit_reverse(uint8_t x); + void matrix_init(void) { // all outputs for rows high DDRB = 0xFF; @@ -47,18 +50,8 @@ void matrix_init(void) { matrix[row] = 0x00; matrix_debouncing[row] = 0x00; } -} - -void matrix_set_row_status(uint8_t row) { - DDRB = (1 << row); - PORTB = ~(1 << row); -} -uint8_t bit_reverse(uint8_t x) { - x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); - x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); - x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); - return x; + matrix_init_quantum(); } uint8_t matrix_scan(void) { @@ -93,11 +86,24 @@ uint8_t matrix_scan(void) { } } - matrix_scan_user(); + matrix_scan_quantum(); return 1; } +// declarations +void matrix_set_row_status(uint8_t row) { + DDRB = (1 << row); + PORTB = ~(1 << row); +} + +uint8_t bit_reverse(uint8_t x) { + x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); + x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); + x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); + return x; +} + inline matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } |