本文整理汇总了C++中default_layer_set函数的典型用法代码示例。如果您正苦于以下问题:C++ default_layer_set函数的具体用法?C++ default_layer_set怎么用?C++ default_layer_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default_layer_set函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: matrix_init_user
void matrix_init_user(void) {
// This keymap only has a single base layer, so reset the default if needed
if(eeconfig_read_default_layer() > 1){
eeconfig_update_default_layer(1);
default_layer_set(1);
}
}
开发者ID:U47,项目名称:qmk_firmware,代码行数:7,代码来源:keymap.c
示例2: switch_default_layer
static void switch_default_layer(uint8_t layer)
{
print("switch_default_layer: "); print_dec(biton32(default_layer_state));
print(" to "); print_dec(layer); print("\n");
default_layer_set(1UL<<layer);
clear_keyboard();
}
开发者ID:Wraul,项目名称:tmk_keyboard,代码行数:7,代码来源:command.c
示例3: persistent_default_layer_set
void persistent_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
#ifdef RGBSPS_ENABLE
led_set_default_layer_indicator();
#endif
}
开发者ID:0tsuki,项目名称:qmk_firmware,代码行数:7,代码来源:keymap.c
示例4: set_single_persistent_default_layer
void set_single_persistent_default_layer(uint8_t default_layer) {
#ifdef AUDIO_ENABLE
PLAY_SONG(default_layer_songs[default_layer]);
#endif
eeconfig_update_default_layer(1U<<default_layer);
default_layer_set(1U<<default_layer);
}
开发者ID:bdprice,项目名称:qmk_firmware,代码行数:7,代码来源:quantum.c
示例5: magic
void magic(void)
{
/* check signature */
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
/* debug enable */
debug_config.raw = eeconfig_read_debug();
/* keymap config */
keymap_config.raw = eeconfig_read_keymap();
uint8_t default_layer = 0;
default_layer = eeconfig_read_default_layer();
default_layer_set((uint32_t)default_layer);
}
开发者ID:0tsuki,项目名称:qmk_firmware,代码行数:18,代码来源:magic.c
示例6: process_record_layout
// New keycode KC_LAYO rotates between available default layers (for e.g.,
// selecting a base layout). Shift+KC_LAYO makes the current one persistent.
bool process_record_layout(uint16_t keycode, keyrecord_t *record) {
uint32_t default_layer;
uint8_t i;
#if defined(AUDIO_ENABLE)
float saved_song[][2] = SONG(COIN_SOUND);
#endif
if (keycode != KC_LAYO || !record->event.pressed) {
return true;
}
if (get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))) { // shift pressed
// save default layer. whatever the current default layer is, store that
eeconfig_update_default_layer(default_layer_state);
#if defined(AUDIO_ENABLE)
PLAY_SONG(saved_song);
#endif
} else {
// rotate default layer.
// find the current default layer
default_layer = biton32(default_layer_state);
// find next valid default layer
for (i = 1; i < defaultlayers_n; i++) {
if (defaultlayers[(default_layer + i) % defaultlayers_n]) {
break;
}
}
if (i == defaultlayers_n) {
// we fell out of the loop without finding another default layer to switch
// to.
return false;
}
default_layer = (default_layer + i) % defaultlayers_n;
default_layer_set(1U<<default_layer);
led_set(host_keyboard_leds());
#if defined(AUDIO_ENABLE) && defined(DEFAULT_LAYER_SONGS)
PLAY_SONG(default_layer_songs[default_layer]);
#endif
}
return false;
}
开发者ID:am,项目名称:qmk_firmware,代码行数:43,代码来源:keymap.c
示例7: persistant_default_layer_set
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
开发者ID:0tsuki,项目名称:qmk_firmware,代码行数:4,代码来源:keymap.c
示例8: process_record_quantum
//.........这里部分代码省略.........
// interval
{ uint8_t ms = interval; while (ms--) wait_ms(1); }
}
}
void send_string_with_delay_P(const char *str, uint8_t interval) {
while (1) {
char ascii_code = pgm_read_byte(str);
if (!ascii_code) break;
if (ascii_code == 1) {
// tap
uint8_t keycode = pgm_read_byte(++str);
register_code(keycode);
unregister_code(keycode);
} else if (ascii_code == 2) {
// down
uint8_t keycode = pgm_read_byte(++str);
register_code(keycode);
} else if (ascii_code == 3) {
// up
uint8_t keycode = pgm_read_byte(++str);
unregister_code(keycode);
} else {
send_char(ascii_code);
}
++str;
// interval
{ uint8_t ms = interval; while (ms--) wait_ms(1); }
}
}
void send_char(char ascii_code) {
uint8_t keycode;
keycode = pgm_read_byte(&ascii_to_keycode_lut[(uint8_t)ascii_code]);
if (pgm_read_byte(&ascii_to_shift_lut[(uint8_t)ascii_code])) {
register_code(KC_LSFT);
register_code(keycode);
unregister_code(keycode);
unregister_code(KC_LSFT);
} else {
register_code(keycode);
unregister_code(keycode);
}
}
void set_single_persistent_default_layer(uint8_t default_layer) {
#if defined(AUDIO_ENABLE) && defined(DEFAULT_LAYER_SONGS)
PLAY_SONG(default_layer_songs[default_layer]);
#endif
eeconfig_update_default_layer(1U<<default_layer);
default_layer_set(1U<<default_layer);
}
uint32_t update_tri_layer_state(uint32_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3) {
uint32_t mask12 = (1UL << layer1) | (1UL << layer2);
uint32_t mask3 = 1UL << layer3;
return (state & mask12) == mask12 ? (state | mask3) : (state & ~mask3);
}
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
layer_state_set(update_tri_layer_state(layer_state, layer1, layer2, layer3));
}
void tap_random_base64(void) {
#if defined(__AVR_ATmega32U4__)
uint8_t key = (TCNT0 + TCNT1 + TCNT3 + TCNT4) % 64;
#else
uint8_t key = rand() % 64;
#endif
switch (key) {
case 0 ... 25:
register_code(KC_LSFT);
register_code(key + KC_A);
unregister_code(key + KC_A);
unregister_code(KC_LSFT);
break;
case 26 ... 51:
register_code(key - 26 + KC_A);
unregister_code(key - 26 + KC_A);
break;
case 52:
register_code(KC_0);
unregister_code(KC_0);
break;
case 53 ... 61:
register_code(key - 53 + KC_1);
unregister_code(key - 53 + KC_1);
break;
case 62:
register_code(KC_LSFT);
register_code(KC_EQL);
unregister_code(KC_EQL);
unregister_code(KC_LSFT);
break;
case 63:
register_code(KC_SLSH);
unregister_code(KC_SLSH);
break;
}
}
开发者ID:kipricker,项目名称:qmk_firmware,代码行数:101,代码来源:quantum.c
示例9: switch
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch(id) {
case M_ALT_HASH:
return MACRO_TAP_SHFT_KEY_HOLD_MOD(record, 3, LALT);
case M_GR_DASH:
{
const macro_t* macro = MACRO_TAP_HOLD_LAYER(record, MACRO(T(MINS)), _GR);
update_tri_layer(_NUM, _GR, _ADJ);
return macro;
}
case M_SYM_LPRN:
return MACRO_TAP_SHFT_KEY_HOLD_LAYER(record, 9, _SYM);
case M_NAV_UNDS:
return MACRO_TAP_SHFT_KEY_HOLD_LAYER(record, MINS, _NAV);
case M_NUM_RPRN:
{
const macro_t* macro = MACRO_TAP_SHFT_KEY_HOLD_LAYER(record, 0, _NUM);
update_tri_layer(_NUM, _GR, _ADJ);
return macro;
}
case M_CTRL_DLR:
return MACRO_TAP_SHFT_KEY_HOLD_MOD(record, 4, LCTL);
case M_LCBR_ENT:
return MACRODOWN(I(10), D(LSFT), T(LBRC), U(LSFT), T(ENT), END);
case M_PLOVER:
if (record->event.pressed) {
layer_and(0);
layer_on(_PLOVER);
default_layer_set(_PLOVER);
// Starts plover
return MACRO(I(10), D(E), D(R), D(F), D(V), D(I), D(K), U(E), U(R), U(F), U(V), U(I), U(K), END);
}
break;
case M_EXT_PLV:
if (!record->event.pressed) {
layer_off(_PLOVER);
default_layer_set(_COLEMAK);
//Pauses plover
return MACRO(I(10), D(E), D(R), D(F), D(V), D(Y), D(U), U(E), U(R), U(F), U(V), U(Y), U(U), END);
}
break;
case M_WINDOWS:
set_unicode_input_mode(UC_WIN);
break;
case M_LINUX:
set_unicode_input_mode(UC_LNX);
break;
case M_OSX:
set_unicode_input_mode(UC_OSX);
break;
case M_FUNCTION:
if (record->event.pressed) {
SEND_STRING("function");
}
break;
case M_THEN:
if (record->event.pressed) {
SEND_STRING("then");
}
break;
case M_CATCH:
if (record->event.pressed) {
SEND_STRING("catch");
}
break;
}
return MACRO_NONE;
};
开发者ID:0tsuki,项目名称:qmk_firmware,代码行数:71,代码来源:keymap.c
示例10: switch_default_layer
static void switch_default_layer(uint8_t layer)
{
xprintf("L%d\n", layer);
default_layer_set(1UL<<layer);
clear_keyboard();
}
开发者ID:Fahrradflucht,项目名称:qmk_firmware,代码行数:6,代码来源:command.c
示例11: action_function
void action_function(keyrecord_t *event, uint8_t id, uint8_t opt)
{
#ifdef AUDIO_ENABLE
int8_t sign = 1;
#endif
if(id == LFK_ESC_TILDE){
// Send ~ on shift-esc
void (*method)(uint8_t) = (event->event.pressed) ? &add_key : &del_key;
uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT));
if(layer_state == 0){
method(shifted ? KC_GRAVE : KC_ESCAPE);
}else{
method(shifted ? KC_ESCAPE : KC_GRAVE);
}
send_keyboard_report();
}else if(event->event.pressed){
switch(id){
case LFK_SET_DEFAULT_LAYER:
// set/save the current base layer to eeprom, falls through to LFK_CLEAR
eeconfig_update_default_layer(1UL << opt);
default_layer_set(1UL << opt);
case LFK_CLEAR:
// Go back to default layer
layer_clear();
break;
#ifdef ISSI_ENABLE
case LFK_LED_TEST:
led_test();
break;
#endif
#ifdef AUDIO_ENABLE
case LFK_CLICK_FREQ_LOWER:
sign = -1; // continue to next statement
case LFK_CLICK_FREQ_HIGHER:
click_hz += sign * 100;
click(click_hz, click_time);
break;
case LFK_CLICK_TOGGLE:
if(click_toggle){
click_toggle = 0;
click(4000, 100);
click(1000, 100);
}else{
click_toggle = 1;
click(1000, 100);
click(4000, 100);
}
break;
case LFK_CLICK_TIME_SHORTER:
sign = -1; // continue to next statement
case LFK_CLICK_TIME_LONGER:
click_time += sign;
click(click_hz, click_time);
break;
#endif
case LFK_DEBUG_SETTINGS:
dprintf("Click:\n");
dprintf(" toggle: %d\n", click_toggle);
dprintf(" freq(hz): %d\n", click_hz);
dprintf(" duration(ms): %d\n", click_time);
break;
}
}
}
开发者ID:20lives,项目名称:qmk_firmware,代码行数:64,代码来源:lfk78.c
示例12: bootmagic
void bootmagic(void)
{
/* check signature */
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
/* do scans in case of bounce */
print("bootmagic scan: ... ");
uint8_t scan = 100;
while (scan--) { matrix_scan(); wait_ms(10); }
print("done.\n");
/* bootmagic skip */
if (bootmagic_scan_key(BOOTMAGIC_KEY_SKIP)) {
return;
}
/* eeconfig clear */
if (bootmagic_scan_key(BOOTMAGIC_KEY_EEPROM_CLEAR)) {
eeconfig_init();
#ifdef KEYMAP_IN_EEPROM_ENABLE
write_keymap_to_eeprom();
#endif
#ifdef LEDMAP_IN_EEPROM_ENABLE
write_ledmap_to_eeprom();
#endif
}
/* bootloader */
if (bootmagic_scan_key(BOOTMAGIC_KEY_BOOTLOADER)) {
bootloader_jump();
}
/* user-defined checks */
hook_bootmagic();
/* debug enable */
debug_config.raw = eeconfig_read_debug();
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_ENABLE)) {
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_MATRIX)) {
debug_config.matrix = !debug_config.matrix;
} else if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_KEYBOARD)) {
debug_config.keyboard = !debug_config.keyboard;
} else if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_MOUSE)) {
debug_config.mouse = !debug_config.mouse;
} else {
debug_config.enable = !debug_config.enable;
}
}
eeconfig_write_debug(debug_config.raw);
/* keymap config */
keymap_config.raw = eeconfig_read_keymap();
if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK)) {
keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock;
}
if (bootmagic_scan_key(BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL)) {
keymap_config.capslock_to_control = !keymap_config.capslock_to_control;
}
if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_LALT_LGUI)) {
keymap_config.swap_lalt_lgui = !keymap_config.swap_lalt_lgui;
}
if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_RALT_RGUI)) {
keymap_config.swap_ralt_rgui = !keymap_config.swap_ralt_rgui;
}
if (bootmagic_scan_key(BOOTMAGIC_KEY_NO_GUI)) {
keymap_config.no_gui = !keymap_config.no_gui;
}
if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_GRAVE_ESC)) {
keymap_config.swap_grave_esc = !keymap_config.swap_grave_esc;
}
if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE)) {
keymap_config.swap_backslash_backspace = !keymap_config.swap_backslash_backspace;
}
if (bootmagic_scan_key(BOOTMAGIC_HOST_NKRO)) {
keymap_config.nkro = !keymap_config.nkro;
}
eeconfig_write_keymap(keymap_config.raw);
#ifdef NKRO_ENABLE
keyboard_nkro = keymap_config.nkro;
#endif
/* default layer */
uint8_t default_layer = 0;
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { default_layer |= (1<<0); }
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) { default_layer |= (1<<1); }
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) { default_layer |= (1<<2); }
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) { default_layer |= (1<<3); }
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) { default_layer |= (1<<4); }
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) { default_layer |= (1<<5); }
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) { default_layer |= (1<<6); }
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) { default_layer |= (1<<7); }
if (default_layer) {
eeconfig_write_default_layer(default_layer);
default_layer_set((uint32_t)default_layer);
} else {
default_layer = eeconfig_read_default_layer();
default_layer_set((uint32_t)default_layer);
//.........这里部分代码省略.........
开发者ID:jingqiuELE,项目名称:tmk_keyboard_custom,代码行数:101,代码来源:bootmagic.c
注:本文中的default_layer_set函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论