QMK Split 키보드의 RGBLIGHT를 USB 일시 중단으로 끕니다.
4795 단어 qmk_firmwaresuspendQMK키보드
슬레이브측은 빛난 채
QMK 펌웨어로 RGBLIGHT_ENABLE = yes, RGBLIGHT_SLEEP = yes의 설정으로 하면, USB 서스펜드시 Split 키보드의 마스터측만 소등해, 슬레이브측은 빛난 채로 된다.
tmk_core/common/avr/suspend.c에 꺼지는 코드가 있습니다.
tmk_core/protocol/lufa/lufa.c에 있는 함수로부터 불린다. 그러나, lufa.c는 원래 마스터측 밖에 서스펜드에의 대응이 되어 있지 않다. 따라서, 마스터 측이 서스펜드에 들어가도 슬레이브 측은 계속 점등한다.
하드웨어 수정이 필요하지만 슬레이브 측을 소등시킬 수 있었기 때문에 기사를 써 보았다. 또한 #define USE_I2C에는 물리적으로 대응할 수 없습니다.
Split 키보드의 슬레이브 쪽을 일시 중단합니다.
Corne Keyboard에서 수정하고 있지만, 다른 Split 키보드에서도 같다고 생각한다.
하드웨어 수정

마스터측과 슬레이브측을 TRS로 접속한다. 따라서 #define USE_I2C는 사용할 수 없습니다.
소스 코드 수정
keyboards/crkbd/rules.mk에서 RGBLIGHT_ENABLE = yes로 설정
diff --git a/keyboards/crkbd/rules.mk b/keyboards/crkbd/rules.mk
index 16d05b589..f4a639fea 100644
--- a/keyboards/crkbd/rules.mk
+++ b/keyboards/crkbd/rules.mk
@@ -26,7 +26,7 @@ MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
-RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
+RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
keyboards/crkbd/keymaps/default/config.h에서 RGBLIGHT_SLEEP 및 SLAVE_SUSPEND_PIN을 정의합니다. SLAVE_SUSPEND_PIN은 하드웨어의 수정으로 결선한 단자를 쓴다.
diff --git a/keyboards/crkbd/keymaps/default/config.h b/keyboards/crkbd/keymaps/default/config.h
index 899fde008..e14fe9745 100644
--- a/keyboards/crkbd/keymaps/default/config.h
+++ b/keyboards/crkbd/keymaps/default/config.h
@@ -35,9 +35,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define TAPPING_FORCE_HOLD
#define TAPPING_TERM 100
+#define SLAVE_SUSPEND_PIN B6
+
#ifdef RGBLIGHT_ENABLE
#undef RGBLED_NUM
#define RGBLIGHT_ANIMATIONS
+ #define RGBLIGHT_SLEEP
+ #define RGBLED_SPLIT {27, 27}
#define RGBLED_NUM 27
#define RGBLIGHT_LIMIT_VAL 120
#define RGBLIGHT_HUE_STEP 10
수정하는 함수는 matrix_init_user(), suspend_power_down_user(), suspend_wakeup_init_user(), matrix_scan_user().
마스터 측에서 단자 출력의 High/Low를 실행하고, 슬레이브 측에서 단자를 읽고, 슬레이브 측에서는 호출되지 않는 suspend_power_down(), suspend_wakeup_init()를 호출한다.
서스펜드의 루프 처리는 tmk_core/protocol/lufa/lufa.c의 main()에 쓰는 것이 좋지만, 모두 사용자 함수로 대응하기 때문에 matrix_scan_user()에 썼다.
diff --git a/keyboards/crkbd/keymaps/default/keymap.c b/keyboards/crkbd/keymaps/default/keymap.c
index 446e3281e..aecfed41b 100644
--- a/keyboards/crkbd/keymaps/default/keymap.c
+++ b/keyboards/crkbd/keymaps/default/keymap.c
@@ -105,6 +105,25 @@ void matrix_init_user(void) {
#ifdef SSD1306OLED
iota_gfx_init(!has_usb()); // turns on the display
#endif
+ if(has_usb()) {
+ writePinHigh(SLAVE_SUSPEND_PIN);
+ setPinOutput(SLAVE_SUSPEND_PIN);
+ }
+}
+
+extern void suspend_power_down(void);
+extern void suspend_wakeup_init(void);
+
+void suspend_power_down_user(void) {
+ if(is_master) {
+ writePinLow(SLAVE_SUSPEND_PIN);
+ }
+}
+
+void suspend_wakeup_init_user(void) {
+ if(is_master) {
+ writePinHigh(SLAVE_SUSPEND_PIN);
+ }
}
//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
@@ -123,6 +142,19 @@ const char *read_keylogs(void);
// const char *read_timelog(void);
void matrix_scan_user(void) {
+ static uint8_t recursive_call_guard = 0U;
+ if(!is_master && !recursive_call_guard) {
+ recursive_call_guard = 1U;
+ uint8_t need_suspend_wakeup_init = 0U;
+ while (readPin(SLAVE_SUSPEND_PIN) == 0x00 && !suspend_wakeup_condition()) {
+ suspend_power_down();
+ need_suspend_wakeup_init = 1U;
+ }
+ if (need_suspend_wakeup_init) {
+ suspend_wakeup_init();
+ }
+ recursive_call_guard = 0U;
+ }
iota_gfx_task();
}
이것으로 마스터 측의 제어로 슬레이브 측이 서스펜드에 들어가게 된다.
Reference
이 문제에 관하여(QMK Split 키보드의 RGBLIGHT를 USB 일시 중단으로 끕니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/qawsed477/items/36137b7c7d7af62d93df
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Corne Keyboard에서 수정하고 있지만, 다른 Split 키보드에서도 같다고 생각한다.
하드웨어 수정

마스터측과 슬레이브측을 TRS로 접속한다. 따라서 #define USE_I2C는 사용할 수 없습니다.
소스 코드 수정
keyboards/crkbd/rules.mk에서 RGBLIGHT_ENABLE = yes로 설정
diff --git a/keyboards/crkbd/rules.mk b/keyboards/crkbd/rules.mk
index 16d05b589..f4a639fea 100644
--- a/keyboards/crkbd/rules.mk
+++ b/keyboards/crkbd/rules.mk
@@ -26,7 +26,7 @@ MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
-RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
+RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
keyboards/crkbd/keymaps/default/config.h에서 RGBLIGHT_SLEEP 및 SLAVE_SUSPEND_PIN을 정의합니다. SLAVE_SUSPEND_PIN은 하드웨어의 수정으로 결선한 단자를 쓴다.
diff --git a/keyboards/crkbd/keymaps/default/config.h b/keyboards/crkbd/keymaps/default/config.h
index 899fde008..e14fe9745 100644
--- a/keyboards/crkbd/keymaps/default/config.h
+++ b/keyboards/crkbd/keymaps/default/config.h
@@ -35,9 +35,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define TAPPING_FORCE_HOLD
#define TAPPING_TERM 100
+#define SLAVE_SUSPEND_PIN B6
+
#ifdef RGBLIGHT_ENABLE
#undef RGBLED_NUM
#define RGBLIGHT_ANIMATIONS
+ #define RGBLIGHT_SLEEP
+ #define RGBLED_SPLIT {27, 27}
#define RGBLED_NUM 27
#define RGBLIGHT_LIMIT_VAL 120
#define RGBLIGHT_HUE_STEP 10
수정하는 함수는 matrix_init_user(), suspend_power_down_user(), suspend_wakeup_init_user(), matrix_scan_user().
마스터 측에서 단자 출력의 High/Low를 실행하고, 슬레이브 측에서 단자를 읽고, 슬레이브 측에서는 호출되지 않는 suspend_power_down(), suspend_wakeup_init()를 호출한다.
서스펜드의 루프 처리는 tmk_core/protocol/lufa/lufa.c의 main()에 쓰는 것이 좋지만, 모두 사용자 함수로 대응하기 때문에 matrix_scan_user()에 썼다.
diff --git a/keyboards/crkbd/keymaps/default/keymap.c b/keyboards/crkbd/keymaps/default/keymap.c
index 446e3281e..aecfed41b 100644
--- a/keyboards/crkbd/keymaps/default/keymap.c
+++ b/keyboards/crkbd/keymaps/default/keymap.c
@@ -105,6 +105,25 @@ void matrix_init_user(void) {
#ifdef SSD1306OLED
iota_gfx_init(!has_usb()); // turns on the display
#endif
+ if(has_usb()) {
+ writePinHigh(SLAVE_SUSPEND_PIN);
+ setPinOutput(SLAVE_SUSPEND_PIN);
+ }
+}
+
+extern void suspend_power_down(void);
+extern void suspend_wakeup_init(void);
+
+void suspend_power_down_user(void) {
+ if(is_master) {
+ writePinLow(SLAVE_SUSPEND_PIN);
+ }
+}
+
+void suspend_wakeup_init_user(void) {
+ if(is_master) {
+ writePinHigh(SLAVE_SUSPEND_PIN);
+ }
}
//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
@@ -123,6 +142,19 @@ const char *read_keylogs(void);
// const char *read_timelog(void);
void matrix_scan_user(void) {
+ static uint8_t recursive_call_guard = 0U;
+ if(!is_master && !recursive_call_guard) {
+ recursive_call_guard = 1U;
+ uint8_t need_suspend_wakeup_init = 0U;
+ while (readPin(SLAVE_SUSPEND_PIN) == 0x00 && !suspend_wakeup_condition()) {
+ suspend_power_down();
+ need_suspend_wakeup_init = 1U;
+ }
+ if (need_suspend_wakeup_init) {
+ suspend_wakeup_init();
+ }
+ recursive_call_guard = 0U;
+ }
iota_gfx_task();
}
이것으로 마스터 측의 제어로 슬레이브 측이 서스펜드에 들어가게 된다.
Reference
이 문제에 관하여(QMK Split 키보드의 RGBLIGHT를 USB 일시 중단으로 끕니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/qawsed477/items/36137b7c7d7af62d93df텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)