diff options
22 files changed, 175 insertions, 520 deletions
diff --git a/keyboards/massdrop/alt/alt.h b/keyboards/massdrop/alt/alt.h index 387985512..8dfed8d2d 100644 --- a/keyboards/massdrop/alt/alt.h +++ b/keyboards/massdrop/alt/alt.h | |||
| @@ -22,3 +22,13 @@ | |||
| 22 | { K45, KC_NO, K46, K47, K48, K49, K50, K51, K52, K53, K54, K55, K56, K57, K58, }, \ | 22 | { K45, KC_NO, K46, K47, K48, K49, K50, K51, K52, K53, K54, K55, K56, K57, K58, }, \ |
| 23 | { K59, K60, K61, KC_NO, KC_NO, KC_NO, K62, KC_NO, KC_NO, KC_NO, K63, K64, K65, K66, K67, }, \ | 23 | { K59, K60, K61, KC_NO, KC_NO, KC_NO, K62, KC_NO, KC_NO, KC_NO, K63, K64, K65, K66, K67, }, \ |
| 24 | } | 24 | } |
| 25 | |||
| 26 | #define TOGGLE_FLAG_AND_PRINT(var, name) { \ | ||
| 27 | if (var) { \ | ||
| 28 | dprintf(name " disabled\r\n"); \ | ||
| 29 | var = !var; \ | ||
| 30 | } else { \ | ||
| 31 | var = !var; \ | ||
| 32 | dprintf(name " enabled\r\n"); \ | ||
| 33 | } \ | ||
| 34 | } | ||
diff --git a/keyboards/massdrop/alt/keymaps/default/keymap.c b/keyboards/massdrop/alt/keymaps/default/keymap.c index 0cbce8629..a5c443ffc 100644 --- a/keyboards/massdrop/alt/keymaps/default/keymap.c +++ b/keyboards/massdrop/alt/keymaps/default/keymap.c | |||
| @@ -136,8 +136,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 136 | case L_T_BR: | 136 | case L_T_BR: |
| 137 | if (record->event.pressed) { | 137 | if (record->event.pressed) { |
| 138 | led_animation_breathing = !led_animation_breathing; | 138 | led_animation_breathing = !led_animation_breathing; |
| 139 | if (led_animation_breathing) | 139 | if (led_animation_breathing) { |
| 140 | { | ||
| 141 | gcr_breathe = gcr_desired; | 140 | gcr_breathe = gcr_desired; |
| 142 | led_animation_breathe_cur = BREATHE_MIN_STEP; | 141 | led_animation_breathe_cur = BREATHE_MIN_STEP; |
| 143 | breathe_dir = 1; | 142 | breathe_dir = 1; |
| @@ -151,50 +150,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 151 | return false; | 150 | return false; |
| 152 | case U_T_AUTO: | 151 | case U_T_AUTO: |
| 153 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { | 152 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { |
| 154 | usb_extra_manual = !usb_extra_manual; | 153 | TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); |
| 155 | CDC_print("USB extra port manual mode "); | ||
| 156 | CDC_print(usb_extra_manual ? "enabled" : "disabled"); | ||
| 157 | CDC_print("\r\n"); | ||
| 158 | } | 154 | } |
| 159 | return false; | 155 | return false; |
| 160 | case U_T_AGCR: | 156 | case U_T_AGCR: |
| 161 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { | 157 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { |
| 162 | usb_gcr_auto = !usb_gcr_auto; | 158 | TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode"); |
| 163 | CDC_print("USB GCR auto mode "); | ||
| 164 | CDC_print(usb_gcr_auto ? "enabled" : "disabled"); | ||
| 165 | CDC_print("\r\n"); | ||
| 166 | } | 159 | } |
| 167 | return false; | 160 | return false; |
| 168 | case DBG_TOG: | 161 | case DBG_TOG: |
| 169 | if (record->event.pressed) { | 162 | if (record->event.pressed) { |
| 170 | debug_enable = !debug_enable; | 163 | TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode"); |
| 171 | CDC_print("Debug mode "); | ||
| 172 | CDC_print(debug_enable ? "enabled" : "disabled"); | ||
| 173 | CDC_print("\r\n"); | ||
| 174 | } | 164 | } |
| 175 | return false; | 165 | return false; |
| 176 | case DBG_MTRX: | 166 | case DBG_MTRX: |
| 177 | if (record->event.pressed) { | 167 | if (record->event.pressed) { |
| 178 | debug_matrix = !debug_matrix; | 168 | TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix"); |
| 179 | CDC_print("Debug matrix "); | ||
| 180 | CDC_print(debug_matrix ? "enabled" : "disabled"); | ||
| 181 | CDC_print("\r\n"); | ||
| 182 | } | 169 | } |
| 183 | return false; | 170 | return false; |
| 184 | case DBG_KBD: | 171 | case DBG_KBD: |
| 185 | if (record->event.pressed) { | 172 | if (record->event.pressed) { |
| 186 | debug_keyboard = !debug_keyboard; | 173 | TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard"); |
| 187 | CDC_print("Debug keyboard "); | ||
| 188 | CDC_print(debug_keyboard ? "enabled" : "disabled"); | ||
| 189 | CDC_print("\r\n"); | ||
| 190 | } | 174 | } |
| 191 | return false; | 175 | return false; |
| 192 | case DBG_MOU: | 176 | case DBG_MOU: |
| 193 | if (record->event.pressed) { | 177 | if (record->event.pressed) { |
| 194 | debug_mouse = !debug_mouse; | 178 | TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); |
| 195 | CDC_print("Debug mouse "); | ||
| 196 | CDC_print(debug_mouse ? "enabled" : "disabled"); | ||
| 197 | CDC_print("\r\n"); | ||
| 198 | } | 179 | } |
| 199 | return false; | 180 | return false; |
| 200 | case MD_BOOT: | 181 | case MD_BOOT: |
| @@ -209,4 +190,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 209 | default: | 190 | default: |
| 210 | return true; //Process all other keycodes normally | 191 | return true; //Process all other keycodes normally |
| 211 | } | 192 | } |
| 212 | } \ No newline at end of file | 193 | } |
diff --git a/keyboards/massdrop/alt/keymaps/mac/keymap.c b/keyboards/massdrop/alt/keymaps/mac/keymap.c index e886290e7..d6978fd80 100644 --- a/keyboards/massdrop/alt/keymaps/mac/keymap.c +++ b/keyboards/massdrop/alt/keymaps/mac/keymap.c | |||
| @@ -136,8 +136,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 136 | case L_T_BR: | 136 | case L_T_BR: |
| 137 | if (record->event.pressed) { | 137 | if (record->event.pressed) { |
| 138 | led_animation_breathing = !led_animation_breathing; | 138 | led_animation_breathing = !led_animation_breathing; |
| 139 | if (led_animation_breathing) | 139 | if (led_animation_breathing) { |
| 140 | { | ||
| 141 | gcr_breathe = gcr_desired; | 140 | gcr_breathe = gcr_desired; |
| 142 | led_animation_breathe_cur = BREATHE_MIN_STEP; | 141 | led_animation_breathe_cur = BREATHE_MIN_STEP; |
| 143 | breathe_dir = 1; | 142 | breathe_dir = 1; |
| @@ -151,50 +150,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 151 | return false; | 150 | return false; |
| 152 | case U_T_AUTO: | 151 | case U_T_AUTO: |
| 153 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { | 152 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { |
| 154 | usb_extra_manual = !usb_extra_manual; | 153 | TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); |
| 155 | CDC_print("USB extra port manual mode "); | ||
| 156 | CDC_print(usb_extra_manual ? "enabled" : "disabled"); | ||
| 157 | CDC_print("\r\n"); | ||
| 158 | } | 154 | } |
| 159 | return false; | 155 | return false; |
| 160 | case U_T_AGCR: | 156 | case U_T_AGCR: |
| 161 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { | 157 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { |
| 162 | usb_gcr_auto = !usb_gcr_auto; | 158 | TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode"); |
| 163 | CDC_print("USB GCR auto mode "); | ||
| 164 | CDC_print(usb_gcr_auto ? "enabled" : "disabled"); | ||
| 165 | CDC_print("\r\n"); | ||
| 166 | } | 159 | } |
| 167 | return false; | 160 | return false; |
| 168 | case DBG_TOG: | 161 | case DBG_TOG: |
| 169 | if (record->event.pressed) { | 162 | if (record->event.pressed) { |
| 170 | debug_enable = !debug_enable; | 163 | TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode"); |
| 171 | CDC_print("Debug mode "); | ||
| 172 | CDC_print(debug_enable ? "enabled" : "disabled"); | ||
| 173 | CDC_print("\r\n"); | ||
| 174 | } | 164 | } |
| 175 | return false; | 165 | return false; |
| 176 | case DBG_MTRX: | 166 | case DBG_MTRX: |
| 177 | if (record->event.pressed) { | 167 | if (record->event.pressed) { |
| 178 | debug_matrix = !debug_matrix; | 168 | TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix"); |
| 179 | CDC_print("Debug matrix "); | ||
| 180 | CDC_print(debug_matrix ? "enabled" : "disabled"); | ||
| 181 | CDC_print("\r\n"); | ||
| 182 | } | 169 | } |
| 183 | return false; | 170 | return false; |
| 184 | case DBG_KBD: | 171 | case DBG_KBD: |
| 185 | if (record->event.pressed) { | 172 | if (record->event.pressed) { |
| 186 | debug_keyboard = !debug_keyboard; | 173 | TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard"); |
| 187 | CDC_print("Debug keyboard "); | ||
| 188 | CDC_print(debug_keyboard ? "enabled" : "disabled"); | ||
| 189 | CDC_print("\r\n"); | ||
| 190 | } | 174 | } |
| 191 | return false; | 175 | return false; |
| 192 | case DBG_MOU: | 176 | case DBG_MOU: |
| 193 | if (record->event.pressed) { | 177 | if (record->event.pressed) { |
| 194 | debug_mouse = !debug_mouse; | 178 | TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); |
| 195 | CDC_print("Debug mouse "); | ||
| 196 | CDC_print(debug_mouse ? "enabled" : "disabled"); | ||
| 197 | CDC_print("\r\n"); | ||
| 198 | } | 179 | } |
| 199 | return false; | 180 | return false; |
| 200 | case MD_BOOT: | 181 | case MD_BOOT: |
diff --git a/keyboards/massdrop/alt/rules.mk b/keyboards/massdrop/alt/rules.mk index daf679585..c5539158f 100644 --- a/keyboards/massdrop/alt/rules.mk +++ b/keyboards/massdrop/alt/rules.mk | |||
| @@ -30,3 +30,4 @@ FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches | |||
| 30 | HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) | 30 | HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) |
| 31 | VIRTSER_ENABLE = no # USB Serial Driver | 31 | VIRTSER_ENABLE = no # USB Serial Driver |
| 32 | RAW_ENABLE = no # Raw device | 32 | RAW_ENABLE = no # Raw device |
| 33 | AUTO_SHIFT_ENABLE = no # Auto Shift | ||
diff --git a/keyboards/massdrop/ctrl/ctrl.h b/keyboards/massdrop/ctrl/ctrl.h index dc7c7eabe..c83efca16 100644 --- a/keyboards/massdrop/ctrl/ctrl.h +++ b/keyboards/massdrop/ctrl/ctrl.h | |||
| @@ -30,3 +30,13 @@ | |||
| 30 | { K59, K60, K61, K62, K63, K76, K50, K33 }, \ | 30 | { K59, K60, K61, K62, K63, K76, K50, K33 }, \ |
| 31 | { K72, K73, K74, K75, K85, K86, K87, }, \ | 31 | { K72, K73, K74, K75, K85, K86, K87, }, \ |
| 32 | } | 32 | } |
| 33 | |||
| 34 | #define TOGGLE_FLAG_AND_PRINT(var, name) { \ | ||
| 35 | if (var) { \ | ||
| 36 | dprintf(name " disabled\r\n"); \ | ||
| 37 | var = !var; \ | ||
| 38 | } else { \ | ||
| 39 | var = !var; \ | ||
| 40 | dprintf(name " enabled\r\n"); \ | ||
| 41 | } \ | ||
| 42 | } | ||
diff --git a/keyboards/massdrop/ctrl/keymaps/default/keymap.c b/keyboards/massdrop/ctrl/keymaps/default/keymap.c index 9bfb7fec5..88c1ac312 100644 --- a/keyboards/massdrop/ctrl/keymaps/default/keymap.c +++ b/keyboards/massdrop/ctrl/keymaps/default/keymap.c | |||
| @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 33 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, \ | 33 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, \ |
| 34 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ | 34 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ |
| 35 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, \ | 35 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, \ |
| 36 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ | 36 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ |
| 37 | ), | 37 | ), |
| 38 | [1] = LAYOUT( | 38 | [1] = LAYOUT( |
| 39 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_TRNS, KC_TRNS, \ | 39 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_TRNS, KC_TRNS, \ |
| @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 41 | L_T_BR, L_PSD, L_BRI, L_PSI, KC_TRNS, KC_TRNS, KC_TRNS, U_T_AUTO,U_T_AGCR,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_VOLD, \ | 41 | L_T_BR, L_PSD, L_BRI, L_PSI, KC_TRNS, KC_TRNS, KC_TRNS, U_T_AUTO,U_T_AGCR,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_VOLD, \ |
| 42 | L_T_PTD, L_PTP, L_BRD, L_PTN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | 42 | L_T_PTD, L_PTP, L_BRD, L_PTN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ |
| 43 | KC_TRNS, L_T_MD, L_T_ONF, KC_TRNS, KC_TRNS, MD_BOOT, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | 43 | KC_TRNS, L_T_MD, L_T_ONF, KC_TRNS, KC_TRNS, MD_BOOT, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ |
| 44 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ | 44 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ |
| 45 | ), | 45 | ), |
| 46 | /* | 46 | /* |
| 47 | [X] = LAYOUT( | 47 | [X] = LAYOUT( |
| @@ -50,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 50 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | 50 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ |
| 51 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | 51 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ |
| 52 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | 52 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ |
| 53 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ | 53 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ |
| 54 | ), | 54 | ), |
| 55 | */ | 55 | */ |
| 56 | }; | 56 | }; |
| @@ -139,8 +139,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 139 | case L_T_BR: | 139 | case L_T_BR: |
| 140 | if (record->event.pressed) { | 140 | if (record->event.pressed) { |
| 141 | led_animation_breathing = !led_animation_breathing; | 141 | led_animation_breathing = !led_animation_breathing; |
| 142 | if (led_animation_breathing) | 142 | if (led_animation_breathing) { |
| 143 | { | ||
| 144 | gcr_breathe = gcr_desired; | 143 | gcr_breathe = gcr_desired; |
| 145 | led_animation_breathe_cur = BREATHE_MIN_STEP; | 144 | led_animation_breathe_cur = BREATHE_MIN_STEP; |
| 146 | breathe_dir = 1; | 145 | breathe_dir = 1; |
| @@ -154,50 +153,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 154 | return false; | 153 | return false; |
| 155 | case U_T_AUTO: | 154 | case U_T_AUTO: |
| 156 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { | 155 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { |
| 157 | usb_extra_manual = !usb_extra_manual; | 156 | TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); |
| 158 | CDC_print("USB extra port manual mode "); | ||
| 159 | CDC_print(usb_extra_manual ? "enabled" : "disabled"); | ||
| 160 | CDC_print("\r\n"); | ||
| 161 | } | 157 | } |
| 162 | return false; | 158 | return false; |
| 163 | case U_T_AGCR: | 159 | case U_T_AGCR: |
| 164 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { | 160 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { |
| 165 | usb_gcr_auto = !usb_gcr_auto; | 161 | TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode"); |
| 166 | CDC_print("USB GCR auto mode "); | ||
| 167 | CDC_print(usb_gcr_auto ? "enabled" : "disabled"); | ||
| 168 | CDC_print("\r\n"); | ||
| 169 | } | 162 | } |
| 170 | return false; | 163 | return false; |
| 171 | case DBG_TOG: | 164 | case DBG_TOG: |
| 172 | if (record->event.pressed) { | 165 | if (record->event.pressed) { |
| 173 | debug_enable = !debug_enable; | 166 | TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode"); |
| 174 | CDC_print("Debug mode "); | ||
| 175 | CDC_print(debug_enable ? "enabled" : "disabled"); | ||
| 176 | CDC_print("\r\n"); | ||
| 177 | } | 167 | } |
| 178 | return false; | 168 | return false; |
| 179 | case DBG_MTRX: | 169 | case DBG_MTRX: |
| 180 | if (record->event.pressed) { | 170 | if (record->event.pressed) { |
| 181 | debug_matrix = !debug_matrix; | 171 | TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix"); |
| 182 | CDC_print("Debug matrix "); | ||
| 183 | CDC_print(debug_matrix ? "enabled" : "disabled"); | ||
| 184 | CDC_print("\r\n"); | ||
| 185 | } | 172 | } |
| 186 | return false; | 173 | return false; |
| 187 | case DBG_KBD: | 174 | case DBG_KBD: |
| 188 | if (record->event.pressed) { | 175 | if (record->event.pressed) { |
| 189 | debug_keyboard = !debug_keyboard; | 176 | TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard"); |
| 190 | CDC_print("Debug keyboard "); | ||
| 191 | CDC_print(debug_keyboard ? "enabled" : "disabled"); | ||
| 192 | CDC_print("\r\n"); | ||
| 193 | } | 177 | } |
| 194 | return false; | 178 | return false; |
| 195 | case DBG_MOU: | 179 | case DBG_MOU: |
| 196 | if (record->event.pressed) { | 180 | if (record->event.pressed) { |
| 197 | debug_mouse = !debug_mouse; | 181 | TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); |
| 198 | CDC_print("Debug mouse "); | ||
| 199 | CDC_print(debug_mouse ? "enabled" : "disabled"); | ||
| 200 | CDC_print("\r\n"); | ||
| 201 | } | 182 | } |
| 202 | return false; | 183 | return false; |
| 203 | case MD_BOOT: | 184 | case MD_BOOT: |
diff --git a/keyboards/massdrop/ctrl/keymaps/mac/keymap.c b/keyboards/massdrop/ctrl/keymaps/mac/keymap.c index a03f891e8..6c5dfe19c 100644 --- a/keyboards/massdrop/ctrl/keymaps/mac/keymap.c +++ b/keyboards/massdrop/ctrl/keymaps/mac/keymap.c | |||
| @@ -33,15 +33,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 33 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, \ | 33 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, \ |
| 34 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ | 34 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ |
| 35 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, \ | 35 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, \ |
| 36 | KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ | 36 | KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ |
| 37 | ), | 37 | ), |
| 38 | [1] = LAYOUT( | 38 | [1] = LAYOUT( |
| 39 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_TRNS, KC_TRNS, \ | 39 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_TRNS, KC_TRNS, \ |
| 40 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_MSTP, KC_VOLU, \ | 40 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_MSTP, KC_VOLU, \ |
| 41 | L_T_BR, L_PSD, L_BRI, L_PSI, KC_TRNS, KC_TRNS, KC_TRNS, U_T_AUTO,U_T_AGCR,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_VOLD, \ | 41 | L_T_BR, L_PSD, L_BRI, L_PSI, KC_TRNS, KC_TRNS, KC_TRNS, U_T_AUTO,U_T_AGCR,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_VOLD, \ |
| 42 | L_T_PTD, L_PTP, L_BRD, L_PTN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | 42 | L_T_PTD, L_PTP, L_BRD, L_PTN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ |
| 43 | KC_TRNS, L_T_MD, L_T_ONF, KC_TRNS, KC_TRNS, KC_TRNS, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | 43 | KC_TRNS, L_T_MD, L_T_ONF, KC_TRNS, KC_TRNS, MD_BOOT, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ |
| 44 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ | 44 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ |
| 45 | ), | 45 | ), |
| 46 | /* | 46 | /* |
| 47 | [X] = LAYOUT( | 47 | [X] = LAYOUT( |
| @@ -50,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 50 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | 50 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ |
| 51 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | 51 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ |
| 52 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | 52 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ |
| 53 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ | 53 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ |
| 54 | ), | 54 | ), |
| 55 | */ | 55 | */ |
| 56 | }; | 56 | }; |
| @@ -139,8 +139,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 139 | case L_T_BR: | 139 | case L_T_BR: |
| 140 | if (record->event.pressed) { | 140 | if (record->event.pressed) { |
| 141 | led_animation_breathing = !led_animation_breathing; | 141 | led_animation_breathing = !led_animation_breathing; |
| 142 | if (led_animation_breathing) | 142 | if (led_animation_breathing) { |
| 143 | { | ||
| 144 | gcr_breathe = gcr_desired; | 143 | gcr_breathe = gcr_desired; |
| 145 | led_animation_breathe_cur = BREATHE_MIN_STEP; | 144 | led_animation_breathe_cur = BREATHE_MIN_STEP; |
| 146 | breathe_dir = 1; | 145 | breathe_dir = 1; |
| @@ -154,50 +153,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 154 | return false; | 153 | return false; |
| 155 | case U_T_AUTO: | 154 | case U_T_AUTO: |
| 156 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { | 155 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { |
| 157 | usb_extra_manual = !usb_extra_manual; | 156 | TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); |
| 158 | CDC_print("USB extra port manual mode "); | ||
| 159 | CDC_print(usb_extra_manual ? "enabled" : "disabled"); | ||
| 160 | CDC_print("\r\n"); | ||
| 161 | } | 157 | } |
| 162 | return false; | 158 | return false; |
| 163 | case U_T_AGCR: | 159 | case U_T_AGCR: |
| 164 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { | 160 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { |
| 165 | usb_gcr_auto = !usb_gcr_auto; | 161 | TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode"); |
| 166 | CDC_print("USB GCR auto mode "); | ||
| 167 | CDC_print(usb_gcr_auto ? "enabled" : "disabled"); | ||
| 168 | CDC_print("\r\n"); | ||
| 169 | } | 162 | } |
| 170 | return false; | 163 | return false; |
| 171 | case DBG_TOG: | 164 | case DBG_TOG: |
| 172 | if (record->event.pressed) { | 165 | if (record->event.pressed) { |
| 173 | debug_enable = !debug_enable; | 166 | TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode"); |
| 174 | CDC_print("Debug mode "); | ||
| 175 | CDC_print(debug_enable ? "enabled" : "disabled"); | ||
| 176 | CDC_print("\r\n"); | ||
| 177 | } | 167 | } |
| 178 | return false; | 168 | return false; |
| 179 | case DBG_MTRX: | 169 | case DBG_MTRX: |
| 180 | if (record->event.pressed) { | 170 | if (record->event.pressed) { |
| 181 | debug_matrix = !debug_matrix; | 171 | TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix"); |
| 182 | CDC_print("Debug matrix "); | ||
| 183 | CDC_print(debug_matrix ? "enabled" : "disabled"); | ||
| 184 | CDC_print("\r\n"); | ||
| 185 | } | 172 | } |
| 186 | return false; | 173 | return false; |
| 187 | case DBG_KBD: | 174 | case DBG_KBD: |
| 188 | if (record->event.pressed) { | 175 | if (record->event.pressed) { |
| 189 | debug_keyboard = !debug_keyboard; | 176 | TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard"); |
| 190 | CDC_print("Debug keyboard "); | ||
| 191 | CDC_print(debug_keyboard ? "enabled" : "disabled"); | ||
| 192 | CDC_print("\r\n"); | ||
| 193 | } | 177 | } |
| 194 | return false; | 178 | return false; |
| 195 | case DBG_MOU: | 179 | case DBG_MOU: |
| 196 | if (record->event.pressed) { | 180 | if (record->event.pressed) { |
| 197 | debug_mouse = !debug_mouse; | 181 | TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); |
| 198 | CDC_print("Debug mouse "); | ||
| 199 | CDC_print(debug_mouse ? "enabled" : "disabled"); | ||
| 200 | CDC_print("\r\n"); | ||
| 201 | } | 182 | } |
| 202 | return false; | 183 | return false; |
| 203 | case MD_BOOT: | 184 | case MD_BOOT: |
diff --git a/keyboards/massdrop/ctrl/rules.mk b/keyboards/massdrop/ctrl/rules.mk index daf679585..c5539158f 100644 --- a/keyboards/massdrop/ctrl/rules.mk +++ b/keyboards/massdrop/ctrl/rules.mk | |||
| @@ -30,3 +30,4 @@ FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches | |||
| 30 | HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) | 30 | HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) |
| 31 | VIRTSER_ENABLE = no # USB Serial Driver | 31 | VIRTSER_ENABLE = no # USB Serial Driver |
| 32 | RAW_ENABLE = no # Raw device | 32 | RAW_ENABLE = no # Raw device |
| 33 | AUTO_SHIFT_ENABLE = no # Auto Shift | ||
diff --git a/lib/arm_atsam/packs/atmel/SAMD51_DFP/1.0.70/gcc/gcc/samd51j18a_flash.ld b/lib/arm_atsam/packs/atmel/SAMD51_DFP/1.0.70/gcc/gcc/samd51j18a_flash.ld index 3d114f5b7..35db61971 100644 --- a/lib/arm_atsam/packs/atmel/SAMD51_DFP/1.0.70/gcc/gcc/samd51j18a_flash.ld +++ b/lib/arm_atsam/packs/atmel/SAMD51_DFP/1.0.70/gcc/gcc/samd51j18a_flash.ld | |||
| @@ -35,7 +35,7 @@ SEARCH_DIR(.) | |||
| 35 | /* Memory Spaces Definitions */ | 35 | /* Memory Spaces Definitions */ |
| 36 | MEMORY | 36 | MEMORY |
| 37 | { | 37 | { |
| 38 | //rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 | 38 | /*rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000*/ |
| 39 | rom (rx) : ORIGIN = 0x00004000, LENGTH = 0x0003C000 | 39 | rom (rx) : ORIGIN = 0x00004000, LENGTH = 0x0003C000 |
| 40 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000 | 40 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000 |
| 41 | bkupram (rwx) : ORIGIN = 0x47000000, LENGTH = 0x00002000 | 41 | bkupram (rwx) : ORIGIN = 0x47000000, LENGTH = 0x00002000 |
| @@ -45,6 +45,9 @@ MEMORY | |||
| 45 | /* The stack size used by the application. NOTE: you need to adjust according to your application. */ | 45 | /* The stack size used by the application. NOTE: you need to adjust according to your application. */ |
| 46 | STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x8000; | 46 | STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x8000; |
| 47 | 47 | ||
| 48 | /* The heap size used by the application. */ | ||
| 49 | HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : DEFINED(__heap_size__) ? __heap_size__ : 0x800; | ||
| 50 | |||
| 48 | _srom = ORIGIN(rom); | 51 | _srom = ORIGIN(rom); |
| 49 | _lrom = LENGTH(rom); | 52 | _lrom = LENGTH(rom); |
| 50 | _erom = ORIGIN(rom) + LENGTH(rom); | 53 | _erom = ORIGIN(rom) + LENGTH(rom); |
| @@ -153,6 +156,17 @@ SECTIONS | |||
| 153 | _ezero = .; | 156 | _ezero = .; |
| 154 | } > ram | 157 | } > ram |
| 155 | 158 | ||
| 159 | /* .heap section for syscalls */ | ||
| 160 | .heap (NOLOAD) : | ||
| 161 | { | ||
| 162 | . = ALIGN(4); | ||
| 163 | _end = .; | ||
| 164 | end = .; | ||
| 165 | _heap_start = .; | ||
| 166 | . = . + HEAP_SIZE; | ||
| 167 | _heap_end = .; | ||
| 168 | } > ram | ||
| 169 | |||
| 156 | /* stack section */ | 170 | /* stack section */ |
| 157 | .stack (NOLOAD): | 171 | .stack (NOLOAD): |
| 158 | { | 172 | { |
diff --git a/tmk_core/arm_atsam.mk b/tmk_core/arm_atsam.mk index ef412d59d..06823fb62 100644 --- a/tmk_core/arm_atsam.mk +++ b/tmk_core/arm_atsam.mk | |||
| @@ -36,7 +36,7 @@ LDFLAGS +=-Wl,--gc-sections | |||
| 36 | LDFLAGS += -Wl,-Map="%OUT%%PROJ_NAME%.map" | 36 | LDFLAGS += -Wl,-Map="%OUT%%PROJ_NAME%.map" |
| 37 | LDFLAGS += -Wl,--start-group | 37 | LDFLAGS += -Wl,--start-group |
| 38 | LDFLAGS += -Wl,--end-group | 38 | LDFLAGS += -Wl,--end-group |
| 39 | LDFLAGS += -Wl,--gc-sections | 39 | LDFLAGS += --specs=rdimon.specs |
| 40 | LDFLAGS += -T$(LIB_PATH)/arm_atsam/packs/atmel/SAMD51_DFP/1.0.70/gcc/gcc/samd51j18a_flash.ld | 40 | LDFLAGS += -T$(LIB_PATH)/arm_atsam/packs/atmel/SAMD51_DFP/1.0.70/gcc/gcc/samd51j18a_flash.ld |
| 41 | 41 | ||
| 42 | OPT_DEFS += -DPROTOCOL_ARM_ATSAM | 42 | OPT_DEFS += -DPROTOCOL_ARM_ATSAM |
diff --git a/tmk_core/common/arm_atsam/printf.h b/tmk_core/common/arm_atsam/printf.h index 582c83bf5..3206b40bd 100644 --- a/tmk_core/common/arm_atsam/printf.h +++ b/tmk_core/common/arm_atsam/printf.h | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | #ifndef _PRINTF_H_ | 1 | #ifndef _PRINTF_H_ |
| 2 | #define _PRINTF_H_ | 2 | #define _PRINTF_H_ |
| 3 | 3 | ||
| 4 | #define __xprintf dpf | ||
| 5 | int dpf(const char *_Format, ...); | 4 | int dpf(const char *_Format, ...); |
| 5 | #define __xprintf dpf | ||
| 6 | 6 | ||
| 7 | #endif //_PRINTF_H_ | 7 | #endif //_PRINTF_H_ |
| 8 | 8 | ||
diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h index 9cbe67bad..d94527657 100644 --- a/tmk_core/common/print.h +++ b/tmk_core/common/print.h | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | #include <stdbool.h> | 29 | #include <stdbool.h> |
| 30 | #include "util.h" | 30 | #include "util.h" |
| 31 | 31 | ||
| 32 | #if defined(PROTOCOL_CHIBIOS) | 32 | #if defined(PROTOCOL_CHIBIOS) || defined(PROTOCOL_ARM_ATSAM) |
| 33 | #define PSTR(x) x | 33 | #define PSTR(x) x |
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
diff --git a/tmk_core/protocol/arm_atsam.mk b/tmk_core/protocol/arm_atsam.mk index d535b64cd..04e02790a 100644 --- a/tmk_core/protocol/arm_atsam.mk +++ b/tmk_core/protocol/arm_atsam.mk | |||
| @@ -10,7 +10,6 @@ SRC += $(ARM_ATSAM_DIR)/spi.c | |||
| 10 | SRC += $(ARM_ATSAM_DIR)/startup.c | 10 | SRC += $(ARM_ATSAM_DIR)/startup.c |
| 11 | 11 | ||
| 12 | SRC += $(ARM_ATSAM_DIR)/usb/main_usb.c | 12 | SRC += $(ARM_ATSAM_DIR)/usb/main_usb.c |
| 13 | SRC += $(ARM_ATSAM_DIR)/usb/spfssf.c | ||
| 14 | SRC += $(ARM_ATSAM_DIR)/usb/udc.c | 13 | SRC += $(ARM_ATSAM_DIR)/usb/udc.c |
| 15 | SRC += $(ARM_ATSAM_DIR)/usb/udi_cdc.c | 14 | SRC += $(ARM_ATSAM_DIR)/usb/udi_cdc.c |
| 16 | SRC += $(ARM_ATSAM_DIR)/usb/udi_hid.c | 15 | SRC += $(ARM_ATSAM_DIR)/usb/udi_hid.c |
diff --git a/tmk_core/protocol/arm_atsam/arm_atsam_protocol.h b/tmk_core/protocol/arm_atsam/arm_atsam_protocol.h index be73beccd..2ba099174 100644 --- a/tmk_core/protocol/arm_atsam/arm_atsam_protocol.h +++ b/tmk_core/protocol/arm_atsam/arm_atsam_protocol.h | |||
| @@ -36,7 +36,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 36 | #include "issi3733_driver.h" | 36 | #include "issi3733_driver.h" |
| 37 | #include "./usb/compiler.h" | 37 | #include "./usb/compiler.h" |
| 38 | #include "./usb/udc.h" | 38 | #include "./usb/udc.h" |
| 39 | #include "./usb/spfssf.h" | ||
| 40 | #include "./usb/udi_cdc.h" | 39 | #include "./usb/udi_cdc.h" |
| 41 | 40 | ||
| 42 | #endif //MD_BOOTLOADER | 41 | #endif //MD_BOOTLOADER |
diff --git a/tmk_core/protocol/arm_atsam/d51_util.h b/tmk_core/protocol/arm_atsam/d51_util.h index 465889c7c..7a35f7989 100644 --- a/tmk_core/protocol/arm_atsam/d51_util.h +++ b/tmk_core/protocol/arm_atsam/d51_util.h | |||
| @@ -32,6 +32,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 32 | #define m15_on REG_PORT_OUTSET1 = 0x40000000 //PB30 High | 32 | #define m15_on REG_PORT_OUTSET1 = 0x40000000 //PB30 High |
| 33 | #define m15_off REG_PORT_OUTCLR1 = 0x40000000 //PB30 Low | 33 | #define m15_off REG_PORT_OUTCLR1 = 0x40000000 //PB30 Low |
| 34 | 34 | ||
| 35 | //Debug Port PB23 | ||
| 36 | #define m27_ena REG_PORT_DIRSET1 = 0x800000 //PB23 Output | ||
| 37 | #define m27_on REG_PORT_OUTSET1 = 0x800000 //PB23 High | ||
| 38 | #define m27_off REG_PORT_OUTCLR1 = 0x800000 //PB23 Low | ||
| 39 | |||
| 40 | //Debug Port PB31 | ||
| 41 | #define m28_ena REG_PORT_DIRSET1 = 0x80000000 //PB31 Output | ||
| 42 | #define m28_on REG_PORT_OUTSET1 = 0x80000000 //PB31 High | ||
| 43 | #define m28_off REG_PORT_OUTCLR1 = 0x80000000 //PB31 Low | ||
| 44 | |||
| 35 | #define m15_loop(M15X) {uint8_t M15L=M15X; while(M15L--){m15_on;CLK_delay_us(1);m15_off;}} | 45 | #define m15_loop(M15X) {uint8_t M15L=M15X; while(M15L--){m15_on;CLK_delay_us(1);m15_off;}} |
| 36 | 46 | ||
| 37 | void m15_print(uint32_t x); | 47 | void m15_print(uint32_t x); |
diff --git a/tmk_core/protocol/arm_atsam/main_arm_atsam.c b/tmk_core/protocol/arm_atsam/main_arm_atsam.c index 8cc776703..676dac4ea 100644 --- a/tmk_core/protocol/arm_atsam/main_arm_atsam.c +++ b/tmk_core/protocol/arm_atsam/main_arm_atsam.c | |||
| @@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 31 | //From keyboard's directory | 31 | //From keyboard's directory |
| 32 | #include "config_led.h" | 32 | #include "config_led.h" |
| 33 | 33 | ||
| 34 | void main_subtasks(void); | ||
| 34 | uint8_t keyboard_leds(void); | 35 | uint8_t keyboard_leds(void); |
| 35 | void send_keyboard(report_keyboard_t *report); | 36 | void send_keyboard(report_keyboard_t *report); |
| 36 | void send_mouse(report_mouse_t *report); | 37 | void send_mouse(report_mouse_t *report); |
| @@ -65,7 +66,7 @@ void send_keyboard(report_keyboard_t *report) | |||
| 65 | if (!keymap_config.nkro) | 66 | if (!keymap_config.nkro) |
| 66 | { | 67 | { |
| 67 | #endif //NKRO_ENABLE | 68 | #endif //NKRO_ENABLE |
| 68 | dprint("s-kbd\r\n"); | 69 | while (udi_hid_kbd_b_report_trans_ongoing) { main_subtasks(); } //Run other tasks while waiting for USB to be free |
| 69 | 70 | ||
| 70 | irqflags = __get_PRIMASK(); | 71 | irqflags = __get_PRIMASK(); |
| 71 | __disable_irq(); | 72 | __disable_irq(); |
| @@ -81,7 +82,7 @@ void send_keyboard(report_keyboard_t *report) | |||
| 81 | } | 82 | } |
| 82 | else | 83 | else |
| 83 | { | 84 | { |
| 84 | dprint("s-nkro\r\n"); | 85 | while (udi_hid_nkro_b_report_trans_ongoing) { main_subtasks(); } //Run other tasks while waiting for USB to be free |
| 85 | 86 | ||
| 86 | irqflags = __get_PRIMASK(); | 87 | irqflags = __get_PRIMASK(); |
| 87 | __disable_irq(); | 88 | __disable_irq(); |
| @@ -102,8 +103,6 @@ void send_mouse(report_mouse_t *report) | |||
| 102 | #ifdef MOUSEKEY_ENABLE | 103 | #ifdef MOUSEKEY_ENABLE |
| 103 | uint32_t irqflags; | 104 | uint32_t irqflags; |
| 104 | 105 | ||
| 105 | dprint("s-mou\r\n"); | ||
| 106 | |||
| 107 | irqflags = __get_PRIMASK(); | 106 | irqflags = __get_PRIMASK(); |
| 108 | __disable_irq(); | 107 | __disable_irq(); |
| 109 | __DMB(); | 108 | __DMB(); |
| @@ -120,8 +119,6 @@ void send_mouse(report_mouse_t *report) | |||
| 120 | void send_system(uint16_t data) | 119 | void send_system(uint16_t data) |
| 121 | { | 120 | { |
| 122 | #ifdef EXTRAKEY_ENABLE | 121 | #ifdef EXTRAKEY_ENABLE |
| 123 | dprintf("s-exks %i\r\n", data); | ||
| 124 | |||
| 125 | uint32_t irqflags; | 122 | uint32_t irqflags; |
| 126 | 123 | ||
| 127 | irqflags = __get_PRIMASK(); | 124 | irqflags = __get_PRIMASK(); |
| @@ -142,8 +139,6 @@ void send_system(uint16_t data) | |||
| 142 | void send_consumer(uint16_t data) | 139 | void send_consumer(uint16_t data) |
| 143 | { | 140 | { |
| 144 | #ifdef EXTRAKEY_ENABLE | 141 | #ifdef EXTRAKEY_ENABLE |
| 145 | dprintf("s-exkc %i\r\n",data); | ||
| 146 | |||
| 147 | uint32_t irqflags; | 142 | uint32_t irqflags; |
| 148 | 143 | ||
| 149 | irqflags = __get_PRIMASK(); | 144 | irqflags = __get_PRIMASK(); |
| @@ -160,6 +155,77 @@ void send_consumer(uint16_t data) | |||
| 160 | #endif //EXTRAKEY_ENABLE | 155 | #endif //EXTRAKEY_ENABLE |
| 161 | } | 156 | } |
| 162 | 157 | ||
| 158 | uint8_t g_drvid; | ||
| 159 | |||
| 160 | void main_subtask_usb_state(void) | ||
| 161 | { | ||
| 162 | if (usb_state == USB_STATE_POWERDOWN) | ||
| 163 | { | ||
| 164 | uint32_t timer_led = timer_read32(); | ||
| 165 | |||
| 166 | led_on; | ||
| 167 | if (led_enabled) | ||
| 168 | { | ||
| 169 | for (g_drvid = 0; g_drvid < ISSI3733_DRIVER_COUNT; g_drvid++) | ||
| 170 | { | ||
| 171 | I2C3733_Control_Set(0); | ||
| 172 | } | ||
| 173 | } | ||
| 174 | while (usb_state == USB_STATE_POWERDOWN) | ||
| 175 | { | ||
| 176 | if (timer_read32() - timer_led > 1000) led_off; //Good to indicate went to sleep, but only for a second | ||
| 177 | } | ||
| 178 | if (led_enabled) | ||
| 179 | { | ||
| 180 | for (g_drvid = 0; g_drvid < ISSI3733_DRIVER_COUNT; g_drvid++) | ||
| 181 | { | ||
| 182 | I2C3733_Control_Set(1); | ||
| 183 | } | ||
| 184 | } | ||
| 185 | led_off; | ||
| 186 | } | ||
| 187 | } | ||
| 188 | |||
| 189 | void main_subtask_led(void) | ||
| 190 | { | ||
| 191 | led_matrix_task(); | ||
| 192 | } | ||
| 193 | |||
| 194 | void main_subtask_power_check(void) | ||
| 195 | { | ||
| 196 | static uint64_t next_5v_checkup = 0; | ||
| 197 | |||
| 198 | if (CLK_get_ms() > next_5v_checkup) | ||
| 199 | { | ||
| 200 | next_5v_checkup = CLK_get_ms() + 5; | ||
| 201 | |||
| 202 | v_5v = adc_get(ADC_5V); | ||
| 203 | v_5v_avg = 0.9 * v_5v_avg + 0.1 * v_5v; | ||
| 204 | |||
| 205 | gcr_compute(); | ||
| 206 | } | ||
| 207 | } | ||
| 208 | |||
| 209 | void main_subtask_usb_extra_device(void) | ||
| 210 | { | ||
| 211 | static uint64_t next_usb_checkup = 0; | ||
| 212 | |||
| 213 | if (CLK_get_ms() > next_usb_checkup) | ||
| 214 | { | ||
| 215 | next_usb_checkup = CLK_get_ms() + 10; | ||
| 216 | |||
| 217 | USB_HandleExtraDevice(); | ||
| 218 | } | ||
| 219 | } | ||
| 220 | |||
| 221 | void main_subtasks(void) | ||
| 222 | { | ||
| 223 | main_subtask_usb_state(); | ||
| 224 | main_subtask_led(); | ||
| 225 | main_subtask_power_check(); | ||
| 226 | main_subtask_usb_extra_device(); | ||
| 227 | } | ||
| 228 | |||
| 163 | int main(void) | 229 | int main(void) |
| 164 | { | 230 | { |
| 165 | led_ena; | 231 | led_ena; |
| @@ -201,9 +267,8 @@ int main(void) | |||
| 201 | 267 | ||
| 202 | i2c_led_q_init(); | 268 | i2c_led_q_init(); |
| 203 | 269 | ||
| 204 | uint8_t drvid; | 270 | for (g_drvid = 0; g_drvid < ISSI3733_DRIVER_COUNT; g_drvid++) |
| 205 | for (drvid=0;drvid<ISSI3733_DRIVER_COUNT;drvid++) | 271 | I2C_LED_Q_ONOFF(g_drvid); //Queue data |
| 206 | I2C_LED_Q_ONOFF(drvid); //Queue data | ||
| 207 | 272 | ||
| 208 | keyboard_setup(); | 273 | keyboard_setup(); |
| 209 | 274 | ||
| @@ -214,8 +279,6 @@ int main(void) | |||
| 214 | #ifdef VIRTSER_ENABLE | 279 | #ifdef VIRTSER_ENABLE |
| 215 | uint64_t next_print = 0; | 280 | uint64_t next_print = 0; |
| 216 | #endif //VIRTSER_ENABLE | 281 | #endif //VIRTSER_ENABLE |
| 217 | uint64_t next_usb_checkup = 0; | ||
| 218 | uint64_t next_5v_checkup = 0; | ||
| 219 | 282 | ||
| 220 | v_5v_avg = adc_get(ADC_5V); | 283 | v_5v_avg = adc_get(ADC_5V); |
| 221 | 284 | ||
| @@ -223,58 +286,15 @@ int main(void) | |||
| 223 | 286 | ||
| 224 | while (1) | 287 | while (1) |
| 225 | { | 288 | { |
| 226 | if (usb_state == USB_STATE_POWERDOWN) | ||
| 227 | { | ||
| 228 | uint32_t timer_led = timer_read32(); | ||
| 229 | |||
| 230 | led_on; | ||
| 231 | if (led_enabled) | ||
| 232 | { | ||
| 233 | for (drvid=0;drvid<ISSI3733_DRIVER_COUNT;drvid++) | ||
| 234 | { | ||
| 235 | I2C3733_Control_Set(0); | ||
| 236 | } | ||
| 237 | } | ||
| 238 | while (usb_state == USB_STATE_POWERDOWN) | ||
| 239 | { | ||
| 240 | if (timer_read32() - timer_led > 1000) led_off; //Good to indicate went to sleep, but only for a second | ||
| 241 | } | ||
| 242 | if (led_enabled) | ||
| 243 | { | ||
| 244 | for (drvid=0;drvid<ISSI3733_DRIVER_COUNT;drvid++) | ||
| 245 | { | ||
| 246 | I2C3733_Control_Set(1); | ||
| 247 | } | ||
| 248 | } | ||
| 249 | led_off; | ||
| 250 | } | ||
| 251 | |||
| 252 | keyboard_task(); | 289 | keyboard_task(); |
| 253 | 290 | ||
| 254 | led_matrix_task(); | 291 | main_subtasks(); //Note these tasks will also be run while waiting for USB keyboard polling intervals |
| 255 | |||
| 256 | if (CLK_get_ms() > next_5v_checkup) | ||
| 257 | { | ||
| 258 | next_5v_checkup = CLK_get_ms() + 5; | ||
| 259 | |||
| 260 | v_5v = adc_get(ADC_5V); | ||
| 261 | v_5v_avg = 0.9 * v_5v_avg + 0.1 * v_5v; | ||
| 262 | |||
| 263 | gcr_compute(); | ||
| 264 | } | ||
| 265 | |||
| 266 | if (CLK_get_ms() > next_usb_checkup) | ||
| 267 | { | ||
| 268 | next_usb_checkup = CLK_get_ms() + 10; | ||
| 269 | |||
| 270 | USB_HandleExtraDevice(); | ||
| 271 | } | ||
| 272 | 292 | ||
| 273 | #ifdef VIRTSER_ENABLE | 293 | #ifdef VIRTSER_ENABLE |
| 274 | if (CLK_get_ms() > next_print) | 294 | if (CLK_get_ms() > next_print) |
| 275 | { | 295 | { |
| 276 | next_print = CLK_get_ms() + 250; | 296 | next_print = CLK_get_ms() + 250; |
| 277 | //dpf("5v=%i 5vu=%i dlow=%i dhi=%i gca=%i gcd=%i\r\n",v_5v,v_5v_avg,v_5v_avg-V5_LOW,v_5v_avg-V5_HIGH,gcr_actual,gcr_desired); | 297 | dprintf("5v=%u 5vu=%u dlow=%u dhi=%u gca=%u gcd=%u\r\n",v_5v,v_5v_avg,v_5v_avg-V5_LOW,v_5v_avg-V5_HIGH,gcr_actual,gcr_desired); |
| 278 | } | 298 | } |
| 279 | #endif //VIRTSER_ENABLE | 299 | #endif //VIRTSER_ENABLE |
| 280 | } | 300 | } |
diff --git a/tmk_core/protocol/arm_atsam/usb/spfssf.c b/tmk_core/protocol/arm_atsam/usb/spfssf.c deleted file mode 100644 index 449a8bb7d..000000000 --- a/tmk_core/protocol/arm_atsam/usb/spfssf.c +++ /dev/null | |||
| @@ -1,268 +0,0 @@ | |||
| 1 | #include "samd51j18a.h" | ||
| 2 | #include "stdarg.h" | ||
| 3 | #include "spfssf.h" | ||
| 4 | #include "usb_util.h" | ||
| 5 | |||
| 6 | int vspf(char *_Dest, const char *_Format, va_list va) | ||
| 7 | { | ||
| 8 | //va_list va; //Variable argument list variable | ||
| 9 | char *d = _Dest; //Pointer to dest | ||
| 10 | |||
| 11 | //va_start(va,_Format); //Initialize the variable argument list | ||
| 12 | while (*_Format) //While not end of format string | ||
| 13 | { | ||
| 14 | if (*_Format == SPF_SPEC_START) //If current format string character is the specifier start character | ||
| 15 | { | ||
| 16 | _Format++; //Skip over the character | ||
| 17 | while (*_Format && *_Format <= 64) _Format++; //Forward past any options | ||
| 18 | if (*_Format == SPF_SPEC_START) *d++ = *_Format; //If the character is the specifier start character, output the character and advance dest | ||
| 19 | else if (*_Format == SPF_SPEC_LONG) //If the character is the long type | ||
| 20 | { | ||
| 21 | _Format++; //Skip over the character | ||
| 22 | if (*_Format == SPF_SPEC_DECIMAL) //If the character is the decimal type | ||
| 23 | { | ||
| 24 | int64_t buf = va_arg(va,int64_t); //Get the next value from the va list | ||
| 25 | //if (buf < 0) { *d++ = '-'; buf = -buf; } //If the given number is negative, add a negative sign to the dest and invert number | ||
| 26 | //spf_uint2str_32_3t(&d,buf,32); //Perform the conversion | ||
| 27 | d += UTIL_ltoa_radix(buf, d, 10); | ||
| 28 | } | ||
| 29 | else if (*_Format == SPF_SPEC_UNSIGNED) //If the character is the unsigned type | ||
| 30 | { | ||
| 31 | uint64_t num = va_arg(va,uint64_t); //Get the next value from the va list | ||
| 32 | //spf_uint2str_32_3t(&d,num,32); //Perform the conversion | ||
| 33 | d += UTIL_ltoa_radix(num, d, 10); | ||
| 34 | } | ||
| 35 | else if (*_Format == SPF_SPEC_UHINT || *_Format == SPF_SPEC_UHINT_UP) //If the character is the unsigned type | ||
| 36 | { | ||
| 37 | uint64_t buf = va_arg(va,uint64_t); //Get the next value from the va list | ||
| 38 | //spf_uint2hex_32(&d,(unsigned long) buf); | ||
| 39 | d += UTIL_ltoa_radix(buf, d, 16); | ||
| 40 | } | ||
| 41 | else //If the character was not a known type | ||
| 42 | { | ||
| 43 | *d++ = SPF_SPEC_START; //Output the start specifier | ||
| 44 | *d++ = SPF_SPEC_LONG; //Output the long type | ||
| 45 | *d++ = *_Format; //Output the unknown type | ||
| 46 | } | ||
| 47 | } | ||
| 48 | else if (*_Format == SPF_SPEC_DECIMAL) //If the character is the decimal type | ||
| 49 | { | ||
| 50 | int buf = va_arg(va,int); //Get the next value from the va list | ||
| 51 | //if (buf < 0) { *d++ = '-'; buf = -buf; } //If the given number is negative, add a negative sign to the dest and invert number | ||
| 52 | //spf_uint2str_32_3t(&d,buf,16); //Perform the conversion | ||
| 53 | d += UTIL_itoa(buf, d); | ||
| 54 | } | ||
| 55 | else if (*_Format == SPF_SPEC_INT) //If the character is the integer type | ||
| 56 | { | ||
| 57 | int buf = va_arg(va,int); //Get the next value from the va list | ||
| 58 | //if (buf < 0) { *d++ = '-'; buf = -buf; } //If the given number is negative, add a negative sign to the dest and inverted number | ||
| 59 | //spf_uint2str_32_3t(&d,buf,16); //Perform the conversion | ||
| 60 | d += UTIL_itoa(buf, d); | ||
| 61 | } | ||
| 62 | else if (*_Format == SPF_SPEC_UINT) //If the character is the unsigned integer type | ||
| 63 | { | ||
| 64 | int buf = va_arg(va,int); //Get the next value from the va list | ||
| 65 | //spf_uint2str_32_3t(&d,buf,16); //Perform the conversion | ||
| 66 | d += UTIL_utoa(buf, d); | ||
| 67 | } | ||
| 68 | else if (*_Format == SPF_SPEC_STRING) //If the character is the string type | ||
| 69 | { | ||
| 70 | char *buf = va_arg(va,char*); //Get the next value from the va list | ||
| 71 | while (*buf) *d++ = *buf++; //Perform the conversion (simply output characters and adcance pointers) | ||
| 72 | } | ||
| 73 | else if (*_Format == SPF_SPEC_UHINT || *_Format == SPF_SPEC_UHINT_UP) //If the character is the short type | ||
| 74 | { | ||
| 75 | int buf = va_arg(va,unsigned int); //Get the next value from the va list | ||
| 76 | //spf_uint2hex_32(&d,(unsigned long) buf); //Perform the conversion | ||
| 77 | d += UTIL_utoa(buf, d); | ||
| 78 | } | ||
| 79 | else //If the character type is unknown | ||
| 80 | { | ||
| 81 | *d++ = SPF_SPEC_START; //Output the start specifier | ||
| 82 | *d++ = *_Format; //Output the unknown type | ||
| 83 | } | ||
| 84 | } | ||
| 85 | else *d++ = *_Format; //If the character is unknown, output it to dest and advance dest | ||
| 86 | _Format++; //Advance the format buffer pointer to next character | ||
| 87 | } | ||
| 88 | //va_end(va); //End the variable argument list | ||
| 89 | |||
| 90 | *d = '\0'; //Cap off the destination string with a zero | ||
| 91 | |||
| 92 | return d - _Dest; //Return the length of the destintion buffer | ||
| 93 | } | ||
| 94 | |||
| 95 | int spf(char *_Dest, const char *_Format, ...) | ||
| 96 | { | ||
| 97 | va_list va; //Variable argument list variable | ||
| 98 | int result; | ||
| 99 | |||
| 100 | va_start(va,_Format); //Initialize the variable argument list | ||
| 101 | result = vspf(_Dest, _Format, va); | ||
| 102 | va_end(va); | ||
| 103 | return result; | ||
| 104 | } | ||
| 105 | |||
| 106 | //sscanf string to number (integer types) | ||
| 107 | int64_t ssf_ston(const char **_Src, uint32_t count, uint32_t *conv_count) | ||
| 108 | { | ||
| 109 | int64_t value = 0; //Return value accumulator | ||
| 110 | uint32_t counter=count; //Counter to keep track of numbers converted | ||
| 111 | const char* p; //Pointer to first non space character | ||
| 112 | |||
| 113 | while (*(*_Src) == SSF_SKIP_SPACE) (*_Src)++; //Forward through the whitespace to next non whitespace | ||
| 114 | |||
| 115 | p = (*_Src); //Set pointer to first non space character | ||
| 116 | if (*p == '+' || *p == '-') (*_Src)++; //Skip over sign if any | ||
| 117 | while (*(*_Src) >= ASCII_NUM_START && | ||
| 118 | *(*_Src) <= ASCII_NUM_END && | ||
| 119 | counter) //While the source character is a digit and counter is not zero | ||
| 120 | { | ||
| 121 | value *= 10; //Multiply result by 10 to make room for next 1's place number | ||
| 122 | value += *(*_Src)++ - ASCII_NUM_START; //Add source number to value | ||
| 123 | counter--; //Decrement counter | ||
| 124 | } | ||
| 125 | if (counter - count == 0) return 0; //If no number conversion were performed, return 0 | ||
| 126 | if (*p == '-') value = -value; //If the number given was negative, make the result negative | ||
| 127 | |||
| 128 | if (conv_count) (*conv_count)++; //Increment the converted count | ||
| 129 | return value; //Return the value | ||
| 130 | } | ||
| 131 | |||
| 132 | uint64_t ssf_hton(const char **_Src, uint32_t count,uint32_t *conv_count) | ||
| 133 | { | ||
| 134 | int64_t value=0; //Return value accumulator | ||
| 135 | uint32_t counter=count; //Counter to keep track of numbers converted | ||
| 136 | //const char* p; //Pointer to first non space character | ||
| 137 | char c; | ||
| 138 | |||
| 139 | while (*(*_Src) == SSF_SKIP_SPACE) (*_Src)++; //Forward through the whitespace to next non whitespace | ||
| 140 | |||
| 141 | //p = (*_Src); //Set pointer to first non space character | ||
| 142 | |||
| 143 | while (counter) | ||
| 144 | { | ||
| 145 | c = *(*_Src)++; | ||
| 146 | if (c >= 'a' && c <= 'f') c -= ('a'-'A'); //toupper | ||
| 147 | if (c < '0' || (c > '9' && c < 'A') || c > 'F') break; | ||
| 148 | value *= 16; //Multiply result by 10 to make room for next 1's place number | ||
| 149 | c = c - '0'; | ||
| 150 | if (c > 9) c -= 7; | ||
| 151 | value += c; //Add source number to value | ||
| 152 | counter--; //Decrement counter | ||
| 153 | } | ||
| 154 | |||
| 155 | if (counter - count == 0) return 0; //If no number conversion were performed, return 0 | ||
| 156 | //if (*p == '-') value = -value; //If the number given was negative, make the result negative | ||
| 157 | |||
| 158 | if (conv_count) (*conv_count)++; //Increment the converted count | ||
| 159 | return value; | ||
| 160 | } | ||
| 161 | |||
| 162 | //sscanf | ||
| 163 | int ssf(const char *_Src, const char *_Format, ...) | ||
| 164 | { | ||
| 165 | va_list va; //Variable argument list variable | ||
| 166 | unsigned char looking_for=0; //Static char specified in format to be found in source | ||
| 167 | uint32_t conv_count=0; //Count of conversions made | ||
| 168 | |||
| 169 | va_start(va,_Format); //Initialize the variable argument list | ||
| 170 | while (*_Format) //While the format string has not been fully read | ||
| 171 | { | ||
| 172 | if (looking_for != 0) //If we are looking for a matching character in the source string | ||
| 173 | { | ||
| 174 | while (*_Src != looking_for && *_Src) _Src++; //While the character is not found in the source string and not the end of the source | ||
| 175 | // string, increment the pointer position | ||
| 176 | if (*_Src == looking_for) _Src++; //If the character was found, step over it | ||
| 177 | else break; //Else the end was reached and the scan is now invalid (Could not find static character) | ||
| 178 | looking_for = 0; //Clear the looking for character | ||
| 179 | } | ||
| 180 | if (*_Format == SSF_SPEC_START) //If the current format character is the specifier start character | ||
| 181 | { | ||
| 182 | _Format++; //Step over the specifier start character | ||
| 183 | if (*_Format == SSF_SPEC_DECIMAL) //If the decimal specifier type is found | ||
| 184 | { | ||
| 185 | int *value=va_arg(va,int*); //User given destination address | ||
| 186 | //*value = (int)ssf_ston(&_Src,5,&conv_count); //Run conversion | ||
| 187 | *value = (int)ssf_ston(&_Src,10,&conv_count); //Run conversion | ||
| 188 | } | ||
| 189 | else if (*_Format == SSF_SPEC_LONG) //If the long specifier type is found | ||
| 190 | { | ||
| 191 | _Format++; //Skip over the specifier type | ||
| 192 | if (*_Format == SSF_SPEC_DECIMAL) //If the decimal specifier type is found | ||
| 193 | { | ||
| 194 | int64_t *value=va_arg(va,int64_t*); //User given destination address | ||
| 195 | //*value = (int64_t)ssf_ston(&_Src,10,&conv_count); //Run conversion | ||
| 196 | *value = (int64_t)ssf_ston(&_Src,19,&conv_count); //Run conversion | ||
| 197 | } | ||
| 198 | else if (*_Format == SSF_SPEC_UHINT) //If the decimal specifier type is found | ||
| 199 | { | ||
| 200 | uint64_t *value=va_arg(va,uint64_t *); //User given destination address | ||
| 201 | //*value = (uint64_t int)ssf_hton(&_Src,12,&conv_count); //Run conversion | ||
| 202 | *value = (uint64_t)ssf_hton(&_Src,16,&conv_count); //Run conversion | ||
| 203 | } | ||
| 204 | } | ||
| 205 | else if (*_Format == SSF_SPEC_SHORTINT) //If the short int specifier type is found | ||
| 206 | { | ||
| 207 | _Format++; //Skip over the specifier type | ||
| 208 | if (*_Format == SSF_SPEC_SHORTINT) //If the short int specifier type is found | ||
| 209 | { | ||
| 210 | _Format++; //Skip over the specifier type | ||
| 211 | if (*_Format == SSF_SPEC_DECIMAL) //If the decimal specifier type is found | ||
| 212 | { | ||
| 213 | unsigned char *value=va_arg(va,unsigned char*); //User given destination address | ||
| 214 | //*value = (unsigned char)ssf_ston(&_Src,3,&conv_count); //Run conversion | ||
| 215 | *value = (unsigned char)ssf_ston(&_Src,5,&conv_count); //Run conversion | ||
| 216 | } | ||
| 217 | } | ||
| 218 | } | ||
| 219 | else if (*_Format == SSF_SPEC_STRING) //If the specifier type is string | ||
| 220 | { | ||
| 221 | char *value=va_arg(va,char*); //User given destination address, max chars read pointer | ||
| 222 | while (*_Src == SSF_SKIP_SPACE) _Src++; //Forward through the whitespace to next non whitespace | ||
| 223 | while (*_Src != SSF_SKIP_SPACE && *_Src) *value++ = *_Src++; //While any character but space and not end of string and not end location, copy char to dest | ||
| 224 | *value = 0; //Cap off the string pointer with zero | ||
| 225 | conv_count++; //Increment the converted count | ||
| 226 | } | ||
| 227 | else if (*_Format == SSF_SPEC_VERSION) //If the specifier type is string | ||
| 228 | { | ||
| 229 | char *value=va_arg(va,char*); //User given destination address, max chars read pointer | ||
| 230 | while (*_Src == SSF_SKIP_SPACE) _Src++; //Forward through the whitespace to next non whitespace | ||
| 231 | while (*_Src != SSF_DELIM_COMMA && *_Src) *value++ = *_Src++; //While any character but space and not end of string and not end location, copy char to dest | ||
| 232 | *value = 0; //Cap off the string pointer with zero | ||
| 233 | conv_count++; //Increment the converted count | ||
| 234 | } | ||
| 235 | else if (*_Format >= ASCII_NUM_START && *_Format <= ASCII_NUM_END) | ||
| 236 | { | ||
| 237 | uint32_t len = (uint32_t)ssf_ston(&_Format,3,NULL); //Convert the given length | ||
| 238 | if (*_Format == SSF_SPEC_STRING) //If the specifier type is string | ||
| 239 | { | ||
| 240 | char *value=va_arg(va,char*),*e; //User given destination address, max chars read pointer | ||
| 241 | while (*_Src == SSF_SKIP_SPACE) _Src++; //Forward through the whitespace to next non whitespace | ||
| 242 | e = (char*)_Src+len; //Set a maximum length pointer location | ||
| 243 | while (*_Src != SSF_SKIP_SPACE && *_Src && _Src != e) *value++ = *_Src++; //While any character but space and not end of string and not end location, copy char to dest | ||
| 244 | *value = 0; //Cap off the string pointer with zero | ||
| 245 | conv_count++; //Increment the converted count | ||
| 246 | } | ||
| 247 | else if (*_Format == SSF_SPEC_VERSION) //If the specifier type is string | ||
| 248 | { | ||
| 249 | char *value=va_arg(va,char*),*e; //User given destination address, max chars read pointer | ||
| 250 | while (*_Src == SSF_SKIP_SPACE) _Src++; //Forward through the whitespace to next non whitespace | ||
| 251 | e = (char*)_Src+len; //Set a maximum length pointer location | ||
| 252 | while (*_Src != SSF_DELIM_COMMA && *_Src && _Src != e) *value++ = *_Src++; //While any character but space and not end of string and not end location, copy char to dest | ||
| 253 | *value = 0; //Cap off the string pointer with zero | ||
| 254 | conv_count++; //Increment the converted count | ||
| 255 | } | ||
| 256 | } | ||
| 257 | else if (*_Format == SSF_SPEC_START) looking_for = *_Format; //If another start specifier character is found, output a specifier character | ||
| 258 | else break; //Scan is now invalid (Uknown type specified) | ||
| 259 | } | ||
| 260 | else if (*_Format == SSF_SKIP_SPACE) { } //If a space is found, ignore it | ||
| 261 | else looking_for = *_Format; //If any other character is found, it is static and should be found in src as well | ||
| 262 | _Format++; //Skip over current format character | ||
| 263 | } | ||
| 264 | |||
| 265 | va_end(va); //End the variable argument list | ||
| 266 | return conv_count; //Return the number of conversions made | ||
| 267 | } | ||
| 268 | |||
diff --git a/tmk_core/protocol/arm_atsam/usb/spfssf.h b/tmk_core/protocol/arm_atsam/usb/spfssf.h deleted file mode 100644 index 337a904df..000000000 --- a/tmk_core/protocol/arm_atsam/usb/spfssf.h +++ /dev/null | |||
| @@ -1,57 +0,0 @@ | |||
| 1 | #ifndef ____spfssf_h | ||
| 2 | #define ____spfssf_h | ||
| 3 | |||
| 4 | #include <stdarg.h> | ||
| 5 | |||
| 6 | #define sprintf spf | ||
| 7 | #define sscanf ssf | ||
| 8 | |||
| 9 | #define SIZEOF_OFFSET 1 | ||
| 10 | |||
| 11 | #ifndef NULL | ||
| 12 | #define NULL 0 | ||
| 13 | #endif | ||
| 14 | |||
| 15 | #define SPF_NONE 0 | ||
| 16 | |||
| 17 | #define SPF_SPEC_START 37 //% | ||
| 18 | #define SPF_SPEC_DECIMAL 100 //d 16bit dec signed (-32767 to 32767) DONE same as i | ||
| 19 | #define SPF_SPEC_INT 105 //i 16bit dec signed (-32767 to 32767) DONE same as d | ||
| 20 | #define SPF_SPEC_UINT 117 //u 16bit dec unsigned (0 to 65535) DONE | ||
| 21 | #define SPF_SPEC_STRING 115 //s variable length (abcd...) DONE | ||
| 22 | #define SPF_SPEC_UHINT 120 //x 16bit hex lwrc (7fa) DONE | ||
| 23 | #define SPF_SPEC_UHINT_UP 88 //x 16bit hex lwrc (7fa) DONE | ||
| 24 | #define SPF_SPEC_LONG 108 //l start of either ld or lu DONE | ||
| 25 | #define SPF_SPEC_DECIMAL 100 //ld 32bit dec signed (-2147483647 to 2147483647) DONE | ||
| 26 | #define SPF_SPEC_UNSIGNED 117 //lu 32bit dec unsigned (0 to 4294967295) DONE | ||
| 27 | #define SPF_SPEC_UHINT 120 //lx 32bit hex unsigned (0 to ffffffff) DONE | ||
| 28 | |||
| 29 | #define SSF_SPEC_START 37 //% | ||
| 30 | #define SSF_SPEC_SHORTINT 104 //h 8bit dec signed (-127 to 127) DONE | ||
| 31 | #define SSF_LEN_SHORTINT 3 //hhd | ||
| 32 | #define SSF_SPEC_DECIMAL 100 //d 16bit dec signed (-32767 to 32767) DONE | ||
| 33 | #define SSF_LEN_DECIMAL 5 //32767 | ||
| 34 | #define SSF_SPEC_INT 105 //i 16bit dec signed (-32767 to 32767) DONE | ||
| 35 | #define SSF_LEN_INT 5 //32767 | ||
| 36 | #define SSF_SPEC_LONG 108 //l start of either ld or lu DONE | ||
| 37 | #define SSF_SPEC_DECIMAL 100 //ld 32bit dec signed (-2147483647 to 2147483647) DONE | ||
| 38 | #define SSF_SPEC_UHINT 120 //lx 32bit hex unsigned DONE | ||
| 39 | #define SSF_LEN_LDECIMAL 10 //2147483647 | ||
| 40 | #define SSF_SPEC_STRING 115 //s variable length (abcd...) DONE | ||
| 41 | #define SSF_SKIP_SPACE 32 //space | ||
| 42 | |||
| 43 | #define SSF_SPEC_VERSION 118 //v collect to comma delimiter - special | ||
| 44 | #define SSF_DELIM_COMMA 44 //, | ||
| 45 | |||
| 46 | #define ASCII_NUM_START 48 //0 | ||
| 47 | #define ASCII_NUM_END 58 //9 | ||
| 48 | |||
| 49 | #define T_UINT32_0_LIMIT 14 | ||
| 50 | #define T_UINT32_1_LIMIT 27 | ||
| 51 | |||
| 52 | int vspf(char *_Dest, const char *_Format, va_list va); | ||
| 53 | int spf(char *_Dest, const char *_Format, ...); | ||
| 54 | int ssf(const char *_Src, const char *_Format, ...); | ||
| 55 | |||
| 56 | #endif //____spfssf_h | ||
| 57 | |||
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_cdc.c b/tmk_core/protocol/arm_atsam/usb/udi_cdc.c index b4159d325..15f0f760c 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_cdc.c +++ b/tmk_core/protocol/arm_atsam/usb/udi_cdc.c | |||
| @@ -54,7 +54,6 @@ | |||
| 54 | #include <string.h> | 54 | #include <string.h> |
| 55 | #include "udi_cdc_conf.h" | 55 | #include "udi_cdc_conf.h" |
| 56 | #include "udi_device_conf.h" | 56 | #include "udi_device_conf.h" |
| 57 | #include "spfssf.h" | ||
| 58 | #include "stdarg.h" | 57 | #include "stdarg.h" |
| 59 | #include "tmk_core/protocol/arm_atsam/clks.h" | 58 | #include "tmk_core/protocol/arm_atsam/clks.h" |
| 60 | 59 | ||
| @@ -1259,7 +1258,6 @@ uint32_t CDC_print(char *printbuf) | |||
| 1259 | return 1; | 1258 | return 1; |
| 1260 | } | 1259 | } |
| 1261 | 1260 | ||
| 1262 | |||
| 1263 | char printbuf[CDC_PRINTBUF_SIZE]; | 1261 | char printbuf[CDC_PRINTBUF_SIZE]; |
| 1264 | 1262 | ||
| 1265 | int dpf(const char *_Format, ...) | 1263 | int dpf(const char *_Format, ...) |
| @@ -1267,8 +1265,8 @@ int dpf(const char *_Format, ...) | |||
| 1267 | va_list va; //Variable argument list variable | 1265 | va_list va; //Variable argument list variable |
| 1268 | int result; | 1266 | int result; |
| 1269 | 1267 | ||
| 1270 | va_start(va,_Format); //Initialize the variable argument list | 1268 | va_start(va, _Format); //Initialize the variable argument list |
| 1271 | result = vspf(printbuf, _Format, va); | 1269 | result = vsnprintf(printbuf, CDC_PRINTBUF_SIZE, _Format, va); |
| 1272 | va_end(va); | 1270 | va_end(va); |
| 1273 | 1271 | ||
| 1274 | CDC_print(printbuf); | 1272 | CDC_print(printbuf); |
| @@ -1377,8 +1375,6 @@ void CDC_init(void) | |||
| 1377 | printbuf[0]=0; | 1375 | printbuf[0]=0; |
| 1378 | } | 1376 | } |
| 1379 | 1377 | ||
| 1380 | char printbuf[CDC_PRINTBUF_SIZE]; | ||
| 1381 | |||
| 1382 | #endif //CDC line 62 | 1378 | #endif //CDC line 62 |
| 1383 | 1379 | ||
| 1384 | //@} | 1380 | //@} |
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_cdc.h b/tmk_core/protocol/arm_atsam/usb/udi_cdc.h index 6b70e96d0..e134cf236 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_cdc.h +++ b/tmk_core/protocol/arm_atsam/usb/udi_cdc.h | |||
| @@ -57,8 +57,8 @@ | |||
| 57 | #include "udi.h" | 57 | #include "udi.h" |
| 58 | 58 | ||
| 59 | // Check the number of port | 59 | // Check the number of port |
| 60 | #ifndef UDI_CDC_PORT_NB | 60 | #ifndef UDI_CDC_PORT_NB |
| 61 | # define UDI_CDC_PORT_NB 1 | 61 | # define UDI_CDC_PORT_NB 1 |
| 62 | #endif | 62 | #endif |
| 63 | #if (UDI_CDC_PORT_NB > 1) | 63 | #if (UDI_CDC_PORT_NB > 1) |
| 64 | # error UDI_CDC_PORT_NB must be at most 1 | 64 | # error UDI_CDC_PORT_NB must be at most 1 |
| @@ -86,9 +86,6 @@ extern UDC_DESC_STORAGE udi_api_t udi_api_cdc_data; | |||
| 86 | //! CDC data endpoints size for FS speed (8B, 16B, 32B, 64B) | 86 | //! CDC data endpoints size for FS speed (8B, 16B, 32B, 64B) |
| 87 | #define UDI_CDC_DATA_EPS_FS_SIZE CDC_RX_SIZE | 87 | #define UDI_CDC_DATA_EPS_FS_SIZE CDC_RX_SIZE |
| 88 | 88 | ||
| 89 | #define CDC_PRINT_BUF_SIZE 256 | ||
| 90 | extern char printbuf[CDC_PRINT_BUF_SIZE]; | ||
| 91 | |||
| 92 | //@} | 89 | //@} |
| 93 | 90 | ||
| 94 | /** | 91 | /** |
| @@ -371,9 +368,6 @@ uint32_t CDC_print(char *printbuf); | |||
| 371 | uint32_t CDC_input(void); | 368 | uint32_t CDC_input(void); |
| 372 | void CDC_init(void); | 369 | void CDC_init(void); |
| 373 | 370 | ||
| 374 | #define __xprintf dpf | ||
| 375 | int dpf(const char *_Format, ...); | ||
| 376 | |||
| 377 | #ifdef __cplusplus | 371 | #ifdef __cplusplus |
| 378 | } | 372 | } |
| 379 | #endif | 373 | #endif |
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c index 18f69350c..1a6f7905e 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c +++ b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c | |||
| @@ -45,6 +45,7 @@ | |||
| 45 | */ | 45 | */ |
| 46 | 46 | ||
| 47 | #include "samd51j18a.h" | 47 | #include "samd51j18a.h" |
| 48 | #include "d51_util.h" | ||
| 48 | #include "conf_usb.h" | 49 | #include "conf_usb.h" |
| 49 | #include "usb_protocol.h" | 50 | #include "usb_protocol.h" |
| 50 | #include "udd.h" | 51 | #include "udd.h" |
| @@ -86,7 +87,7 @@ bool udi_hid_kbd_b_report_valid; | |||
| 86 | COMPILER_WORD_ALIGNED | 87 | COMPILER_WORD_ALIGNED |
| 87 | uint8_t udi_hid_kbd_report[UDI_HID_KBD_REPORT_SIZE]; | 88 | uint8_t udi_hid_kbd_report[UDI_HID_KBD_REPORT_SIZE]; |
| 88 | 89 | ||
| 89 | static bool udi_hid_kbd_b_report_trans_ongoing; | 90 | volatile bool udi_hid_kbd_b_report_trans_ongoing; |
| 90 | 91 | ||
| 91 | COMPILER_WORD_ALIGNED | 92 | COMPILER_WORD_ALIGNED |
| 92 | static uint8_t udi_hid_kbd_report_trans[UDI_HID_KBD_REPORT_SIZE]; | 93 | static uint8_t udi_hid_kbd_report_trans[UDI_HID_KBD_REPORT_SIZE]; |
| @@ -186,8 +187,7 @@ bool udi_hid_kbd_send_report(void) | |||
| 186 | return false; | 187 | return false; |
| 187 | } | 188 | } |
| 188 | 189 | ||
| 189 | memcpy(udi_hid_kbd_report_trans, udi_hid_kbd_report, | 190 | memcpy(udi_hid_kbd_report_trans, udi_hid_kbd_report, UDI_HID_KBD_REPORT_SIZE); |
| 190 | UDI_HID_KBD_REPORT_SIZE); | ||
| 191 | udi_hid_kbd_b_report_valid = false; | 191 | udi_hid_kbd_b_report_valid = false; |
| 192 | udi_hid_kbd_b_report_trans_ongoing = | 192 | udi_hid_kbd_b_report_trans_ongoing = |
| 193 | udd_ep_run(UDI_HID_KBD_EP_IN | USB_EP_DIR_IN, | 193 | udd_ep_run(UDI_HID_KBD_EP_IN | USB_EP_DIR_IN, |
| @@ -249,7 +249,7 @@ bool udi_hid_nkro_b_report_valid; | |||
| 249 | COMPILER_WORD_ALIGNED | 249 | COMPILER_WORD_ALIGNED |
| 250 | uint8_t udi_hid_nkro_report[UDI_HID_NKRO_REPORT_SIZE]; | 250 | uint8_t udi_hid_nkro_report[UDI_HID_NKRO_REPORT_SIZE]; |
| 251 | 251 | ||
| 252 | static bool udi_hid_nkro_b_report_trans_ongoing; | 252 | volatile bool udi_hid_nkro_b_report_trans_ongoing; |
| 253 | 253 | ||
| 254 | COMPILER_WORD_ALIGNED | 254 | COMPILER_WORD_ALIGNED |
| 255 | static uint8_t udi_hid_nkro_report_trans[UDI_HID_NKRO_REPORT_SIZE]; | 255 | static uint8_t udi_hid_nkro_report_trans[UDI_HID_NKRO_REPORT_SIZE]; |
| @@ -355,7 +355,7 @@ bool udi_hid_nkro_send_report(void) | |||
| 355 | return false; | 355 | return false; |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | memcpy(udi_hid_nkro_report_trans, udi_hid_nkro_report,UDI_HID_NKRO_REPORT_SIZE); | 358 | memcpy(udi_hid_nkro_report_trans, udi_hid_nkro_report, UDI_HID_NKRO_REPORT_SIZE); |
| 359 | udi_hid_nkro_b_report_valid = false; | 359 | udi_hid_nkro_b_report_valid = false; |
| 360 | udi_hid_nkro_b_report_trans_ongoing = | 360 | udi_hid_nkro_b_report_trans_ongoing = |
| 361 | udd_ep_run(UDI_HID_NKRO_EP_IN | USB_EP_DIR_IN, | 361 | udd_ep_run(UDI_HID_NKRO_EP_IN | USB_EP_DIR_IN, |
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.h b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.h index 9a2741534..babfdb7a7 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.h +++ b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.h | |||
| @@ -60,6 +60,7 @@ extern "C" { | |||
| 60 | #ifdef KBD | 60 | #ifdef KBD |
| 61 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_kbd; | 61 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_kbd; |
| 62 | extern bool udi_hid_kbd_b_report_valid; | 62 | extern bool udi_hid_kbd_b_report_valid; |
| 63 | extern volatile bool udi_hid_kbd_b_report_trans_ongoing; | ||
| 63 | extern uint8_t udi_hid_kbd_report_set; | 64 | extern uint8_t udi_hid_kbd_report_set; |
| 64 | bool udi_hid_kbd_send_report(void); | 65 | bool udi_hid_kbd_send_report(void); |
| 65 | #endif //KBD | 66 | #endif //KBD |
| @@ -70,6 +71,7 @@ bool udi_hid_kbd_send_report(void); | |||
| 70 | #ifdef NKRO | 71 | #ifdef NKRO |
| 71 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_nkro; | 72 | extern UDC_DESC_STORAGE udi_api_t udi_api_hid_nkro; |
| 72 | extern bool udi_hid_nkro_b_report_valid; | 73 | extern bool udi_hid_nkro_b_report_valid; |
| 74 | extern volatile bool udi_hid_nkro_b_report_trans_ongoing; | ||
| 73 | bool udi_hid_nkro_send_report(void); | 75 | bool udi_hid_nkro_send_report(void); |
| 74 | #endif //NKRO | 76 | #endif //NKRO |
| 75 | 77 | ||
