Convert Dip Switch callbacks to boolean functions (#13399)
This commit is contained in:
@@ -23,8 +23,9 @@ or
|
|||||||
The callback functions can be inserted into your `<keyboard>.c`:
|
The callback functions can be inserted into your `<keyboard>.c`:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void dip_switch_update_kb(uint8_t index, bool active) {
|
bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||||
dip_switch_update_user(index, active);
|
if !(dip_switch_update_user(index, active)) { return false; }
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ void dip_switch_update_kb(uint8_t index, bool active) {
|
|||||||
or `keymap.c`:
|
or `keymap.c`:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if(active) { audio_on(); } else { audio_off(); }
|
if(active) { audio_on(); } else { audio_off(); }
|
||||||
@@ -57,6 +58,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -64,8 +66,9 @@ Additionally, we support bit mask functions which allow for more complex handlin
|
|||||||
|
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void dip_switch_update_mask_kb(uint32_t state) {
|
bool dip_switch_update_mask_kb(uint32_t state) {
|
||||||
dip_switch_update_mask_user(state);
|
if (!dip_switch_update_mask_user(state)) { return false; }
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -73,7 +76,7 @@ void dip_switch_update_mask_kb(uint32_t state) {
|
|||||||
or `keymap.c`:
|
or `keymap.c`:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void dip_switch_update_mask_user(uint32_t state) {
|
bool dip_switch_update_mask_user(uint32_t state) {
|
||||||
if (state & (1UL<<0) && state & (1UL<<1)) {
|
if (state & (1UL<<0) && state & (1UL<<1)) {
|
||||||
layer_on(_ADJUST); // C on esc
|
layer_on(_ADJUST); // C on esc
|
||||||
} else {
|
} else {
|
||||||
@@ -89,6 +92,7 @@ void dip_switch_update_mask_user(uint32_t state) {
|
|||||||
} else {
|
} else {
|
||||||
layer_off(_TEST_B);
|
layer_off(_TEST_B);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -28,8 +28,9 @@ DIP スイッチは、以下を `rules.mk` に追加することでサポート
|
|||||||
コールバック関数を `<keyboard>.c` に記述することができます:
|
コールバック関数を `<keyboard>.c` に記述することができます:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void dip_switch_update_kb(uint8_t index, bool active) {
|
bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||||
dip_switch_update_user(index, active);
|
if !(dip_switch_update_user(index, active)) { return false; }
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ void dip_switch_update_kb(uint8_t index, bool active) {
|
|||||||
あるいは `keymap.c` に記述することもできます:
|
あるいは `keymap.c` に記述することもできます:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if(active) { audio_on(); } else { audio_off(); }
|
if(active) { audio_on(); } else { audio_off(); }
|
||||||
@@ -62,6 +63,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -69,8 +71,9 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
|
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void dip_switch_update_mask_kb(uint32_t state) {
|
bool dip_switch_update_mask_kb(uint32_t state) {
|
||||||
dip_switch_update_mask_user(state);
|
if (!dip_switch_update_mask_user(state)) { return false; }
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -78,7 +81,7 @@ void dip_switch_update_mask_kb(uint32_t state) {
|
|||||||
あるいは `keymap.c` に記述することもできます:
|
あるいは `keymap.c` に記述することもできます:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void dip_switch_update_mask_user(uint32_t state) {
|
bool dip_switch_update_mask_user(uint32_t state) {
|
||||||
if (state & (1UL<<0) && state & (1UL<<1)) {
|
if (state & (1UL<<0) && state & (1UL<<1)) {
|
||||||
layer_on(_ADJUST); // C on esc
|
layer_on(_ADJUST); // C on esc
|
||||||
} else {
|
} else {
|
||||||
@@ -94,6 +97,7 @@ void dip_switch_update_mask_user(uint32_t state) {
|
|||||||
} else {
|
} else {
|
||||||
layer_off(_TEST_B);
|
layer_off(_TEST_B);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -108,7 +108,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if(active) {
|
if(active) {
|
||||||
@@ -125,6 +125,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -43,4 +43,5 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
@@ -30,7 +30,7 @@ void set_mac_mode(bool macmode) {
|
|||||||
eeconfig_update_keymap(keymap_config.raw);
|
eeconfig_update_keymap(keymap_config.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_kb(uint8_t index, bool active) {
|
bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if(active) { // Left no.1 Helix rev3 common
|
if(active) { // Left no.1 Helix rev3 common
|
||||||
@@ -43,4 +43,5 @@ void dip_switch_update_kb(uint8_t index, bool active) {
|
|||||||
dip_switch_update_user(index, active);
|
dip_switch_update_user(index, active);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ void set_mac_mode(bool macmode) {
|
|||||||
eeconfig_update_keymap(keymap_config.raw);
|
eeconfig_update_keymap(keymap_config.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_kb(uint8_t index, bool active) {
|
bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if(active) { // Left no.1 Helix rev3 common
|
if(active) { // Left no.1 Helix rev3 common
|
||||||
@@ -43,4 +43,5 @@ void dip_switch_update_kb(uint8_t index, bool active) {
|
|||||||
dip_switch_update_user(index, active);
|
dip_switch_update_user(index, active);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Encoder click function
|
// Encoder click function
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
/* First encoder */
|
/* First encoder */
|
||||||
case 0:
|
case 0:
|
||||||
@@ -39,4 +39,5 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Encoder click function
|
// Encoder click function
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
/* First encoder */
|
/* First encoder */
|
||||||
case 0:
|
case 0:
|
||||||
@@ -54,4 +54,5 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -254,7 +254,7 @@ bool encoder_update(bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -283,6 +283,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -177,7 +177,7 @@ bool encoder_update(bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -206,6 +206,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -296,7 +296,7 @@ bool encoder_update(bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -325,6 +325,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -289,7 +289,7 @@ bool encoder_update(bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -318,6 +318,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -170,7 +170,7 @@ bool encoder_update(bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -199,6 +199,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -312,7 +312,7 @@ bool encoder_update(bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -341,6 +341,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -122,7 +122,7 @@ bool encoder_update(bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -151,6 +151,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -291,7 +291,7 @@ void encoder_update(bool clockwise) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -320,6 +320,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyboard_post_init_keymap(void) {
|
void keyboard_post_init_keymap(void) {
|
||||||
|
@@ -299,7 +299,7 @@ bool encoder_update_user(uint16_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -328,6 +328,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -190,7 +190,7 @@ uint16_t muse_counter = 0;
|
|||||||
uint8_t muse_offset = 70;
|
uint8_t muse_offset = 70;
|
||||||
uint16_t muse_tempo = 50;
|
uint16_t muse_tempo = 50;
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 1:
|
case 1:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -199,6 +199,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -187,7 +187,7 @@ bool encoder_update(bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -216,6 +216,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -61,10 +61,10 @@ void matrix_scan_kb(void) {
|
|||||||
|
|
||||||
#ifdef DIP_SWITCH_ENABLE
|
#ifdef DIP_SWITCH_ENABLE
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
void dip_update(uint8_t index, bool active) {}
|
bool dip_update(uint8_t index, bool active) { return true; }
|
||||||
|
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
dip_update(index, active);
|
return dip_update(index, active);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -213,7 +213,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -237,4 +237,5 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
SEND_STRING("This is a Planck THK");
|
SEND_STRING("This is a Planck THK");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -276,7 +276,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -292,6 +292,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -263,7 +263,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -279,6 +279,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -190,7 +190,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -206,6 +206,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -257,7 +257,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -273,6 +273,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -264,7 +264,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -280,6 +280,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -327,7 +327,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -343,6 +343,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -554,7 +554,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -570,6 +570,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -273,7 +273,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -289,6 +289,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -459,7 +459,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -475,6 +475,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -395,7 +395,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -411,4 +411,5 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -257,7 +257,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -273,6 +273,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -345,7 +345,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -361,6 +361,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -147,7 +147,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (active) {
|
if (active) {
|
||||||
@@ -163,6 +163,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -53,11 +53,11 @@ void matrix_scan_kb(void) {
|
|||||||
|
|
||||||
#ifdef DIP_SWITCH_ENABLE
|
#ifdef DIP_SWITCH_ENABLE
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
void dip_update(uint8_t index, bool active) {}
|
bool dip_update(uint8_t index, bool active) { return true;}
|
||||||
|
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
dip_update(index, active);
|
return dip_update(index, active);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -154,7 +154,7 @@ bool encoder_update_keymap(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -183,6 +183,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_keymap(void) {
|
void matrix_scan_keymap(void) {
|
||||||
|
@@ -290,7 +290,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -319,6 +319,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
@@ -149,7 +149,7 @@ bool encoder_update_keymap(uint8_t index, bool clockwise) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: {
|
case 0: {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
@@ -178,6 +178,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
|||||||
muse_mode = false;
|
muse_mode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -49,13 +49,13 @@ static uint16_t scan_count;
|
|||||||
static bool dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0};
|
static bool dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0};
|
||||||
static bool last_dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0};
|
static bool last_dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0};
|
||||||
|
|
||||||
__attribute__((weak)) void dip_switch_update_user(uint8_t index, bool active) {}
|
__attribute__((weak)) bool dip_switch_update_user(uint8_t index, bool active) { return true; }
|
||||||
|
|
||||||
__attribute__((weak)) void dip_switch_update_kb(uint8_t index, bool active) { dip_switch_update_user(index, active); }
|
__attribute__((weak)) bool dip_switch_update_kb(uint8_t index, bool active) { return dip_switch_update_user(index, active); }
|
||||||
|
|
||||||
__attribute__((weak)) void dip_switch_update_mask_user(uint32_t state) {}
|
__attribute__((weak)) bool dip_switch_update_mask_user(uint32_t state) { return true; }
|
||||||
|
|
||||||
__attribute__((weak)) void dip_switch_update_mask_kb(uint32_t state) { dip_switch_update_mask_user(state); }
|
__attribute__((weak)) bool dip_switch_update_mask_kb(uint32_t state) { return dip_switch_update_mask_user(state); }
|
||||||
|
|
||||||
void dip_switch_init(void) {
|
void dip_switch_init(void) {
|
||||||
#ifdef DIP_SWITCH_PINS
|
#ifdef DIP_SWITCH_PINS
|
||||||
|
@@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
void dip_switch_update_kb(uint8_t index, bool active);
|
bool dip_switch_update_kb(uint8_t index, bool active);
|
||||||
void dip_switch_update_user(uint8_t index, bool active);
|
bool dip_switch_update_user(uint8_t index, bool active);
|
||||||
void dip_switch_update_mask_user(uint32_t state);
|
bool dip_switch_update_mask_user(uint32_t state);
|
||||||
void dip_switch_update_mask_kb(uint32_t state);
|
bool dip_switch_update_mask_kb(uint32_t state);
|
||||||
|
|
||||||
void dip_switch_init(void);
|
void dip_switch_init(void);
|
||||||
void dip_switch_read(bool forced);
|
void dip_switch_read(bool forced);
|
||||||
|
Reference in New Issue
Block a user