diff options
Diffstat (limited to 'users/drashna')
-rw-r--r-- | users/drashna/autocorrect_data.h | 90 | ||||
-rw-r--r-- | users/drashna/callbacks.c | 20 | ||||
-rw-r--r-- | users/drashna/config.h | 232 | ||||
-rw-r--r-- | users/drashna/drashna.c | 131 | ||||
-rw-r--r-- | users/drashna/drashna.h | 1 | ||||
-rw-r--r-- | users/drashna/keyrecords/autocorrection/autocorrection_data.h | 1 | ||||
-rw-r--r-- | users/drashna/keyrecords/process_records.c | 5 | ||||
-rw-r--r-- | users/drashna/keyrecords/tapping.c | 14 | ||||
-rw-r--r-- | users/drashna/keyrecords/unicode.c | 2 | ||||
-rw-r--r-- | users/drashna/oled/oled_config.h | 63 | ||||
-rw-r--r-- | users/drashna/oled/oled_stuff.c | 24 | ||||
-rw-r--r-- | users/drashna/oled/oled_stuff.h | 2 | ||||
-rw-r--r-- | users/drashna/pointing/pointing.c | 6 | ||||
-rw-r--r-- | users/drashna/post_config.h | 16 | ||||
-rw-r--r-- | users/drashna/rgb/rgb_matrix_config.h | 107 | ||||
-rw-r--r-- | users/drashna/rgb/rgblight_config.h | 8 | ||||
-rw-r--r-- | users/drashna/rules.mk | 9 | ||||
-rw-r--r-- | users/drashna/split/split_config.h | 21 | ||||
-rw-r--r-- | users/drashna/split/transport_sync.c | 14 | ||||
-rw-r--r-- | users/drashna/split/transport_sync.h | 1 |
20 files changed, 492 insertions, 275 deletions
diff --git a/users/drashna/autocorrect_data.h b/users/drashna/autocorrect_data.h index bcb5858aa8..52ed7fa9a7 100644 --- a/users/drashna/autocorrect_data.h +++ b/users/drashna/autocorrect_data.h @@ -1,5 +1,93 @@ #if __has_include("../qmk_secrets/autocorrection_data.h") +# pragma message "Loading custom library" # include "../qmk_secrets/autocorrection_data.h" +# define AUTOCORRECTION_MIN_LENGTH AUTOCORRECT_MIN_LENGTH +# define AUTOCORRECTION_MAX_LENGTH AUTOCORRECT_MAX_LENGTH + #else -# include "autocorrect_data_default.h" +// Generated code. + +// Autocorrection dictionary (70 entries): +// :guage -> gauge +// :the:the: -> the +// :thier -> their +// :ture -> true +// accomodate -> accommodate +// acommodate -> accommodate +// aparent -> apparent +// aparrent -> apparent +// apparant -> apparent +// apparrent -> apparent +// aquire -> acquire +// becuase -> because +// cauhgt -> caught +// cheif -> chief +// choosen -> chosen +// cieling -> ceiling +// collegue -> colleague +// concensus -> consensus +// contians -> contains +// cosnt -> const +// dervied -> derived +// fales -> false +// fasle -> false +// fitler -> filter +// flase -> false +// foward -> forward +// frequecy -> frequency +// gaurantee -> guarantee +// guaratee -> guarantee +// heigth -> height +// heirarchy -> hierarchy +// inclued -> include +// interator -> iterator +// intput -> input +// invliad -> invalid +// lenght -> length +// liasion -> liaison +// libary -> library +// listner -> listener +// looses: -> loses +// looup -> lookup +// manefist -> manifest +// namesapce -> namespace +// namespcae -> namespace +// occassion -> occasion +// occured -> occurred +// ouptut -> output +// ouput -> output +// overide -> override +// postion -> position +// priviledge -> privilege +// psuedo -> pseudo +// recieve -> receive +// refered -> referred +// relevent -> relevant +// repitition -> repetition +// retrun -> return +// retun -> return +// reuslt -> result +// reutrn -> return +// saftey -> safety +// seperate -> separate +// singed -> signed +// stirng -> string +// strign -> string +// swithc -> switch +// swtich -> switch +// thresold -> threshold +// udpate -> update +// widht -> width + +#define AUTOCORRECT_MIN_LENGTH 5 // ":ture" +#define AUTOCORRECT_MAX_LENGTH 10 // "accomodate" + +#define DICTIONARY_SIZE 1104 + +static const uint8_t autocorrect_data[DICTIONARY_SIZE] PROGMEM = {108, 43, 0, 6, 71, 0, 7, 81, 0, 8, 199, 0, 9, 240, 1, 10, 250, 1, 11, 26, 2, 17, 53, 2, 18, 190, 2, 19, 202, 2, 21, 212, 2, 22, 20, 3, 23, 67, 3, 28, 16, 4, 0, 72, 50, 0, 22, 60, 0, 0, 11, 23, 44, 8, 11, 23, 44, 0, 132, 0, 8, 22, 18, 18, 15, 0, 132, 115, 101, 115, 0, 11, 23, 12, 26, 22, 0, 129, 99, 104, 0, 68, 94, 0, 8, 106, 0, 15, 174, 0, 21, 187, 0, 0, 12, 15, 25, 17, 12, 0, 131, 97, 108, 105, 100, 0, 74, 119, 0, 12, 129, 0, 21, 140, 0, 24, 165, 0, 0, 17, 12, 22, 0, 131, 103, 110, 101, 100, 0, 25, 21, 8, 7, 0, 131, 105, 118, 101, 100, 0, 72, 147, 0, 24, 156, 0, 0, 9, 8, 21, 0, 129, 114, 101, 100, 0, 6, 6, 18, 0, 129, 114, 101, 100, 0, 15, 6, 17, 12, 0, 129, 100, 101, 0, 18, 22, 8, 21, 11, 23, 0, 130, 104, 111, + 108, 100, 0, 4, 26, 18, 9, 0, 131, 114, 119, 97, 114, 100, 0, 68, 233, 0, 6, 246, 0, 7, 4, 1, 8, 16, 1, 10, 52, 1, 15, 81, 1, 21, 90, 1, 22, 117, 1, 23, 144, 1, 24, 215, 1, 25, 228, 1, 0, 6, 19, 22, 8, 16, 4, 17, 0, 130, 97, 99, 101, 0, 19, 4, 22, 8, 16, 4, 17, 0, 131, 112, 97, 99, 101, 0, 12, 21, 8, 25, 18, 0, 130, 114, 105, 100, 101, 0, 23, 0, 68, 25, 1, 17, 36, 1, 0, 21, 4, 24, 10, 0, 130, 110, 116, 101, 101, 0, 4, 21, 24, 4, 10, 0, 135, 117, 97, 114, 97, 110, 116, 101, 101, 0, 68, 59, 1, 7, 69, 1, 0, 24, 10, 44, 0, 131, 97, 117, 103, 101, 0, 8, 15, 12, 25, 12, 21, 19, 0, 130, 103, 101, 0, 22, 4, 9, 0, 130, 108, 115, 101, 0, 76, 97, 1, 24, 109, 1, 0, 24, 20, 4, 0, 132, 99, 113, 117, 105, 114, 101, 0, 23, 44, 0, + 130, 114, 117, 101, 0, 4, 0, 79, 126, 1, 24, 134, 1, 0, 9, 0, 131, 97, 108, 115, 101, 0, 6, 8, 5, 0, 131, 97, 117, 115, 101, 0, 4, 0, 71, 156, 1, 19, 193, 1, 21, 203, 1, 0, 18, 16, 0, 80, 166, 1, 18, 181, 1, 0, 18, 6, 4, 0, 135, 99, 111, 109, 109, 111, 100, 97, 116, 101, 0, 6, 6, 4, 0, 132, 109, 111, 100, 97, 116, 101, 0, 7, 24, 0, 132, 112, 100, 97, 116, 101, 0, 8, 19, 8, 22, 0, 132, 97, 114, 97, 116, 101, 0, 10, 8, 15, 15, 18, 6, 0, 130, 97, 103, 117, 101, 0, 8, 12, 6, 8, 21, 0, 131, 101, 105, 118, 101, 0, 12, 8, 11, 6, 0, 130, 105, 101, 102, 0, 17, 0, 76, 3, 2, 21, 16, 2, 0, 15, 8, 12, 6, 0, 133, 101, 105, 108, 105, 110, 103, 0, 12, 23, 22, 0, 131, 114, 105, 110, 103, 0, 70, 33, 2, 23, 44, 2, 0, 12, 23, 26, 22, 0, 131, 105, + 116, 99, 104, 0, 10, 12, 8, 11, 0, 129, 104, 116, 0, 72, 69, 2, 10, 80, 2, 18, 89, 2, 21, 156, 2, 24, 167, 2, 0, 22, 18, 18, 11, 6, 0, 131, 115, 101, 110, 0, 12, 21, 23, 22, 0, 129, 110, 103, 0, 12, 0, 86, 98, 2, 23, 124, 2, 0, 68, 105, 2, 22, 114, 2, 0, 12, 15, 0, 131, 105, 115, 111, 110, 0, 4, 6, 6, 18, 0, 131, 105, 111, 110, 0, 76, 131, 2, 22, 146, 2, 0, 23, 12, 19, 8, 21, 0, 134, 101, 116, 105, 116, 105, 111, 110, 0, 18, 19, 0, 131, 105, 116, 105, 111, 110, 0, 23, 24, 8, 21, 0, 131, 116, 117, 114, 110, 0, 85, 174, 2, 23, 183, 2, 0, 23, 8, 21, 0, 130, 117, 114, 110, 0, 8, 21, 0, 128, 114, 110, 0, 7, 8, 24, 22, 19, 0, 131, 101, 117, 100, 111, 0, 24, 18, 18, 15, 0, 129, 107, 117, 112, 0, 72, 219, 2, 18, 3, 3, 0, 76, 229, 2, 15, 238, + 2, 17, 248, 2, 0, 11, 23, 44, 0, 130, 101, 105, 114, 0, 23, 12, 9, 0, 131, 108, 116, 101, 114, 0, 23, 22, 12, 15, 0, 130, 101, 110, 101, 114, 0, 23, 4, 21, 8, 23, 17, 12, 0, 135, 116, 101, 114, 97, 116, 111, 114, 0, 72, 30, 3, 17, 38, 3, 24, 51, 3, 0, 15, 4, 9, 0, 129, 115, 101, 0, 4, 12, 23, 17, 18, 6, 0, 131, 97, 105, 110, 115, 0, 22, 17, 8, 6, 17, 18, 6, 0, 133, 115, 101, 110, 115, 117, 115, 0, 74, 86, 3, 11, 96, 3, 15, 118, 3, 17, 129, 3, 22, 218, 3, 24, 232, 3, 0, 11, 24, 4, 6, 0, 130, 103, 104, 116, 0, 71, 103, 3, 10, 110, 3, 0, 12, 26, 0, 129, 116, 104, 0, 17, 8, 15, 0, 129, 116, 104, 0, 22, 24, 8, 21, 0, 131, 115, 117, 108, 116, 0, 68, 139, 3, 8, 150, 3, 22, 210, 3, 0, 21, 4, 19, 19, 4, 0, 130, 101, 110, 116, 0, 85, 157, + 3, 25, 200, 3, 0, 68, 164, 3, 21, 175, 3, 0, 19, 4, 0, 132, 112, 97, 114, 101, 110, 116, 0, 4, 19, 0, 68, 185, 3, 19, 193, 3, 0, 133, 112, 97, 114, 101, 110, 116, 0, 4, 0, 131, 101, 110, 116, 0, 8, 15, 8, 21, 0, 130, 97, 110, 116, 0, 18, 6, 0, 130, 110, 115, 116, 0, 12, 9, 8, 17, 4, 16, 0, 132, 105, 102, 101, 115, 116, 0, 83, 239, 3, 23, 6, 4, 0, 87, 246, 3, 24, 254, 3, 0, 17, 12, 0, 131, 112, 117, 116, 0, 18, 0, 130, 116, 112, 117, 116, 0, 19, 24, 18, 0, 131, 116, 112, 117, 116, 0, 70, 29, 4, 8, 41, 4, 11, 51, 4, 21, 69, 4, 0, 8, 24, 20, 8, 21, 9, 0, 129, 110, 99, 121, 0, 23, 9, 4, 22, 0, 130, 101, 116, 121, 0, 6, 21, 4, 21, 12, 8, 11, 0, 135, 105, 101, 114, 97, 114, 99, 104, 121, 0, 4, 5, 12, 15, 0, 130, 114, 97, 114, 121, 0}; #endif diff --git a/users/drashna/callbacks.c b/users/drashna/callbacks.c index f9a3f598d3..111b5f79d7 100644 --- a/users/drashna/callbacks.c +++ b/users/drashna/callbacks.c @@ -3,6 +3,12 @@ #include "drashna.h" + +#ifdef I2C_SCANNER_ENABLE +void matrix_scan_i2c(void); +void keyboard_post_init_i2c(void); +#endif + __attribute__((weak)) void keyboard_pre_init_keymap(void) {} void keyboard_pre_init_user(void) { userspace_config.raw = eeconfig_read_user(); @@ -42,6 +48,10 @@ void keyboard_post_init_user(void) { #if defined(SPLIT_KEYBOARD) && defined(SPLIT_TRANSACTION_IDS_USER) keyboard_post_init_transport_sync(); #endif +#ifdef I2C_SCANNER_ENABLE + matrix_scan_i2c(); +#endif + keyboard_post_init_keymap(); } @@ -54,10 +64,10 @@ void shutdown_user(void) { #ifdef RGBLIGHT_ENABLE rgblight_enable_noeeprom(); rgblight_mode_noeeprom(1); - rgblight_setrgb_red(); + rgblight_setrgb(rgblight_get_val(), 0x00, 0x00); #endif // RGBLIGHT_ENABLE #ifdef RGB_MATRIX_ENABLE - rgb_matrix_set_color_all(0xFF, 0x00, 0x00); + rgb_matrix_set_color_all(rgb_matrix_get_val(), 0x00, 0x00); rgb_matrix_update_pwm_buffers(); #endif // RGB_MATRIX_ENABLE #ifdef OLED_ENABLE @@ -113,6 +123,12 @@ void matrix_scan_user(void) { #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_secret(); matrix_scan_keymap(); diff --git a/users/drashna/config.h b/users/drashna/config.h index fd1530a100..57b26786b3 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -11,26 +11,20 @@ #endif #define IS_COMMAND() (((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) -/* Set Polling rate to 1000Hz */ -#define USB_POLLING_INTERVAL_MS 1 #if defined(SPLIT_KEYBOARD) -// # define SPLIT_TRANSPORT_MIRROR -# define SPLIT_LAYER_STATE_ENABLE -# define SPLIT_LED_STATE_ENABLE -# define SPLIT_MODS_ENABLE -# ifdef WPM_ENABLE -# define SPLIT_WPM_ENABLE -# endif -# ifdef OLED_ENABLE -# define SPLIT_OLED_ENABLE -# endif -# if defined(__AVR__) && !defined(SELECT_SOFT_SERIAL_SPEED) -# define SELECT_SOFT_SERIAL_SPEED 1 -# endif -# ifdef CUSTOM_SPLIT_TRANSPORT_SYNC -# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC, RPC_ID_USER_WATCHDOG_SYNC, RPC_ID_USER_KEYLOG_STR -# endif +# include "split/split_config.h" +#endif +#ifdef RGBLIGHT_ENABLE +# include "rgb/rgblight_config.h" +#endif // RGBLIGHT_ENABLE + +#ifdef RGB_MATRIX_ENABLE +# include "rgb/rgb_matrix_config.h" +#endif // RGB_MATRIX_ENABLE + +#ifdef OLED_ENABLE +# include "oled/oled_config.h" #endif #if defined(WPM_ENABLE) @@ -71,157 +65,6 @@ #define UNICODE_SELECTED_MODES UC_WINC, UC_MAC -#ifdef RGBLIGHT_ENABLE -# define RGBLIGHT_SLEEP -# define RGBLIGHT_EFFECT_TWINKLE_LIFE 250 -# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 24 -#endif // RGBLIGHT_ENABLE - -#ifdef RGB_MATRIX_ENABLE -# define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) -// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) -# define RGB_MATRIX_FRAMEBUFFER_EFFECTS -// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects -// # define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended - -# undef ENABLE_RGB_MATRIX_ALPHAS_MODS -# undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -# undef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -# undef ENABLE_RGB_MATRIX_BREATHING -# undef ENABLE_RGB_MATRIX_BAND_SAT -# undef ENABLE_RGB_MATRIX_BAND_VAL -# undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -# undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -# undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -# undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -# undef ENABLE_RGB_MATRIX_CYCLE_ALL -# undef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -# undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN -# undef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -# undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN -# undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -# undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL -# undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL -# undef ENABLE_RGB_MATRIX_DUAL_BEACON -# undef ENABLE_RGB_MATRIX_RAINBOW_BEACON -# undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS -# undef ENABLE_RGB_MATRIX_RAINDROPS -# undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -# undef ENABLE_RGB_MATRIX_HUE_BREATHING -# undef ENABLE_RGB_MATRIX_HUE_PENDULUM -# undef ENABLE_RGB_MATRIX_HUE_WAVE -# undef ENABLE_RGB_MATRIX_PIXEL_RAIN -# undef ENABLE_RGB_MATRIX_PIXEL_FLOW -# undef ENABLE_RGB_MATRIX_PIXEL_FRACTAL -// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined -# undef ENABLE_RGB_MATRIX_TYPING_HEATMAP -# undef ENABLE_RGB_MATRIX_DIGITAL_RAIN -// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -# undef ENABLE_RGB_MATRIX_SPLASH -# undef ENABLE_RGB_MATRIX_MULTISPLASH -# undef ENABLE_RGB_MATRIX_SOLID_SPLASH -# undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH - -# define ENABLE_RGB_MATRIX_TYPING_HEATMAP -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -# if !defined(SPLIT_KEYBOARD) && !defined(KEYBOARD_ergodox_ez) && !defined(KEYBOARD_moonlander) -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN -# endif -# if defined(__arm__) || defined(__AVR_AT90USB1286__) || defined(KEYBOARD_launchpad) -// RGB Matrix Animation modes. Explicitly enabled -// For full list of effects, see: -// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects -# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_BREATHING -# define ENABLE_RGB_MATRIX_BAND_SAT -# define ENABLE_RGB_MATRIX_BAND_VAL -# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -# define ENABLE_RGB_MATRIX_CYCLE_ALL -# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN -# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN -# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL -# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL -# define ENABLE_RGB_MATRIX_DUAL_BEACON -# define ENABLE_RGB_MATRIX_RAINBOW_BEACON -# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS -# define ENABLE_RGB_MATRIX_RAINDROPS -# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -# define ENABLE_RGB_MATRIX_HUE_BREATHING -# define ENABLE_RGB_MATRIX_HUE_PENDULUM -# define ENABLE_RGB_MATRIX_HUE_WAVE -# define ENABLE_RGB_MATRIX_PIXEL_RAIN -# define ENABLE_RGB_MATRIX_PIXEL_FLOW -# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL -# define ENABLE_RGB_MATRIX_DIGITAL_RAIN -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -# define ENABLE_RGB_MATRIX_SPLASH -# define ENABLE_RGB_MATRIX_MULTISPLASH -# define ENABLE_RGB_MATRIX_SOLID_SPLASH -# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH -# endif // AVR -#endif // RGB_MATRIX_ENABLE - -#ifdef OLED_ENABLE -# ifndef OLED_UPDATE_INTERVAL -# ifdef OLED_DRIVER_SH1107 -# define OLED_UPDATE_INTERVAL 75 -# else -# ifdef SPLIT_KEYBOARD -# define OLED_UPDATE_INTERVAL 60 -# else -# define OLED_UPDATE_INTERVAL 15 -# endif -# endif -# endif -# define OLED_DISABLE_TIMEOUT -# ifdef OLED_FONT_H -# undef OLED_FONT_H -# endif -# define OLED_FONT_H "oled/drashna_font.h" -# define OLED_FONT_END 255 -// # define OLED_FONT_5X5 -// # define OLED_FONT_AZTECH -// # define OLED_FONT_BMPLAIN -// # define OLED_FONT_CRACKERS -# define OLED_FONT_DEAD_MEAL -// # define OLED_FONT_EIN -// # define OLED_FONT_HISKYF21 -// # define OLED_FONT_SQUASH -// # define OLED_FONT_ZXPIX -// # define OLED_FONT_SUPER_DIGG - -// # define OLED_LOGO_BEBOP -// # define OLED_LOGO_CORNE -// # define OLED_LOGO_GMK_BAD -// # define OLED_LOGO_GOTHAM -// # define OLED_LOGO_HUE_MANITEE -// # define OLED_LOGO_LOOSE -# define OLED_LOGO_SCIFI -// # define OLED_LOGO_SETS3N -// # define OLED_LOGO_SKEEB -#endif - // #define WPM_ESTIMATED_WORD_SIZE 5 #define WPM_ALLOW_COUNT_REGRESSION // #define WPM_UNFILTERED @@ -237,11 +80,18 @@ # define ONESHOT_TIMEOUT 3000 #endif // !ONESHOT_TIMEOUT -#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY -#define PERMISSIVE_HOLD_PER_KEY -#define TAPPING_FORCE_HOLD_PER_KEY -#define RETRO_TAPPING_PER_KEY -#define TAPPING_TERM_PER_KEY +#if defined(PER_KEY_TAPPING) +# define IGNORE_MOD_TAP_INTERRUPT_PER_KEY +# define PERMISSIVE_HOLD_PER_KEY +# define TAPPING_FORCE_HOLD_PER_KEY +# define HOLD_ON_OTHER_KEY +# define RETRO_TAPPING_PER_KEY +# define HOLD_ON_OTHER_KEY_PRESS_PER_KEY +# define TAPPING_TERM_PER_KEY +#else +# define IGNORE_MOD_TAP_INTERRUPT +# undef PERMISSIVE_HOLD +#endif #ifndef TAPPING_TOGGLE # define TAPPING_TOGGLE 1 @@ -276,41 +126,7 @@ # define C15 PAL_LINE(GPIOC, 15) #endif -#ifdef OLED_DRIVER_SH1107 -# define OLED_DISPLAY_CUSTOM -# define OLED_IC_SH1107 2 -# define OLED_DISPLAY_128X128 -# define OLED_DISPLAY_WIDTH 128 -# define OLED_DISPLAY_HEIGHT 128 -# define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) -# define OLED_BLOCK_TYPE uint32_t -# define OLED_SOURCE_MAP \ - { 0, 8, 16, 24, 32, 40, 48, 56 } -# define OLED_TARGET_MAP \ - { 56, 48, 40, 32, 24, 16, 8, 0 } -# define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) -# define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) -# define OLED_COM_PINS COM_PINS_ALT -# define OLED_IC OLED_IC_SH1107 -# ifndef OLED_BRIGHTNESS -# define OLED_BRIGHTNESS 50 -# endif -#endif - -#ifdef USE_I2CV1 -# define I2C1_CLOCK_SPEED 400000 -# define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 -#endif #define ENABLE_COMPILE_KEYCODE #define BOTH_SHIFTS_TURNS_ON_CAPS_WORD - -#ifndef SECURE_UNLOCK_SEQUENCE -# define SECURE_UNLOCK_SEQUENCE \ - { \ - {2, 1}, {2, 2}, {2, 3}, { \ - 2, 4 \ - } \ - } -#endif diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 6e8d4ac9bd..85f47c8cb4 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -76,49 +76,110 @@ void tap_code16_nomods(uint16_t kc) { set_mods(temp_mod); } -/** - * @brief Run shutdown routine and soft reboot firmware. - * - */ - -#ifdef HAPTIC_ENABLE -# include "haptic.h" -#endif +#ifdef I2C_SCANNER_ENABLE +# include "i2c_master.h" +# include "debug.h" -#ifdef AUDIO_ENABLE -# ifndef GOODBYE_SONG -# define GOODBYE_SONG SONG(GOODBYE_SOUND) +# ifndef I2C_SCANNER_TIMEOUT +# define I2C_SCANNER_TIMEOUT 50 # endif -float reset_song[][2] = GOODBYE_SONG; -#endif -void software_reset(void) { - clear_keyboard(); -#if defined(MIDI_ENABLE) && defined(MIDI_BASIC) - process_midi_all_notes_off(); +i2c_status_t i2c_start_bodge(uint8_t address, uint16_t timeout) { + i2c_start(address); + + // except on ChibiOS where the only way is do do "something" + uint8_t data = 0; + return i2c_readReg(address, 0, &data, sizeof(data), I2C_SCANNER_TIMEOUT); +} + +# define i2c_start i2c_start_bodge + +void do_scan(void) { + uint8_t nDevices = 0; + + dprintf("Scanning...\n"); + + for (uint8_t address = 1; address < 127; address++) { + // The i2c_scanner uses the return value of + // i2c_start to see if a device did acknowledge to the address. + i2c_status_t error = i2c_start(address << 1, I2C_SCANNER_TIMEOUT); + if (error == I2C_STATUS_SUCCESS) { + i2c_stop(); + xprintf(" I2C device found at address 0x%02X\n", I2C_SCANNER_TIMEOUT); + nDevices++; + } else { + // dprintf(" Unknown error (%u) at address 0x%02X\n", error, address); + } + } + + if (nDevices == 0) + xprintf("No I2C devices found\n"); + else + xprintf("done\n"); +} + +uint16_t scan_timer = 0; + +void matrix_scan_i2c(void) { + if (timer_elapsed(scan_timer) > 5000) { + do_scan(); + scan_timer = timer_read(); + } +} + +void keyboard_post_init_i2c(void) { + i2c_init(); + scan_timer = timer_read(); +} #endif -#ifdef AUDIO_ENABLE -# ifndef NO_MUSIC_MODE - music_all_notes_off(); -# endif - uint16_t timer_start = timer_read(); - PLAY_SONG(reset_song); - shutdown_user(); - while (timer_elapsed(timer_start) < 250) wait_ms(1); - stop_all_notes(); + +void bootmagic_lite(void) { + bool perform_reset = false; + // We need multiple scans because debouncing can't be turned off. + matrix_scan(); +#if defined(DEBOUNCE) && DEBOUNCE > 0 + wait_ms(DEBOUNCE * 2); #else - shutdown_user(); - wait_ms(250); + wait_ms(30); #endif -#ifdef HAPTIC_ENABLE - haptic_shutdown(); + matrix_scan(); + + // If the configured key (commonly Esc) is held down on power up, + // reset the EEPROM valid state and jump to bootloader. + // This isn't very generalized, but we need something that doesn't + // rely on user's keymaps in firmware or EEPROM. + uint8_t row = BOOTMAGIC_LITE_ROW, col = BOOTMAGIC_LITE_COLUMN; +#if defined(BOOTMAGIC_LITE_EEPROM_ROW) && defined(BOOTMAGIC_LITE_EEPROM_COLUMN) + uint8_t row_e = BOOTMAGIC_LITE_EEPROM_ROW, col_e = BOOTMAGIC_LITE_EEPROM_COLUMN; #endif -#if defined(PROTOCOL_LUFA) - wdt_enable(WDTO_250MS); -#elif defined(PROTOCOL_CHIBIOS) -# if defined(MCU_STM32) || defined(MCU_KINETIS) - NVIC_SystemReset(); +#if defined(SPLIT_KEYBOARD) && defined(BOOTMAGIC_LITE_ROW_RIGHT) && defined(BOOTMAGIC_LITE_COLUMN_RIGHT) + if (!is_keyboard_left()) { + row = BOOTMAGIC_LITE_ROW_RIGHT; + col = BOOTMAGIC_LITE_COLUMN_RIGHT; +#if defined(BOOTMAGIC_LITE_EEPROM_ROW) && defined(BOOTMAGIC_LITE_EEPROM_COLUMN) && defined(BOOTMAGIC_LITE_EEPROM_ROW_RIGHT) && defined(BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT) + row_e = BOOTMAGIC_LITE_EEPROM_ROW_RIGHT; + col_e = BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT; # endif + } #endif + +#if defined(BOOTMAGIC_LITE_EEPROM_ROW) && defined(BOOTMAGIC_LITE_EEPROM_COLUMN) + if (matrix_get_row(row_e) & (1 << col_e)) { + eeconfig_disable(); + perform_reset = true; + } +#endif + if (matrix_get_row(row) & (1 << col)) { + perform_reset = true; + } +#ifdef STM32F411xE + if (!readPin(A0)) { + perform_reset = true; + } +#endif + + if (perform_reset) { + bootloader_jump(); + } } diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 0bf1de84cf..16d7cda638 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -79,7 +79,6 @@ bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed); bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); bool hasAllBitsInMask(uint8_t value, uint8_t mask); void tap_code16_nomods(uint16_t kc); -void software_reset(void); // clang-format off typedef union { diff --git a/users/drashna/keyrecords/autocorrection/autocorrection_data.h b/users/drashna/keyrecords/autocorrection/autocorrection_data.h new file mode 100644 index 0000000000..90484d3b12 --- /dev/null +++ b/users/drashna/keyrecords/autocorrection/autocorrection_data.h @@ -0,0 +1 @@ +#include "autocorrect_data.h" diff --git a/users/drashna/keyrecords/process_records.c b/users/drashna/keyrecords/process_records.c index c328451b75..197fd94171 100644 --- a/users/drashna/keyrecords/process_records.c +++ b/users/drashna/keyrecords/process_records.c @@ -6,9 +6,6 @@ #ifdef AUTOCORRECTION_ENABLE # include "autocorrection/autocorrection.h" #endif -#ifdef __AVR__ -# include <avr/wdt.h> -#endif uint16_t copy_paste_timer; bool host_driver_disabled = false; @@ -49,7 +46,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #endif // If console is enabled, it will print the matrix position and status of each key pressed #ifdef KEYLOGGER_ENABLE - uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); + uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %1d, time: %5u, int: %1d, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); #endif // KEYLOGGER_ENABLE #if defined(OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER) process_record_user_oled(keycode, record); diff --git a/users/drashna/keyrecords/tapping.c b/users/drashna/keyrecords/tapping.c index daba25bd72..7496610c2f 100644 --- a/users/drashna/keyrecords/tapping.c +++ b/users/drashna/keyrecords/tapping.c @@ -3,6 +3,7 @@ #include "drashna.h" +#ifdef TAPPING_TERM_PER_KEY __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case BK_LWER: @@ -11,7 +12,9 @@ __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *r return TAPPING_TERM; } } +#endif // TAPPING_TERM_PER_KEY +#ifdef PERMISSIVE_HOLD_PER_KEY __attribute__((weak)) bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) { // Immediately select the hold action when another key is tapped: // return true; @@ -22,7 +25,9 @@ __attribute__((weak)) bool get_permissive_hold(uint16_t keycode, keyrecord_t *re return false; } } +#endif // PERMISSIVE_HOLD_PER_KEY +#ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY __attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) { // Immediately select the hold action when another key is pressed. // return true; @@ -32,10 +37,12 @@ __attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyreco // case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: // return true; default: - return true; + return false; } } +#endif // HOLD_ON_OTHER_KEY_PRESS_PER_KEY +#ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY __attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { // Do not force the mod-tap key press to be handled as a modifier // if any other key was pressed while the mod-tap key is held down. @@ -48,17 +55,22 @@ __attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrec return true; } } +#endif // IGNORE_MOD_TAP_INTERRUPT_PER_KEY +#ifdef TAPPING_FORCE_HOLD_PER_KEY __attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { switch (keycode) { default: return false; } } +#endif // TAPPING_FORCE_HOLD_PER_KEY +#ifdef RETRO_TAPPING_PER_KEY __attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) { switch (keycode) { default: return false; } } +#endif // RETRO_TAPPING_PER_KEY diff --git a/users/drashna/keyrecords/unicode.c b/users/drashna/keyrecords/unicode.c index ea51b26061..b3fc71cb09 100644 --- a/users/drashna/keyrecords/unicode.c +++ b/users/drashna/keyrecords/unicode.c @@ -142,7 +142,7 @@ DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_super, 0x2071, // i 0x02B2, // j 0x1D4F, // k - 0x1D4F, // l + 0x02E1, // l 0x1D50, // m 0x207F, // n 0x1D52, // o diff --git a/users/drashna/oled/oled_config.h b/users/drashna/oled/oled_config.h new file mode 100644 index 0000000000..c46c0c39ce --- /dev/null +++ b/users/drashna/oled/oled_config.h @@ -0,0 +1,63 @@ +// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#ifndef OLED_UPDATE_INTERVAL +# ifdef OLED_DRIVER_SH1107 +# define OLED_UPDATE_INTERVAL 75 +# else +# ifdef SPLIT_KEYBOARD +# define OLED_UPDATE_INTERVAL 60 +# else +# define OLED_UPDATE_INTERVAL 15 +# endif +# endif +#endif +#define OLED_DISABLE_TIMEOUT +#ifdef OLED_FONT_H +# undef OLED_FONT_H +#endif +#define OLED_FONT_H "oled/drashna_font.h" +#define OLED_FONT_END 255 +// # define OLED_FONT_5X5 +// # define OLED_FONT_AZTECH +// # define OLED_FONT_BMPLAIN +// # define OLED_FONT_CRACKERS +#define OLED_FONT_DEAD_MEAL +// # define OLED_FONT_EIN +// # define OLED_FONT_HISKYF21 +// # define OLED_FONT_SQUASH +// # define OLED_FONT_ZXPIX +// # define OLED_FONT_SUPER_DIGG + +// # define OLED_LOGO_BEBOP +// # define OLED_LOGO_CORNE +// # define OLED_LOGO_GMK_BAD +// # define OLED_LOGO_GOTHAM +// # define OLED_LOGO_HUE_MANITEE +// # define OLED_LOGO_LOOSE +#define OLED_LOGO_SCIFI +// # define OLED_LOGO_SETS3N +// # define OLED_LOGO_SKEEB + +#ifdef OLED_DRIVER_SH1107 +# define OLED_DISPLAY_CUSTOM +# define OLED_IC_SH1107 2 +# define OLED_DISPLAY_128X128 +# define OLED_DISPLAY_WIDTH 128 +# define OLED_DISPLAY_HEIGHT 128 +# define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) +# define OLED_BLOCK_TYPE uint32_t +# define OLED_SOURCE_MAP \ + { 0, 8, 16, 24, 32, 40, 48, 56 } +# define OLED_TARGET_MAP \ + { 56, 48, 40, 32, 24, 16, 8, 0 } +# define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) +# define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) +# define OLED_COM_PINS COM_PINS_ALT +# define OLED_IC OLED_IC_SH1107 +# ifndef OLED_BRIGHTNESS +# define OLED_BRIGHTNESS 50 +# endif +#endif |