2020 May 30 Breaking Changes Update (#9215)
* Branch point for 2020 May 30 Breaking Change * Migrate `ACTION_LAYER_TOGGLE` to `TG()` (#8954) * Migrate `ACTION_MODS_ONESHOT` to `OSM()` (#8957) * Migrate `ACTION_DEFAULT_LAYER_SET` to `DF()` (#8958) * Migrate `ACTION_LAYER_MODS` to `LM()` (#8959) * Migrate `ACTION_MODS_TAP_KEY` to `MT()` (#8968) * Convert V-USB usbdrv to a submodule (#8321) * Unify Tap Hold functions and documentation (#8348) * Changing board names to prevent confusion (#8412) * Move the Keyboardio Model01 to a keyboardio/ subdir (#8499) * Move spaceman keyboards (#8830) * Migrate miscellaneous `fn_actions` entries (#8977) * Migrate `ACTION_MODS_KEY` to chained mod keycodes (#8979) * Organizing my keyboards (plaid, tartan, ergoinu) (#8537) * Refactor Lily58 to use split_common (#6260) * Refactor zinc to use split_common (#7114) * Add a message if bin/qmk doesn't work (#9000) * Fix conflicting types for 'tfp_printf' (#8269) * Fixed RGB_DISABLE_AFTER_TIMEOUT to be seconds based & small internals cleanup (#6480) * Refactor and updates to TKC1800 code (#8472) * Switch to qmk forks for everything (#9019) * audio refactor: replace deprecated PLAY_NOTE_ARRAY (#8484) * Audio enable corrections (2/3) (#8903) * Split HHKB to ANSI and JP layouts and Add VIA support for each (#8582) * Audio enable corrections (Part 4) (#8974) * Fix typo from PR7114 (#9171) * Augment future branch Changelogs (#8978) * Revert "Branch point for 2020 May 30 Breaking Change"
This commit is contained in:
		
							parent
							
								
									7b8a013826
								
							
						
					
					
						commit
						fced377ac0
					
				
					 460 changed files with 2624 additions and 12709 deletions
				
			
		| 
						 | 
				
			
			@ -99,9 +99,6 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat);
 | 
			
		|||
// length. This works around the limitation of C's sizeof operation on pointers.
 | 
			
		||||
// The global float array for the song must be used here.
 | 
			
		||||
#define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0]))))
 | 
			
		||||
#define PLAY_NOTE_ARRAY(note_array, note_repeat, deprecated_arg)           \
 | 
			
		||||
    play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat)); \
 | 
			
		||||
    _Pragma("message \"'PLAY_NOTE_ARRAY' macro is deprecated\"")
 | 
			
		||||
#define PLAY_SONG(note_array) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), false)
 | 
			
		||||
#define PLAY_LOOP(note_array) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), true)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -110,6 +110,11 @@
 | 
			
		|||
#    define TIMER_1_DUTY_CYCLE OCR1C
 | 
			
		||||
#    define TIMER1_AUDIO_vect TIMER1_COMPC_vect
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(BPIN_AUDIO) && !defined(CPIN_AUDIO)
 | 
			
		||||
#    error "Audio feature enabled, but no suitable pin selected - see docs/feature_audio.md under the AVR settings for available options."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// -----------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
int   voices        = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,8 +57,12 @@ const point_t k_rgb_matrix_center = RGB_MATRIX_CENTER;
 | 
			
		|||
// -----End rgb effect includes macros-------
 | 
			
		||||
// ------------------------------------------
 | 
			
		||||
 | 
			
		||||
#ifndef RGB_DISABLE_AFTER_TIMEOUT
 | 
			
		||||
#    define RGB_DISABLE_AFTER_TIMEOUT 0
 | 
			
		||||
#if defined(RGB_DISABLE_AFTER_TIMEOUT) && !defined(RGB_DISABLE_TIMEOUT)
 | 
			
		||||
#    define RGB_DISABLE_TIMEOUT (RGB_DISABLE_AFTER_TIMEOUT * 1200)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef RGB_DISABLE_TIMEOUT
 | 
			
		||||
#    define RGB_DISABLE_TIMEOUT 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef RGB_DISABLE_WHEN_USB_SUSPENDED
 | 
			
		||||
| 
						 | 
				
			
			@ -111,19 +115,29 @@ const point_t k_rgb_matrix_center = RGB_MATRIX_CENTER;
 | 
			
		|||
#    define RGB_MATRIX_STARTUP_SPD UINT8_MAX / 2
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
bool g_suspend_state = false;
 | 
			
		||||
 | 
			
		||||
rgb_config_t rgb_matrix_config;
 | 
			
		||||
 | 
			
		||||
rgb_counters_t  g_rgb_counters;
 | 
			
		||||
static uint32_t rgb_counters_buffer;
 | 
			
		||||
 | 
			
		||||
// globals
 | 
			
		||||
bool         g_suspend_state = false;
 | 
			
		||||
rgb_config_t rgb_matrix_config;  // TODO: would like to prefix this with g_ for global consistancy, do this in another pr
 | 
			
		||||
uint32_t     g_rgb_timer;
 | 
			
		||||
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
 | 
			
		||||
uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}};
 | 
			
		||||
#endif  // RGB_MATRIX_FRAMEBUFFER_EFFECTS
 | 
			
		||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
 | 
			
		||||
last_hit_t g_last_hit_tracker;
 | 
			
		||||
#endif  // RGB_MATRIX_KEYREACTIVE_ENABLED
 | 
			
		||||
 | 
			
		||||
// internals
 | 
			
		||||
static uint8_t         rgb_last_enable   = UINT8_MAX;
 | 
			
		||||
static uint8_t         rgb_last_effect   = UINT8_MAX;
 | 
			
		||||
static effect_params_t rgb_effect_params = {0, 0xFF};
 | 
			
		||||
static rgb_task_states rgb_task_state    = SYNCING;
 | 
			
		||||
#if RGB_DISABLE_TIMEOUT > 0
 | 
			
		||||
static uint32_t rgb_anykey_timer;
 | 
			
		||||
#endif  // RGB_DISABLE_TIMEOUT > 0
 | 
			
		||||
 | 
			
		||||
// double buffers
 | 
			
		||||
static uint32_t rgb_timer_buffer;
 | 
			
		||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
 | 
			
		||||
last_hit_t        g_last_hit_tracker;
 | 
			
		||||
static last_hit_t last_hit_buffer;
 | 
			
		||||
#endif  // RGB_MATRIX_KEYREACTIVE_ENABLED
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -169,21 +183,24 @@ void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
 | 
			
		|||
void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { rgb_matrix_driver.set_color_all(red, green, blue); }
 | 
			
		||||
 | 
			
		||||
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
#if RGB_DISABLE_TIMEOUT > 0
 | 
			
		||||
    if (record->event.pressed) {
 | 
			
		||||
        rgb_anykey_timer = 0;
 | 
			
		||||
    }
 | 
			
		||||
#endif  // RGB_DISABLE_TIMEOUT > 0
 | 
			
		||||
 | 
			
		||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
 | 
			
		||||
    uint8_t led[LED_HITS_TO_REMEMBER];
 | 
			
		||||
    uint8_t led_count = 0;
 | 
			
		||||
 | 
			
		||||
#    if defined(RGB_MATRIX_KEYRELEASES)
 | 
			
		||||
    if (!record->event.pressed) {
 | 
			
		||||
        led_count                  = rgb_matrix_map_row_column_to_led(record->event.key.row, record->event.key.col, led);
 | 
			
		||||
        g_rgb_counters.any_key_hit = 0;
 | 
			
		||||
    }
 | 
			
		||||
    if (!record->event.pressed)
 | 
			
		||||
#    elif defined(RGB_MATRIX_KEYPRESSES)
 | 
			
		||||
    if (record->event.pressed) {
 | 
			
		||||
        led_count                  = rgb_matrix_map_row_column_to_led(record->event.key.row, record->event.key.col, led);
 | 
			
		||||
        g_rgb_counters.any_key_hit = 0;
 | 
			
		||||
    }
 | 
			
		||||
    if (record->event.pressed)
 | 
			
		||||
#    endif  // defined(RGB_MATRIX_KEYRELEASES)
 | 
			
		||||
    {
 | 
			
		||||
        led_count = rgb_matrix_map_row_column_to_led(record->event.key.row, record->event.key.col, led);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) {
 | 
			
		||||
        memcpy(&last_hit_buffer.x[0], &last_hit_buffer.x[led_count], LED_HITS_TO_REMEMBER - led_count);
 | 
			
		||||
| 
						 | 
				
			
			@ -216,7 +233,7 @@ void rgb_matrix_test(void) {
 | 
			
		|||
    // Mask out bits 4 and 5
 | 
			
		||||
    // Increase the factor to make the test animation slower (and reduce to make it faster)
 | 
			
		||||
    uint8_t factor = 10;
 | 
			
		||||
    switch ((g_rgb_counters.tick & (0b11 << factor)) >> factor) {
 | 
			
		||||
    switch ((g_rgb_timer & (0b11 << factor)) >> factor) {
 | 
			
		||||
        case 0: {
 | 
			
		||||
            rgb_matrix_set_color_all(20, 0, 0);
 | 
			
		||||
            break;
 | 
			
		||||
| 
						 | 
				
			
			@ -241,29 +258,26 @@ static bool rgb_matrix_none(effect_params_t *params) {
 | 
			
		|||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    RGB_MATRIX_USE_LIMITS(led_min, led_max);
 | 
			
		||||
    for (uint8_t i = led_min; i < led_max; i++) {
 | 
			
		||||
        rgb_matrix_set_color(i, 0, 0, 0);
 | 
			
		||||
    }
 | 
			
		||||
    return led_max < DRIVER_LED_TOTAL;
 | 
			
		||||
    rgb_matrix_set_color_all(0, 0, 0);
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static uint8_t         rgb_last_enable   = UINT8_MAX;
 | 
			
		||||
static uint8_t         rgb_last_effect   = UINT8_MAX;
 | 
			
		||||
static effect_params_t rgb_effect_params = {0, 0xFF};
 | 
			
		||||
static rgb_task_states rgb_task_state    = SYNCING;
 | 
			
		||||
 | 
			
		||||
static void rgb_task_timers(void) {
 | 
			
		||||
#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
 | 
			
		||||
    uint32_t deltaTime = timer_elapsed32(rgb_timer_buffer);
 | 
			
		||||
#endif  // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
 | 
			
		||||
    rgb_timer_buffer = timer_read32();
 | 
			
		||||
 | 
			
		||||
    // Update double buffer timers
 | 
			
		||||
    uint16_t deltaTime  = timer_elapsed32(rgb_counters_buffer);
 | 
			
		||||
    rgb_counters_buffer = timer_read32();
 | 
			
		||||
    if (g_rgb_counters.any_key_hit < UINT32_MAX) {
 | 
			
		||||
        if (UINT32_MAX - deltaTime < g_rgb_counters.any_key_hit) {
 | 
			
		||||
            g_rgb_counters.any_key_hit = UINT32_MAX;
 | 
			
		||||
#if RGB_DISABLE_TIMEOUT > 0
 | 
			
		||||
    if (rgb_anykey_timer < UINT32_MAX) {
 | 
			
		||||
        if (UINT32_MAX - deltaTime < rgb_anykey_timer) {
 | 
			
		||||
            rgb_anykey_timer = UINT32_MAX;
 | 
			
		||||
        } else {
 | 
			
		||||
            g_rgb_counters.any_key_hit += deltaTime;
 | 
			
		||||
            rgb_anykey_timer += deltaTime;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
#endif  // RGB_DISABLE_TIMEOUT > 0
 | 
			
		||||
 | 
			
		||||
    // Update double buffer last hit timers
 | 
			
		||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
 | 
			
		||||
| 
						 | 
				
			
			@ -280,7 +294,7 @@ static void rgb_task_timers(void) {
 | 
			
		|||
 | 
			
		||||
static void rgb_task_sync(void) {
 | 
			
		||||
    // next task
 | 
			
		||||
    if (timer_elapsed32(g_rgb_counters.tick) >= RGB_MATRIX_LED_FLUSH_LIMIT) rgb_task_state = STARTING;
 | 
			
		||||
    if (timer_elapsed32(g_rgb_timer) >= RGB_MATRIX_LED_FLUSH_LIMIT) rgb_task_state = STARTING;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void rgb_task_start(void) {
 | 
			
		||||
| 
						 | 
				
			
			@ -288,7 +302,7 @@ static void rgb_task_start(void) {
 | 
			
		|||
    rgb_effect_params.iter = 0;
 | 
			
		||||
 | 
			
		||||
    // update double buffers
 | 
			
		||||
    g_rgb_counters.tick = rgb_counters_buffer;
 | 
			
		||||
    g_rgb_timer = rgb_timer_buffer;
 | 
			
		||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
 | 
			
		||||
    g_last_hit_tracker = last_hit_buffer;
 | 
			
		||||
#endif  // RGB_MATRIX_KEYREACTIVE_ENABLED
 | 
			
		||||
| 
						 | 
				
			
			@ -370,8 +384,16 @@ void rgb_matrix_task(void) {
 | 
			
		|||
 | 
			
		||||
    // Ideally we would also stop sending zeros to the LED driver PWM buffers
 | 
			
		||||
    // while suspended and just do a software shutdown. This is a cheap hack for now.
 | 
			
		||||
    bool    suspend_backlight = ((g_suspend_state && RGB_DISABLE_WHEN_USB_SUSPENDED) || (RGB_DISABLE_AFTER_TIMEOUT > 0 && g_rgb_counters.any_key_hit > RGB_DISABLE_AFTER_TIMEOUT * 60 * 20));
 | 
			
		||||
    uint8_t effect            = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode;
 | 
			
		||||
    bool suspend_backlight =
 | 
			
		||||
#if RGB_DISABLE_WHEN_USB_SUSPENDED == true
 | 
			
		||||
        g_suspend_state ||
 | 
			
		||||
#endif  // RGB_DISABLE_WHEN_USB_SUSPENDED == true
 | 
			
		||||
#if RGB_DISABLE_TIMEOUT > 0
 | 
			
		||||
        (rgb_anykey_timer > (uint32_t)RGB_DISABLE_TIMEOUT) ||
 | 
			
		||||
#endif  // RGB_DISABLE_TIMEOUT > 0
 | 
			
		||||
        false;
 | 
			
		||||
 | 
			
		||||
    uint8_t effect = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode;
 | 
			
		||||
 | 
			
		||||
    switch (rgb_task_state) {
 | 
			
		||||
        case STARTING:
 | 
			
		||||
| 
						 | 
				
			
			@ -405,8 +427,6 @@ __attribute__((weak)) void rgb_matrix_indicators_user(void) {}
 | 
			
		|||
void rgb_matrix_init(void) {
 | 
			
		||||
    rgb_matrix_driver.init();
 | 
			
		||||
 | 
			
		||||
    // TODO: put the 1 second startup delay here?
 | 
			
		||||
 | 
			
		||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
 | 
			
		||||
    g_last_hit_tracker.count = 0;
 | 
			
		||||
    for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -178,14 +178,14 @@ extern const rgb_matrix_driver_t rgb_matrix_driver;
 | 
			
		|||
 | 
			
		||||
extern rgb_config_t rgb_matrix_config;
 | 
			
		||||
 | 
			
		||||
extern bool           g_suspend_state;
 | 
			
		||||
extern rgb_counters_t g_rgb_counters;
 | 
			
		||||
extern led_config_t   g_led_config;
 | 
			
		||||
extern bool         g_suspend_state;
 | 
			
		||||
extern uint32_t     g_rgb_timer;
 | 
			
		||||
extern led_config_t g_led_config;
 | 
			
		||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
 | 
			
		||||
extern last_hit_t g_last_hit_tracker;
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
 | 
			
		||||
extern uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS];
 | 
			
		||||
extern uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS];
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ bool BREATHING(effect_params_t* params) {
 | 
			
		|||
    RGB_MATRIX_USE_LIMITS(led_min, led_max);
 | 
			
		||||
 | 
			
		||||
    HSV      hsv  = rgb_matrix_config.hsv;
 | 
			
		||||
    uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 8);
 | 
			
		||||
    uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8);
 | 
			
		||||
    hsv.v         = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
 | 
			
		||||
    RGB rgb       = hsv_to_rgb(hsv);
 | 
			
		||||
    for (uint8_t i = led_min; i < led_max; i++) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,7 @@ bool DIGITAL_RAIN(effect_params_t* params) {
 | 
			
		|||
 | 
			
		||||
    if (params->init) {
 | 
			
		||||
        rgb_matrix_set_color_all(0, 0, 0);
 | 
			
		||||
        memset(rgb_frame_buffer, 0, sizeof(rgb_frame_buffer));
 | 
			
		||||
        memset(g_rgb_frame_buffer, 0, sizeof(g_rgb_frame_buffer));
 | 
			
		||||
        drop = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -27,10 +27,10 @@ bool DIGITAL_RAIN(effect_params_t* params) {
 | 
			
		|||
            if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) {
 | 
			
		||||
                // top row, pixels have just fallen and we're
 | 
			
		||||
                // making a new rain drop in this column
 | 
			
		||||
                rgb_frame_buffer[row][col] = max_intensity;
 | 
			
		||||
            } else if (rgb_frame_buffer[row][col] > 0 && rgb_frame_buffer[row][col] < max_intensity) {
 | 
			
		||||
                g_rgb_frame_buffer[row][col] = max_intensity;
 | 
			
		||||
            } else if (g_rgb_frame_buffer[row][col] > 0 && g_rgb_frame_buffer[row][col] < max_intensity) {
 | 
			
		||||
                // neither fully bright nor dark, decay it
 | 
			
		||||
                rgb_frame_buffer[row][col]--;
 | 
			
		||||
                g_rgb_frame_buffer[row][col]--;
 | 
			
		||||
            }
 | 
			
		||||
            // set the pixel colour
 | 
			
		||||
            uint8_t led[LED_HITS_TO_REMEMBER];
 | 
			
		||||
| 
						 | 
				
			
			@ -38,11 +38,11 @@ bool DIGITAL_RAIN(effect_params_t* params) {
 | 
			
		|||
 | 
			
		||||
            // TODO: multiple leds are supported mapped to the same row/column
 | 
			
		||||
            if (led_count > 0) {
 | 
			
		||||
                if (rgb_frame_buffer[row][col] > pure_green_intensity) {
 | 
			
		||||
                    const uint8_t boost = (uint8_t)((uint16_t)max_brightness_boost * (rgb_frame_buffer[row][col] - pure_green_intensity) / (max_intensity - pure_green_intensity));
 | 
			
		||||
                if (g_rgb_frame_buffer[row][col] > pure_green_intensity) {
 | 
			
		||||
                    const uint8_t boost = (uint8_t)((uint16_t)max_brightness_boost * (g_rgb_frame_buffer[row][col] - pure_green_intensity) / (max_intensity - pure_green_intensity));
 | 
			
		||||
                    rgb_matrix_set_color(led[0], boost, max_intensity, boost);
 | 
			
		||||
                } else {
 | 
			
		||||
                    const uint8_t green = (uint8_t)((uint16_t)max_intensity * rgb_frame_buffer[row][col] / pure_green_intensity);
 | 
			
		||||
                    const uint8_t green = (uint8_t)((uint16_t)max_intensity * g_rgb_frame_buffer[row][col] / pure_green_intensity);
 | 
			
		||||
                    rgb_matrix_set_color(led[0], 0, green, 0);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -55,15 +55,15 @@ bool DIGITAL_RAIN(effect_params_t* params) {
 | 
			
		|||
        for (uint8_t row = MATRIX_ROWS - 1; row > 0; row--) {
 | 
			
		||||
            for (uint8_t col = 0; col < MATRIX_COLS; col++) {
 | 
			
		||||
                // if ths is on the bottom row and bright allow decay
 | 
			
		||||
                if (row == MATRIX_ROWS - 1 && rgb_frame_buffer[row][col] == max_intensity) {
 | 
			
		||||
                    rgb_frame_buffer[row][col]--;
 | 
			
		||||
                if (row == MATRIX_ROWS - 1 && g_rgb_frame_buffer[row][col] == max_intensity) {
 | 
			
		||||
                    g_rgb_frame_buffer[row][col]--;
 | 
			
		||||
                }
 | 
			
		||||
                // check if the pixel above is bright
 | 
			
		||||
                if (rgb_frame_buffer[row - 1][col] == max_intensity) {
 | 
			
		||||
                if (g_rgb_frame_buffer[row - 1][col] == max_intensity) {
 | 
			
		||||
                    // allow old bright pixel to decay
 | 
			
		||||
                    rgb_frame_buffer[row - 1][col]--;
 | 
			
		||||
                    g_rgb_frame_buffer[row - 1][col]--;
 | 
			
		||||
                    // make this pixel bright
 | 
			
		||||
                    rgb_frame_buffer[row][col] = max_intensity;
 | 
			
		||||
                    g_rgb_frame_buffer[row][col] = max_intensity;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@ static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
 | 
			
		|||
bool JELLYBEAN_RAINDROPS(effect_params_t* params) {
 | 
			
		||||
    if (!params->init) {
 | 
			
		||||
        // Change one LED every tick, make sure speed is not 0
 | 
			
		||||
        if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
 | 
			
		||||
        if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
 | 
			
		||||
            jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@ static void raindrops_set_color(int i, effect_params_t* params) {
 | 
			
		|||
bool RAINDROPS(effect_params_t* params) {
 | 
			
		||||
    if (!params->init) {
 | 
			
		||||
        // Change one LED every tick, make sure speed is not 0
 | 
			
		||||
        if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
 | 
			
		||||
        if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
 | 
			
		||||
            raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,20 +10,20 @@ void process_rgb_matrix_typing_heatmap(keyrecord_t* record) {
 | 
			
		|||
    uint8_t m_col = col - 1;
 | 
			
		||||
    uint8_t p_col = col + 1;
 | 
			
		||||
 | 
			
		||||
    if (m_col < col) rgb_frame_buffer[row][m_col] = qadd8(rgb_frame_buffer[row][m_col], 16);
 | 
			
		||||
    rgb_frame_buffer[row][col] = qadd8(rgb_frame_buffer[row][col], 32);
 | 
			
		||||
    if (p_col < MATRIX_COLS) rgb_frame_buffer[row][p_col] = qadd8(rgb_frame_buffer[row][p_col], 16);
 | 
			
		||||
    if (m_col < col) g_rgb_frame_buffer[row][m_col] = qadd8(g_rgb_frame_buffer[row][m_col], 16);
 | 
			
		||||
    g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], 32);
 | 
			
		||||
    if (p_col < MATRIX_COLS) g_rgb_frame_buffer[row][p_col] = qadd8(g_rgb_frame_buffer[row][p_col], 16);
 | 
			
		||||
 | 
			
		||||
    if (p_row < MATRIX_ROWS) {
 | 
			
		||||
        if (m_col < col) rgb_frame_buffer[p_row][m_col] = qadd8(rgb_frame_buffer[p_row][m_col], 13);
 | 
			
		||||
        rgb_frame_buffer[p_row][col] = qadd8(rgb_frame_buffer[p_row][col], 16);
 | 
			
		||||
        if (p_col < MATRIX_COLS) rgb_frame_buffer[p_row][p_col] = qadd8(rgb_frame_buffer[p_row][p_col], 13);
 | 
			
		||||
        if (m_col < col) g_rgb_frame_buffer[p_row][m_col] = qadd8(g_rgb_frame_buffer[p_row][m_col], 13);
 | 
			
		||||
        g_rgb_frame_buffer[p_row][col] = qadd8(g_rgb_frame_buffer[p_row][col], 16);
 | 
			
		||||
        if (p_col < MATRIX_COLS) g_rgb_frame_buffer[p_row][p_col] = qadd8(g_rgb_frame_buffer[p_row][p_col], 13);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_row < row) {
 | 
			
		||||
        if (m_col < col) rgb_frame_buffer[m_row][m_col] = qadd8(rgb_frame_buffer[m_row][m_col], 13);
 | 
			
		||||
        rgb_frame_buffer[m_row][col] = qadd8(rgb_frame_buffer[m_row][col], 16);
 | 
			
		||||
        if (p_col < MATRIX_COLS) rgb_frame_buffer[m_row][p_col] = qadd8(rgb_frame_buffer[m_row][p_col], 13);
 | 
			
		||||
        if (m_col < col) g_rgb_frame_buffer[m_row][m_col] = qadd8(g_rgb_frame_buffer[m_row][m_col], 13);
 | 
			
		||||
        g_rgb_frame_buffer[m_row][col] = qadd8(g_rgb_frame_buffer[m_row][col], 16);
 | 
			
		||||
        if (p_col < MATRIX_COLS) g_rgb_frame_buffer[m_row][p_col] = qadd8(g_rgb_frame_buffer[m_row][p_col], 13);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -31,18 +31,18 @@ bool TYPING_HEATMAP(effect_params_t* params) {
 | 
			
		|||
    // Modified version of RGB_MATRIX_USE_LIMITS to work off of matrix row / col size
 | 
			
		||||
    uint8_t led_min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter;
 | 
			
		||||
    uint8_t led_max = led_min + RGB_MATRIX_LED_PROCESS_LIMIT;
 | 
			
		||||
    if (led_max > sizeof(rgb_frame_buffer)) led_max = sizeof(rgb_frame_buffer);
 | 
			
		||||
    if (led_max > sizeof(g_rgb_frame_buffer)) led_max = sizeof(g_rgb_frame_buffer);
 | 
			
		||||
 | 
			
		||||
    if (params->init) {
 | 
			
		||||
        rgb_matrix_set_color_all(0, 0, 0);
 | 
			
		||||
        memset(rgb_frame_buffer, 0, sizeof rgb_frame_buffer);
 | 
			
		||||
        memset(g_rgb_frame_buffer, 0, sizeof g_rgb_frame_buffer);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Render heatmap & decrease
 | 
			
		||||
    for (int i = led_min; i < led_max; i++) {
 | 
			
		||||
        uint8_t row = i % MATRIX_ROWS;
 | 
			
		||||
        uint8_t col = i / MATRIX_ROWS;
 | 
			
		||||
        uint8_t val = rgb_frame_buffer[row][col];
 | 
			
		||||
        uint8_t val = g_rgb_frame_buffer[row][col];
 | 
			
		||||
 | 
			
		||||
        // set the pixel colour
 | 
			
		||||
        uint8_t led[LED_HITS_TO_REMEMBER];
 | 
			
		||||
| 
						 | 
				
			
			@ -55,10 +55,10 @@ bool TYPING_HEATMAP(effect_params_t* params) {
 | 
			
		|||
            rgb_matrix_set_color(led[j], rgb.r, rgb.g, rgb.b);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        rgb_frame_buffer[row][col] = qsub8(val, 1);
 | 
			
		||||
        g_rgb_frame_buffer[row][col] = qsub8(val, 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return led_max < sizeof(rgb_frame_buffer);
 | 
			
		||||
    return led_max < sizeof(g_rgb_frame_buffer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#    endif  // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ typedef HSV (*dx_dy_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t time);
 | 
			
		|||
bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) {
 | 
			
		||||
    RGB_MATRIX_USE_LIMITS(led_min, led_max);
 | 
			
		||||
 | 
			
		||||
    uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2);
 | 
			
		||||
    uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2);
 | 
			
		||||
    for (uint8_t i = led_min; i < led_max; i++) {
 | 
			
		||||
        RGB_MATRIX_TEST_LED_FLAGS();
 | 
			
		||||
        int16_t dx  = g_led_config.point[i].x - k_rgb_matrix_center.x;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ typedef HSV (*dx_dy_dist_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8
 | 
			
		|||
bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) {
 | 
			
		||||
    RGB_MATRIX_USE_LIMITS(led_min, led_max);
 | 
			
		||||
 | 
			
		||||
    uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2);
 | 
			
		||||
    uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2);
 | 
			
		||||
    for (uint8_t i = led_min; i < led_max; i++) {
 | 
			
		||||
        RGB_MATRIX_TEST_LED_FLAGS();
 | 
			
		||||
        int16_t dx   = g_led_config.point[i].x - k_rgb_matrix_center.x;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ typedef HSV (*i_f)(HSV hsv, uint8_t i, uint8_t time);
 | 
			
		|||
bool effect_runner_i(effect_params_t* params, i_f effect_func) {
 | 
			
		||||
    RGB_MATRIX_USE_LIMITS(led_min, led_max);
 | 
			
		||||
 | 
			
		||||
    uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
 | 
			
		||||
    uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4);
 | 
			
		||||
    for (uint8_t i = led_min; i < led_max; i++) {
 | 
			
		||||
        RGB_MATRIX_TEST_LED_FLAGS();
 | 
			
		||||
        RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ typedef HSV (*sin_cos_i_f)(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t t
 | 
			
		|||
bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) {
 | 
			
		||||
    RGB_MATRIX_USE_LIMITS(led_min, led_max);
 | 
			
		||||
 | 
			
		||||
    uint16_t time      = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
 | 
			
		||||
    uint16_t time      = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4);
 | 
			
		||||
    int8_t   cos_value = cos8(time) - 128;
 | 
			
		||||
    int8_t   sin_value = sin8(time) - 128;
 | 
			
		||||
    for (uint8_t i = led_min; i < led_max; i++) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,13 +43,6 @@ typedef struct PACKED {
 | 
			
		|||
    bool        init;
 | 
			
		||||
} effect_params_t;
 | 
			
		||||
 | 
			
		||||
typedef struct PACKED {
 | 
			
		||||
    // Global tick at 20 Hz
 | 
			
		||||
    uint32_t tick;
 | 
			
		||||
    // Ticks since this key was last hit.
 | 
			
		||||
    uint32_t any_key_hit;
 | 
			
		||||
} rgb_counters_t;
 | 
			
		||||
 | 
			
		||||
typedef struct PACKED {
 | 
			
		||||
    uint8_t x;
 | 
			
		||||
    uint8_t y;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue