[Core] Refactor keyevent_t for 1ms timing resolution (#15847)
				
					
				
			This commit is contained in:
		
							parent
							
								
									2d9140af53
								
							
						
					
					
						commit
						fcf8b804ed
					
				
					 49 changed files with 360 additions and 273 deletions
				
			
		| 
						 | 
				
			
			@ -29,24 +29,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		|||
 | 
			
		||||
keyevent_t encoder_ccw = {
 | 
			
		||||
    .key = (keypos_t){.row = 13, .col = 0},
 | 
			
		||||
    .pressed = false
 | 
			
		||||
    .pressed = false,
 | 
			
		||||
    .type = KEY_EVENT
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
keyevent_t encoder_cw = {
 | 
			
		||||
    .key = (keypos_t){.row = 13, .col = 1},
 | 
			
		||||
    .pressed = false
 | 
			
		||||
    .pressed = false,
 | 
			
		||||
    .type = KEY_EVENT
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void matrix_scan_user(void) {
 | 
			
		||||
    if (IS_PRESSED(encoder_ccw)) {
 | 
			
		||||
        encoder_ccw.pressed = false;
 | 
			
		||||
        encoder_ccw.time = (timer_read() | 1);
 | 
			
		||||
        encoder_ccw.time = timer_read();
 | 
			
		||||
        action_exec(encoder_ccw);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (IS_PRESSED(encoder_cw)) {
 | 
			
		||||
        encoder_cw.pressed = false;
 | 
			
		||||
        encoder_cw.time = (timer_read() | 1);
 | 
			
		||||
        encoder_cw.time = timer_read();
 | 
			
		||||
        action_exec(encoder_cw);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -54,11 +56,11 @@ void matrix_scan_user(void) {
 | 
			
		|||
bool encoder_update_user(uint8_t index, bool clockwise) {
 | 
			
		||||
    if (clockwise) {
 | 
			
		||||
        encoder_cw.pressed = true;
 | 
			
		||||
        encoder_cw.time = (timer_read() | 1);
 | 
			
		||||
        encoder_cw.time = timer_read();
 | 
			
		||||
        action_exec(encoder_cw);
 | 
			
		||||
    } else {
 | 
			
		||||
        encoder_ccw.pressed = true;
 | 
			
		||||
        encoder_ccw.time = (timer_read() | 1);
 | 
			
		||||
        encoder_ccw.time = timer_read();
 | 
			
		||||
        action_exec(encoder_ccw);
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue