Merge pull request #1057 from priyadi/selectable_output
Implement runtime selectable output (USB or BT)
This commit is contained in:
		
						commit
						0c2b6951a6
					
				
					 7 changed files with 192 additions and 74 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,7 @@
 | 
			
		|||
#include "quantum.h"
 | 
			
		||||
#ifdef PROTOCOL_LUFA
 | 
			
		||||
#include "outputselect.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef TAPPING_TERM
 | 
			
		||||
#define TAPPING_TERM 200
 | 
			
		||||
| 
						 | 
				
			
			@ -243,6 +246,36 @@ bool process_record_quantum(keyrecord_t *record) {
 | 
			
		|||
	  return false;
 | 
			
		||||
      break;
 | 
			
		||||
	#endif
 | 
			
		||||
    #ifdef PROTOCOL_LUFA
 | 
			
		||||
    case OUT_AUTO:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        set_output(OUTPUT_AUTO);
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
      break;
 | 
			
		||||
    case OUT_USB:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        set_output(OUTPUT_USB);
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
      break;
 | 
			
		||||
    #ifdef BLUETOOTH_ENABLE
 | 
			
		||||
    case OUT_BT:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        set_output(OUTPUT_BLUETOOTH);
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
      break;
 | 
			
		||||
    #endif
 | 
			
		||||
    #ifdef ADAFRUIT_BLE_ENABLE
 | 
			
		||||
    case OUT_BLE:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        set_output(OUTPUT_ADAFRUIT_BLE);
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
      break;
 | 
			
		||||
    #endif
 | 
			
		||||
    #endif
 | 
			
		||||
    case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        // MAGIC actions (BOOTMAGIC without the boot)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,6 @@
 | 
			
		|||
#ifdef RGBLIGHT_ENABLE
 | 
			
		||||
  #include "rgblight.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "action_layer.h"
 | 
			
		||||
#include "eeconfig.h"
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -141,6 +141,16 @@ enum quantum_keycodes {
 | 
			
		|||
    PRINT_ON,
 | 
			
		||||
    PRINT_OFF,
 | 
			
		||||
 | 
			
		||||
    // output selection
 | 
			
		||||
    OUT_AUTO,
 | 
			
		||||
    OUT_USB,
 | 
			
		||||
#ifdef BLUETOOTH_ENABLE
 | 
			
		||||
    OUT_BT,
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef ADAFRUIT_BLE_ENABLE
 | 
			
		||||
    OUT_BLE,
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    // always leave at the end
 | 
			
		||||
    SAFE_RANGE
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue