Browse Source

Fixed some stuff

pull/14484/head
Batuhan Başerdem 2 years ago
parent
commit
3c41a01ebf
7 changed files with 54 additions and 32 deletions
  1. +1
    -2
      layouts/community/split_3x6_3/bbaserdem/config.h
  2. +5
    -4
      users/bbaserdem/bb-oled-extra.c
  3. +4
    -4
      users/bbaserdem/bb-rgb.c
  4. +2
    -0
      users/bbaserdem/bb-rgb.h
  5. +39
    -20
      users/bbaserdem/bbaserdem.c
  6. +1
    -1
      users/bbaserdem/bbaserdem.h
  7. +2
    -1
      users/bbaserdem/config.h

+ 1
- 2
layouts/community/split_3x6_3/bbaserdem/config.h View File

@ -73,8 +73,7 @@
# define WS2812_DMA_CHANNEL 3
// OLED related code
# ifdef OLED_DRIVER_ENABLE
# define OLED_TIMEOUT 50000
# ifdef OLED_ENABLE
# define OLED_UPDATE_INTERVAL 100
# endif


+ 5
- 4
users/bbaserdem/bb-oled-extra.c View File

@ -570,6 +570,7 @@ void render_layout(uint8_t row, uint8_t col, uint8_t mods, bool isLeft) {
},{ 0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x08,0xf8,0x08,0xf0,0x00,0x70,0x88,
0x88,0x88,0x71,0x00,0x70,0x88,0x88,0x48,0xff,0x00,0x70,0xa8,0xa8,0xa8,
0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}};
uint8_t this_layout = userspace_config.layout % 3;
// Render the requested image on the given column and row
// Don't grab highest layer; instead compare from top to bottom.
@ -582,7 +583,7 @@ void render_layout(uint8_t row, uint8_t col, uint8_t mods, bool isLeft) {
} else if (layer_state_cmp(layer_state, _FUNC)) {
draw_image(row, col, func7_L);
} else if (layer_state_cmp(layer_state, _NUMB)) {
switch (userspace_config.layout % 3) {
switch (this_layout) {
case 0: // Dvorak
if (mods & MOD_MASK_SHIFT) {
draw_image(row, col, numb6_L_dvor_shift);
@ -618,7 +619,7 @@ void render_layout(uint8_t row, uint8_t col, uint8_t mods, bool isLeft) {
} else if (layer_state_cmp(layer_state, _CHAR)) {
draw_image(row, col, char1_L);
} else {
switch (userspace_config.layout % 3) {
switch (this_layout) {
case 0: // Dvorak
if (mods & MOD_MASK_SHIFT) {
draw_image(row, col, base0_L_dvor_shift);
@ -654,7 +655,7 @@ void render_layout(uint8_t row, uint8_t col, uint8_t mods, bool isLeft) {
if (layer_state_cmp(layer_state, _MUSI)) {
draw_image(row, col, musi9_R);
} else if (layer_state_cmp(layer_state, _SYMB)) {
switch (userspace_config.layout % 3) {
switch (this_layout) {
case 0: // Dvorak
draw_image(row, col, symb5_R_dvor);
break;
@ -682,7 +683,7 @@ void render_layout(uint8_t row, uint8_t col, uint8_t mods, bool isLeft) {
} else if (layer_state_cmp(layer_state, _CHAR)) {
draw_image(row, col, char1_R);
} else {
switch (userspace_config.layout % 3) {
switch (this_layout) {
case 0: // Dvorak
if (mods & MOD_MASK_SHIFT) {
draw_image(row, col, base0_R_dvor_shift);


+ 4
- 4
users/bbaserdem/bb-rgb.c View File

@ -22,10 +22,6 @@
*/
// Allow hooking into the RGB matrix indications using keymap code
// Allow to turn off global handling
__attribute__ ((weak)) bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
return false;
}
// Modulates the brightness of indicator
RGB helper_dimmer(uint8_t r, uint8_t g, uint8_t b) {
@ -62,6 +58,10 @@ void helper_painter(uint8_t led_min, uint8_t led_max, RGB col, uint8_t side) {
}
}
// Allow to turn off global handling
__attribute__ ((weak)) bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
return false;
}
// Set RGB state depending on layer
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
uint8_t thisInd = 3;


+ 2
- 0
users/bbaserdem/bb-rgb.h View File

@ -22,6 +22,8 @@
// For custom indicators
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max);
// RGB sleep implementation
void housekeeping_task_rgb(void);
// Hook into shutdown code
void shutdown_rgb(void);
void suspend_wakeup_init_rgb(void);


+ 39
- 20
users/bbaserdem/bbaserdem.c View File

@ -67,7 +67,7 @@ void userspace_transport_update(void) {
}
// Initiate the protocol on sync
void userspace_transport_sync(void) {
void userspace_transport_sync(bool force_sync) {
if (is_keyboard_master()) {
// Keep track of the last state
static userspace_config_t last_userspace_config;
@ -79,9 +79,8 @@ void userspace_transport_sync(void) {
needs_sync = true;
memcpy(&last_userspace_config, &transport_userspace_config, sizeof(transport_userspace_config));
}
// Perform the sync if requested
if (needs_sync) {
if (needs_sync || force_sync) {
transaction_rpc_send(RPC_ID_CONFIG_SYNC, sizeof(transport_userspace_config), &transport_userspace_config);
needs_sync = false;
}
@ -93,7 +92,7 @@ void userspace_transport_sync(void) {
}
// Perform the sync if requested
if (needs_sync) {
if (needs_sync || force_sync) {
transaction_rpc_send(RPC_ID_RUNTIME_SYNC, sizeof(transport_userspace_runtime), &transport_userspace_runtime);
needs_sync = false;
}
@ -135,14 +134,32 @@ __attribute__ ((weak)) void keyboard_post_init_keymap(void) {}
__attribute__ ((weak)) void keyboard_post_init_user(void) {
// Fix beginning base layer, in case some other firmware was flashed
// set_single_persistent_default_layer(_BASE);
// Initialize userspace config
userspace_config.raw = eeconfig_read_user();
// Unicode mode
# ifdef UNICODEMAP_ENABLE
set_unicode_input_mode(UC_LNX);
# endif // UNICODEMAP_ENABLE
// Split keyboard halves communication
# ifdef SPLIT_KEYBOARD
// Register the transactions
transaction_register_rpc( RPC_ID_CONFIG_SYNC, userspace_config_sync );
transaction_register_rpc(RPC_ID_RUNTIME_SYNC, userspace_runtime_sync);
// Load default config values
if (is_keyboard_master()) {
// If we are main; load from eeconfig
userspace_config.raw = eeconfig_read_user();
// And update the transport variable
userspace_transport_update();
// Do one forced transfer to sync halves
userspace_transport_sync(true);
} else {
// Just sync the data received
userspace_transport_update();
}
# else // SPLIT_KEYBOARD
// If we are not split; just load from eeprom
userspace_config.raw = eeconfig_read_user();
# endif // SPLIT_KEYBOARD
// Backlight LED
@ -155,11 +172,6 @@ __attribute__ ((weak)) void keyboard_post_init_user(void) {
keyboard_post_init_underglow();
# endif // RGBLIGHT_ENABLE
// Unicode mode
# ifdef UNICODEMAP_ENABLE
set_unicode_input_mode(UC_LNX);
# endif // UNICODEMAP_ENABLE
// Keymap specific stuff
keyboard_post_init_keymap();
}
@ -174,24 +186,31 @@ void housekeeping_task_user(void) {
// Check eeprom every now and then
static userspace_config_t prev_userspace_config;
static fast_timer_t throttle_timer = 0;
static bool init_flag = true;
// Do transport stuff
# ifdef SPLIT_KEYBOARD
userspace_transport_update();
userspace_transport_sync();
# endif // SPLIT_KEYBOARD
// Read this if we never read it before
if (init_flag) {
init_flag = false;
prev_userspace_config.raw = eeconfig_read_user();
}
// Throttled tasks
// Throttled tasks here
if (timer_elapsed_fast(throttle_timer) >= HOUSEKEEPING_THROTTLE_INTERVAL_MS) {
// Refresh timer
throttle_timer = timer_read_fast();
// Check userspace config for eeprom updates
if (prev_userspace_config.raw != userspace_config.raw) {
if (memcmp(&prev_userspace_config, &userspace_config, sizeof(userspace_config))) {
memcpy(&prev_userspace_config, &userspace_config, sizeof(userspace_config));
eeconfig_update_user(userspace_config.raw);
prev_userspace_config.raw = userspace_config.raw;
}
}
// Do transport stuff
# ifdef SPLIT_KEYBOARD
userspace_transport_update();
userspace_transport_sync(false);
# endif // SPLIT_KEYBOARD
// Hook to keymap code
housekeeping_task_keymap();
}


+ 1
- 1
users/bbaserdem/bbaserdem.h View File

@ -56,7 +56,7 @@
typedef union {
uint32_t raw;
struct {
bool test;
bool rgb_sleep;
};
} userspace_runtime_t;


+ 2
- 1
users/bbaserdem/config.h View File

@ -129,7 +129,8 @@
// For perkey leds
#ifdef RGB_MATRIX_ENABLE
# define RGB_DISABLE_TIMEOUT 1800000
// This is not working
//# define RGB_DISABLE_TIMEOUT 1800000
# define RGB_DISABLE_WHEN_USB_SUSPENDED true
// Start using this mode
# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_RAINBOW_BEACON


Loading…
Cancel
Save