diff --git a/keyboards/zerfstudios/douballz/Untitled-2.c b/keyboards/zerfstudios/douballz/Untitled-2.c new file mode 100644 index 000000000000..78e256ba173a --- /dev/null +++ b/keyboards/zerfstudios/douballz/Untitled-2.c @@ -0,0 +1,122 @@ +/* Copyright 2021 QMK + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +enum serial_transaction_id { +#ifdef USE_I2C + I2C_EXECUTE_CALLBACK, +#endif // USE_I2C + + GET_SLAVE_MATRIX_CHECKSUM, + GET_SLAVE_MATRIX_DATA, + +#ifdef SPLIT_TRANSPORT_MIRROR + PUT_MASTER_MATRIX, +#endif // SPLIT_TRANSPORT_MIRROR + +#ifdef ENCODER_ENABLE + GET_ENCODERS_CHECKSUM, + GET_ENCODERS_DATA, +#endif // ENCODER_ENABLE + +#ifndef DISABLE_SYNC_TIMER + PUT_SYNC_TIMER, +#endif // DISABLE_SYNC_TIMER + +#if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) + PUT_LAYER_STATE, + PUT_DEFAULT_LAYER_STATE, +#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) + +#ifdef SPLIT_LED_STATE_ENABLE + PUT_LED_STATE, +#endif // SPLIT_LED_STATE_ENABLE + +#ifdef SPLIT_MODS_ENABLE + PUT_MODS, +#endif // SPLIT_MODS_ENABLE + +#ifdef BACKLIGHT_ENABLE + PUT_BACKLIGHT, +#endif // BACKLIGHT_ENABLE + +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + PUT_RGBLIGHT, +#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + +#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) + PUT_LED_MATRIX, +#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) + +#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) + PUT_RGB_MATRIX, +#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + +#if defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) + PUT_WPM, +#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) + +#if defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) + PUT_OLED, +#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) + +#if defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) + PUT_ST7565, +#endif // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) + +#if defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) + GET_POINTING_CHECKSUM, + GET_POINTING_DATA, + GET_POINTING_CPI_CHECKSUM, + GET_POINTING_CPI, + PUT_POINTING_CPI, +#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) + +#if defined(SPLIT_WATCHDOG_ENABLE) + PUT_WATCHDOG, +#endif // defined(SPLIT_WATCHDOG_ENABLE) + +#if defined(HAPTIC_ENABLE) && defined(SPLIT_HAPTIC_ENABLE) + PUT_HAPTIC, +#endif // defined(HAPTIC_ENABLE) && defined(SPLIT_HAPTIC_ENABLE) + +#if defined(SPLIT_ACTIVITY_ENABLE) + PUT_ACTIVITY, +#endif // SPLIT_ACTIVITY_ENABLE + +#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) + PUT_RPC_INFO, + PUT_RPC_REQ_DATA, + EXECUTE_RPC, + GET_RPC_RESP_DATA, +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) + +// keyboard-specific +#ifdef SPLIT_TRANSACTION_IDS_KB + SPLIT_TRANSACTION_IDS_KB, +#endif // SPLIT_TRANSACTION_IDS_KB + +// user/keymap-specific +#ifdef SPLIT_TRANSACTION_IDS_USER + SPLIT_TRANSACTION_IDS_USER, +#endif // SPLIT_TRANSACTION_IDS_USER + + NUM_TOTAL_TRANSACTIONS +}; + +// Ensure we only use 5 bits for transaction +_Static_assert(NUM_TOTAL_TRANSACTIONS <= (1 << 5), "Max number of usable transactions exceeded"); diff --git a/keyboards/zerfstudios/douballz/config.h b/keyboards/zerfstudios/douballz/config.h index a582194304d7..15630b0a97f6 100644 --- a/keyboards/zerfstudios/douballz/config.h +++ b/keyboards/zerfstudios/douballz/config.h @@ -112,9 +112,7 @@ #define SPLIT_HAPTIC_ENABLE #endif - /* Pointing device configuration. */ - #define SPI_DRIVER SPID0 #define SPI_SCK_PIN GP18 #define SPI_MOSI_PIN GP19 @@ -137,7 +135,7 @@ #define POINTING_PRECISION_DIVISOR 4 #define POINTING_DRAG_DIVISOR 4 #define POINTING_MODE_DEFAULT PM_NONE -#define POINTING_DEVICE_DEBUG +// #define POINTING_DEVICE_DEBUG // #define POINTING_MODES_SINGLE_CONTROL // #define MOUSE_SCROLL_HIRES_ENABLE diff --git a/keyboards/zerfstudios/douballz/douballz.c b/keyboards/zerfstudios/douballz/douballz.c index 5b3b87e5b159..e7d60053a4b1 100644 --- a/keyboards/zerfstudios/douballz/douballz.c +++ b/keyboards/zerfstudios/douballz/douballz.c @@ -553,43 +553,47 @@ void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data){ } +void init_qp_display(void) { + if (is_keyboard_left()) { + #if (defined(KEYBOARD_zerfstudios_douballz_rev1)) + qp_display = qp_st7735_make_spi_device(80, 160, DISPLAY_CS_PIN, DISPLAY_DC_PIN, DISPLAY_RST_PIN, 8, 0); + qp_init(qp_display, QP_ROTATION_180); + qp_set_viewport_offsets (qp_display, 25, 0); + qp_rect(qp_display, 0, 0, 80, 160, 0, 0, 0, true); + #elif (defined(KEYBOARD_zerfstudios_douballz_rev2)) + qp_display = qp_st7789_make_spi_device(240, 320, DISPLAY_CS_PIN, DISPLAY_DC_PIN, DISPLAY_RST_PIN, 8, 3); + qp_set_viewport_offsets(qp_display, 0, 0); + qp_init(qp_display, QP_ROTATION_0); + qp_rect(qp_display, 0, 0, 172, 320, 0,0,0, true); + #endif + } else { + #if (defined(KEYBOARD_zerfstudios_douballz_rev1)) + qp_display = qp_st7735_make_spi_device(80, 160, DISPLAY_CS_PIN_RIGHT, DISPLAY_DC_PIN_RIGHT, DISPLAY_RST_PIN_RIGHT, 8, 0); + qp_init(qp_display, QP_ROTATION_180); + qp_set_viewport_offsets (qp_display, 25, 0); + qp_rect(qp_display, 0, 0, 80, 160, 0, 0, 0, true); + #elif (defined(KEYBOARD_zerfstudios_douballz_rev2)) + qp_display = qp_st7789_make_spi_device(240, 320, DISPLAY_CS_PIN_RIGHT, DISPLAY_DC_PIN_RIGHT, DISPLAY_RST_PIN_RIGHT, 8, 3); + qp_set_viewport_offsets(qp_display, 0, 0); + qp_init(qp_display, QP_ROTATION_180); + qp_rect(qp_display, 0, 0, 172, 320, 0,0,0, true); + #endif + } +} + +extern bool trigger; + void keyboard_post_init_kb(void) { maybe_update_pointing_device_cpi(&g_charybdis_config); transaction_register_rpc(RPC_ID_KB_CONFIG_SYNC, charybdis_config_sync_handler); - // pointing_device_set_cpi(800); - // pointing_device_set_cpi_by_index(800, 0); - // pointing_device_set_cpi_by_index(800, 1); + pointing_device_set_cpi_by_index(800, 0); + pointing_device_set_cpi_by_index(800, 1); // Reset the initial shared data value between master and slave - // debug_keyboard = true; - // debug_mouse = true; memset(&g_charybdis_config, 0, sizeof(g_charybdis_config)); wait_ms(50); - if (is_keyboard_left()) { - #if (defined(KEYBOARD_zerfstudios_douballz_rev1)) - qp_display = qp_st7735_make_spi_device(80, 160, DISPLAY_CS_PIN, DISPLAY_DC_PIN, DISPLAY_RST_PIN, 8, 0); - qp_init(qp_display, QP_ROTATION_180); - qp_set_viewport_offsets (qp_display, 25, 0); - qp_rect(qp_display, 0, 0, 80, 160, 0, 0, 0, true); - #elif (defined(KEYBOARD_zerfstudios_douballz_rev2)) - qp_display = qp_st7789_make_spi_device(240, 320, DISPLAY_CS_PIN, DISPLAY_DC_PIN, DISPLAY_RST_PIN, 8, 3); - qp_set_viewport_offsets(qp_display, 0, 0); - qp_init(qp_display, QP_ROTATION_0); - qp_rect(qp_display, 0, 0, 172, 320, 0,0,0, true); - #endif - } else { - #if (defined(KEYBOARD_zerfstudios_douballz_rev1)) - qp_display = qp_st7735_make_spi_device(80, 160, DISPLAY_CS_PIN_RIGHT, DISPLAY_DC_PIN_RIGHT, DISPLAY_RST_PIN_RIGHT, 8, 0); - qp_init(qp_display, QP_ROTATION_180); - qp_set_viewport_offsets (qp_display, 25, 0); - qp_rect(qp_display, 0, 0, 80, 160, 0, 0, 0, true); - #elif (defined(KEYBOARD_zerfstudios_douballz_rev2)) - qp_display = qp_st7789_make_spi_device(240, 320, DISPLAY_CS_PIN_RIGHT, DISPLAY_DC_PIN_RIGHT, DISPLAY_RST_PIN_RIGHT, 8, 3); - qp_set_viewport_offsets(qp_display, 0, 0); - qp_init(qp_display, QP_ROTATION_180); - qp_rect(qp_display, 0, 0, 172, 320, 0,0,0, true); - #endif - } - // #endif + + init_qp_display(); + backlight_level_noeeprom(3); qp_lvgl_attach(qp_display); @@ -621,9 +625,6 @@ void keyboard_post_init_kb(void) { } void housekeeping_task_kb(void) { -#ifdef QUANTUM_PAINTER_ENABLE - // kb_state_update(); -#endif if (is_keyboard_master()) { // Keep track of the last state, so that we can tell if we need to propagate to slave static charybdis_config_t last_charybdis_config = {0}; @@ -646,28 +647,8 @@ void housekeeping_task_kb(void) { last_sync = timer_read32(); } } - // #ifdef QUANTUM_PAINTER_ENABLE - // static kb_runtime_config last_kb_state; - // // Check if the state values are different - // if (memcmp(&kb_state, &last_kb_state, sizeof(kb_runtime_config))) { - // needs_sync = true; - // memcpy(&last_kb_state, &kb_state, sizeof(kb_runtime_config)); - // } - - // // Perform the sync if requested - // if (needs_sync) { - // if (transaction_rpc_send(RPC_ID_SYNC_STATE_KB, sizeof(kb_runtime_config), &kb_state)) { - // last_sync = timer_read32(); - // } - // } - // #endif } #ifdef QUANTUM_PAINTER_ENABLE - // static bool lcd_on = false; - // if (lcd_on != (bool)g_charybdis_config.lcd_power) { - // lcd_on = (bool)g_charybdis_config.lcd_power; - // qp_power(qp_display, lcd_on); - // } bool peripherals_on = last_input_activity_elapsed() < LCD_ACTIVITY_TIMEOUT; if (peripherals_on) { backlight_enable(); diff --git a/keyboards/zerfstudios/douballz/douballz.h b/keyboards/zerfstudios/douballz/douballz.h index e4d0854d3d6a..39541952e3c8 100644 --- a/keyboards/zerfstudios/douballz/douballz.h +++ b/keyboards/zerfstudios/douballz/douballz.h @@ -166,6 +166,3 @@ void matrix_scan_sub_kb(void); void keyboard_pre_init_sync(void); void keyboard_post_init_sync(void); void housekeeping_task_sync(void); - -// void kb_config_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer); -// void kb_state_sync_slave(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer); diff --git a/keyboards/zerfstudios/douballz/ui/ui.c b/keyboards/zerfstudios/douballz/ui/ui.c index f17cfaa93631..a52bd9dc5566 100644 --- a/keyboards/zerfstudios/douballz/ui/ui.c +++ b/keyboards/zerfstudios/douballz/ui/ui.c @@ -593,9 +593,9 @@ void set_unicode_mode_text_value(lv_obj_t* lbl) { char buf[32]; const char *unicode_mode_display = "-----"; switch (user_state.unicode_typing_mode) { - // case 0: - // unicode_mode_display = "NO MODE"; - // break; + case 0: + unicode_mode_display = "NO MODE"; + break; case 1: unicode_mode_display = "WIDE"; break; @@ -617,8 +617,8 @@ void set_unicode_mode_text_value(lv_obj_t* lbl) { case 7: unicode_mode_display = "SUPER"; break; - // case 8: - // unicode_mode_display = "COMIC"; + case 8: + unicode_mode_display = "COMIC"; break; default: unicode_mode_display = " "; @@ -691,9 +691,9 @@ void set_pm_text_value(lv_obj_t* lbl) { case 15: pm_name = "WIN_POS"; break; - // case 16: - // pm_name = "ACCELL"; - // break; + case 16: + pm_name = "ACCELL"; + break; default: pm_name = " "; break; @@ -1381,7 +1381,9 @@ void ui_Screen2_screen_init(void) lv_obj_add_event_cb(ui_Screen2, ui_render_rgbhue_redraw, USER_EVENT_RGBHUE_UPDATE, NULL); } + void lvgl_event_triggers(void) { + static uint32_t last_dl_state = 0; bool dl_state_redraw = false; if (last_dl_state != default_layer_state) { @@ -1576,7 +1578,6 @@ void lvgl_event_triggers(void) { // } else { // lv_led_off(ui_PM_led3); // } - } diff --git a/users/drashna/config.h b/users/drashna/config.h index b4aa1283eb49..14805ca2d097 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -43,7 +43,6 @@ # define WPM_ESTIMATED_WORD_SIZE 5 #endif - #define UNICODE_SELECTED_MODES UNICODE_MODE_WINCOMPOSE, UNICODE_MODE_MACOS #ifndef ONESHOT_TAP_TOGGLE diff --git a/users/freznel/callbacks.c b/users/freznel/callbacks.c index 556d019c279f..c33d6a0b4312 100644 --- a/users/freznel/callbacks.c +++ b/users/freznel/callbacks.c @@ -106,26 +106,7 @@ void suspend_wakeup_init_user(void) { // scan function __attribute__((weak)) void matrix_scan_keymap(void) {} void matrix_scan_user(void) { - static bool has_ran_yet; - if (!has_ran_yet) { - has_ran_yet = true; - startup_user(); - } - -#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. - // run_diablo_macro_check(); -#endif // TAP_DANCE_ENABLE -#if defined(CUSTOM_RGB_MATRIX) - matrix_scan_rgb_matrix(); -#endif -#ifdef I2C_SCANNER_ENABLE - matrix_scan_i2c(); -#endif -#ifdef CUSTOM_OLED_DRIVER - matrix_scan_oled(); -#endif matrix_scan_super_alt_tab(); - matrix_scan_keymap(); } @@ -139,10 +120,6 @@ __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) return state; } layer_state_t layer_state_set_user(layer_state_t state) { - if (!is_keyboard_master()) { - return state; - } - state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); // #if defined(CUSTOM_POINTING_DEVICE) // state = layer_state_set_pointing(state); @@ -150,18 +127,14 @@ layer_state_t layer_state_set_user(layer_state_t state) { #if defined(CUSTOM_RGBLIGHT) state = layer_state_set_rgb_light(state); #endif // CUSTOM_RGBLIGHT -#if defined(AUDIO_ENABLE) && !defined(__arm__) - static bool is_gamepad_on = false; - if (layer_state_cmp(state, _GAMEPAD) != is_gamepad_on) { - is_gamepad_on = layer_state_cmp(state, _GAMEPAD); - if (is_gamepad_on) { - PLAY_LOOP(doom_song); - } else { - stop_all_notes(); - } - } -#endif state = layer_state_set_keymap(state); + +#ifdef CONSOLE_ENABLE + char layer_buffer[16 + 5]; + format_layer_bitmap_string(layer_buffer, state, default_layer_state); + dprintf("layer state: %s\n", layer_buffer); +#endif + return state; } @@ -233,8 +206,16 @@ void matrix_slave_scan_user(void) { __attribute__((weak)) void housekeeping_task_keymap(void) {} void housekeeping_task_user(void) { + static bool has_ran_yet; + if (!has_ran_yet) { + has_ran_yet = true; + startup_user(); + } #if defined(SPLIT_KEYBOARD) && defined(SPLIT_TRANSACTION_IDS_USER) housekeeping_task_transport_sync(); +#endif +#if defined(CUSTOM_RGB_MATRIX) + housekeeping_task_rgb_matrix(); #endif housekeeping_task_keymap(); } diff --git a/users/freznel/config.h b/users/freznel/config.h index 6cec542ee709..c777cebf73a3 100644 --- a/users/freznel/config.h +++ b/users/freznel/config.h @@ -29,8 +29,6 @@ # define WPM_ESTIMATED_WORD_SIZE 5 #endif - - #ifdef AUDIO_ENABLE # define AUDIO_CLICKY # define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f diff --git a/users/freznel/rgb/rgb_matrix_stuff.c b/users/freznel/rgb/rgb_matrix_stuff.c index 597c005ac7f5..c0b6a4166aff 100644 --- a/users/freznel/rgb/rgb_matrix_stuff.c +++ b/users/freznel/rgb/rgb_matrix_stuff.c @@ -56,7 +56,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode __attribute__((weak)) void rgb_matrix_indicator_keymap(void) {} -void matrix_scan_rgb_matrix(void) { +void housekeeping_task_rgb_matrix(void) { #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_TYPING_HEATMAP && sync_timer_elapsed32(hypno_timer) > 15000) { rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE); diff --git a/users/freznel/rgb/rgb_matrix_stuff.h b/users/freznel/rgb/rgb_matrix_stuff.h index 6be50c1f315c..e1640f16440a 100644 --- a/users/freznel/rgb/rgb_matrix_stuff.h +++ b/users/freznel/rgb/rgb_matrix_stuff.h @@ -6,7 +6,7 @@ bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record); void keyboard_post_init_rgb_matrix(void); -void matrix_scan_rgb_matrix(void); +void housekeeping_task_rgb_matrix(void); void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue); void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type, uint8_t led_min, uint8_t led_max); diff --git a/users/freznel/split/split_config.h b/users/freznel/split/split_config.h index 21ff3829bb7b..1d8d289567ac 100644 --- a/users/freznel/split/split_config.h +++ b/users/freznel/split/split_config.h @@ -3,13 +3,11 @@ #pragma once -// # define SPLIT_TRANSPORT_MIRROR +# efine SPLIT_TRANSPORT_MIRROR #define SPLIT_LAYER_STATE_ENABLE #define SPLIT_LED_STATE_ENABLE #define SPLIT_MODS_ENABLE -#ifndef POINTING_DEVICE_ENABLE -# define SPLIT_WATCHDOG_ENABLE -#endif +#define SPLIT_WATCHDOG_ENABLE #ifdef WPM_ENABLE # define SPLIT_WPM_ENABLE #endif diff --git a/users/freznel/split/transport_sync.c b/users/freznel/split/transport_sync.c index 8166cf311c82..519ebcc6bf1a 100644 --- a/users/freznel/split/transport_sync.c +++ b/users/freznel/split/transport_sync.c @@ -5,7 +5,6 @@ #include "transport_sync.h" #include "transactions.h" #include -#include "os_detection.h" #ifdef UNICODE_COMMON_ENABLE # include "process_unicode_common.h" @@ -100,9 +99,6 @@ void user_transport_update(void) { user_state.pointing_side = get_pointing_mode_device(); # endif //POINTING_DEVICE_COMBINED #endif //POINTING_DEVICE_MODES_ENABLE -#ifdef OS_DETECTION_ENABLE - user_state.detected_os = detected_host_os(); -#endif transport_user_state = user_state.raw; } else { keymap_config.raw = transport_keymap_config; diff --git a/users/freznel/split/transport_sync.h b/users/freznel/split/transport_sync.h index 5fa1c0447e32..aa6725b62684 100644 --- a/users/freznel/split/transport_sync.h +++ b/users/freznel/split/transport_sync.h @@ -30,9 +30,6 @@ typedef union { bool is_caps_word_on :1; bool pointing_side :1; uint8_t split_pointing_mode :4; -#ifdef OS_DETECTION_ENABLE - uint8_t detected_os :3; -#endif }; } user_runtime_config_t;