[Keyboard] Improvements for the Torn keyboard (#11268)
* Add bongo cat animation * Map all keys on base layer ... to make it easier to test newly built keyboards. The encoders are optional and can be placed in different locations. * Fix Torn in QMK configurator This removes additional variables defined in the keymap.c file, so that the default firmware can be compiled by the configurator. Co-authored-by: Richard Titmuss <richardt@spotify.com>
This commit is contained in:
		
							parent
							
								
									73235e7ca0
								
							
						
					
					
						commit
						523c8315a2
					
				
					 7 changed files with 434 additions and 87 deletions
				
			
		| 
						 | 
				
			
			@ -31,18 +31,24 @@ static int8_t encoder_LUT[] = {0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1,
 | 
			
		|||
static uint8_t encoder_state  = 0;
 | 
			
		||||
static int8_t  encoder_pulses = 0;
 | 
			
		||||
 | 
			
		||||
extern const uint16_t PROGMEM encoder_keymaps[][2][2];
 | 
			
		||||
__attribute__((weak)) extern const uint16_t PROGMEM encoder_keymaps[][2][2];
 | 
			
		||||
 | 
			
		||||
const uint16_t encoder_default[2][2] =  { { KC_PGDN, KC_PGUP }, { KC__VOLDOWN, KC__VOLUP } };
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Tap on encoder updates using the encoder keymap
 | 
			
		||||
 */
 | 
			
		||||
void encoder_update_kb(uint8_t index, bool clockwise) {
 | 
			
		||||
    int layer = get_highest_layer(layer_state);
 | 
			
		||||
 | 
			
		||||
    uint16_t code;
 | 
			
		||||
    do {
 | 
			
		||||
        code = pgm_read_word(&encoder_keymaps[layer--][index][clockwise]);
 | 
			
		||||
    } while (code == KC_TRNS);
 | 
			
		||||
 | 
			
		||||
    if (encoder_keymaps) {
 | 
			
		||||
      int layer = get_highest_layer(layer_state);
 | 
			
		||||
      do {
 | 
			
		||||
          code = pgm_read_word(&encoder_keymaps[layer--][index][clockwise]);
 | 
			
		||||
      } while (code == KC_TRNS);
 | 
			
		||||
    } else {
 | 
			
		||||
      code = encoder_default[index][clockwise];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    tap_code16(code);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue