diff options
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/chibios.mk | 3 | ||||
| -rw-r--r-- | tmk_core/common.mk | 1 | ||||
| -rw-r--r-- | tmk_core/common/keyboard.c | 2 | ||||
| -rw-r--r-- | tmk_core/common/mousekey.c | 82 | ||||
| -rw-r--r-- | tmk_core/common/mousekey.h | 37 | ||||
| -rw-r--r-- | tmk_core/common/sync_timer.c | 58 | ||||
| -rw-r--r-- | tmk_core/common/sync_timer.h | 54 | ||||
| -rw-r--r-- | tmk_core/protocol/arm_atsam/i2c_master.c | 3 | ||||
| -rw-r--r-- | tmk_core/protocol/arm_atsam/i2c_master.h | 4 |
9 files changed, 240 insertions, 4 deletions
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index 733f2d60f..5a3facf8e 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk | |||
| @@ -71,6 +71,9 @@ else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/$(BOARD)/board/board.mk)"," | |||
| 71 | BOARD_PATH = $(TOP_DIR)/platforms/chibios/$(BOARD) | 71 | BOARD_PATH = $(TOP_DIR)/platforms/chibios/$(BOARD) |
| 72 | BOARD_MK += $(TOP_DIR)/platforms/chibios/$(BOARD)/board/board.mk | 72 | BOARD_MK += $(TOP_DIR)/platforms/chibios/$(BOARD)/board/board.mk |
| 73 | KEYBOARD_PATHS += $(BOARD_PATH)/configs | 73 | KEYBOARD_PATHS += $(BOARD_PATH)/configs |
| 74 | ifneq ("$(wildcard $(BOARD_PATH)/rules.mk)","") | ||
| 75 | include $(BOARD_PATH)/rules.mk | ||
| 76 | endif | ||
| 74 | endif | 77 | endif |
| 75 | 78 | ||
| 76 | ifeq ("$(wildcard $(BOARD_MK))","") | 79 | ifeq ("$(wildcard $(BOARD_MK))","") |
diff --git a/tmk_core/common.mk b/tmk_core/common.mk index fdf2aa097..05839824c 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk | |||
| @@ -18,6 +18,7 @@ TMK_COMMON_SRC += $(COMMON_DIR)/host.c \ | |||
| 18 | $(COMMON_DIR)/report.c \ | 18 | $(COMMON_DIR)/report.c \ |
| 19 | $(PLATFORM_COMMON_DIR)/suspend.c \ | 19 | $(PLATFORM_COMMON_DIR)/suspend.c \ |
| 20 | $(PLATFORM_COMMON_DIR)/timer.c \ | 20 | $(PLATFORM_COMMON_DIR)/timer.c \ |
| 21 | $(COMMON_DIR)/sync_timer.c \ | ||
| 21 | $(PLATFORM_COMMON_DIR)/bootloader.c \ | 22 | $(PLATFORM_COMMON_DIR)/bootloader.c \ |
| 22 | 23 | ||
| 23 | ifeq ($(PLATFORM),AVR) | 24 | ifeq ($(PLATFORM),AVR) |
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 8c7bdc8b5..a1fbc01da 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
| @@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 23 | #include "led.h" | 23 | #include "led.h" |
| 24 | #include "keycode.h" | 24 | #include "keycode.h" |
| 25 | #include "timer.h" | 25 | #include "timer.h" |
| 26 | #include "sync_timer.h" | ||
| 26 | #include "print.h" | 27 | #include "print.h" |
| 27 | #include "debug.h" | 28 | #include "debug.h" |
| 28 | #include "command.h" | 29 | #include "command.h" |
| @@ -255,6 +256,7 @@ __attribute__((weak)) void housekeeping_task_user(void) {} | |||
| 255 | */ | 256 | */ |
| 256 | void keyboard_init(void) { | 257 | void keyboard_init(void) { |
| 257 | timer_init(); | 258 | timer_init(); |
| 259 | sync_timer_init(); | ||
| 258 | matrix_init(); | 260 | matrix_init(); |
| 259 | #ifdef VIA_ENABLE | 261 | #ifdef VIA_ENABLE |
| 260 | via_init(); | 262 | via_init(); |
diff --git a/tmk_core/common/mousekey.c b/tmk_core/common/mousekey.c index ef18bcf1a..697e0692c 100644 --- a/tmk_core/common/mousekey.c +++ b/tmk_core/common/mousekey.c | |||
| @@ -36,6 +36,9 @@ static void mousekey_debug(void); | |||
| 36 | static uint8_t mousekey_accel = 0; | 36 | static uint8_t mousekey_accel = 0; |
| 37 | static uint8_t mousekey_repeat = 0; | 37 | static uint8_t mousekey_repeat = 0; |
| 38 | static uint8_t mousekey_wheel_repeat = 0; | 38 | static uint8_t mousekey_wheel_repeat = 0; |
| 39 | #ifdef MK_KINETIC_SPEED | ||
| 40 | static uint16_t mouse_timer = 0; | ||
| 41 | #endif | ||
| 39 | 42 | ||
| 40 | #ifndef MK_3_SPEED | 43 | #ifndef MK_3_SPEED |
| 41 | 44 | ||
| @@ -43,7 +46,7 @@ static uint16_t last_timer_c = 0; | |||
| 43 | static uint16_t last_timer_w = 0; | 46 | static uint16_t last_timer_w = 0; |
| 44 | 47 | ||
| 45 | /* | 48 | /* |
| 46 | * Mouse keys acceleration algorithm | 49 | * Mouse keys acceleration algorithm |
| 47 | * http://en.wikipedia.org/wiki/Mouse_keys | 50 | * http://en.wikipedia.org/wiki/Mouse_keys |
| 48 | * | 51 | * |
| 49 | * speed = delta * max_speed * (repeat / time_to_max)**((1000+curve)/1000) | 52 | * speed = delta * max_speed * (repeat / time_to_max)**((1000+curve)/1000) |
| @@ -105,6 +108,69 @@ static uint8_t wheel_unit(void) { | |||
| 105 | } | 108 | } |
| 106 | 109 | ||
| 107 | # else /* #ifndef MK_COMBINED */ | 110 | # else /* #ifndef MK_COMBINED */ |
| 111 | # ifndef MK_KINETIC_SPEED | ||
| 112 | |||
| 113 | /* | ||
| 114 | * Kinetic movement acceleration algorithm | ||
| 115 | * | ||
| 116 | * current speed = I + A * T/50 + A * 0.5 * T^2 | maximum B | ||
| 117 | * | ||
| 118 | * T: time since the mouse movement started | ||
| 119 | * E: mouse events per second (set through MOUSEKEY_INTERVAL, UHK sends 250, the | ||
| 120 | * pro micro on my Signum 3.0 sends only 125!) | ||
| 121 | * I: initial speed at time 0 | ||
| 122 | * A: acceleration | ||
| 123 | * B: base mouse travel speed | ||
| 124 | */ | ||
| 125 | const uint16_t mk_accelerated_speed = MOUSEKEY_ACCELERATED_SPEED; | ||
| 126 | const uint16_t mk_base_speed = MOUSEKEY_BASE_SPEED; | ||
| 127 | const uint16_t mk_decelerated_speed = MOUSEKEY_DECELERATED_SPEED; | ||
| 128 | const uint16_t mk_initial_speed = MOUSEKEY_INITIAL_SPEED; | ||
| 129 | |||
| 130 | static uint8_t move_unit(void) { | ||
| 131 | float speed = mk_initial_speed; | ||
| 132 | |||
| 133 | if (mousekey_accel & ((1<<0) | (1<<2))) { | ||
| 134 | speed = mousekey_accel & (1<<2) ? mk_accelerated_speed : mk_decelerated_speed; | ||
| 135 | } else if (mousekey_repeat && mouse_timer) { | ||
| 136 | const float time_elapsed = timer_elapsed(mouse_timer) / 50; | ||
| 137 | speed = mk_initial_speed + | ||
| 138 | MOUSEKEY_MOVE_DELTA * time_elapsed + | ||
| 139 | MOUSEKEY_MOVE_DELTA * 0.5 * time_elapsed * time_elapsed; | ||
| 140 | |||
| 141 | speed = speed > mk_base_speed ? mk_base_speed : speed; | ||
| 142 | } | ||
| 143 | |||
| 144 | /* convert speed to USB mouse speed 1 to 127 */ | ||
| 145 | speed = (uint8_t)(speed / (1000.0f / mk_interval)); | ||
| 146 | speed = speed < 1 ? 1 : speed; | ||
| 147 | |||
| 148 | return speed > MOUSEKEY_MOVE_MAX ? MOUSEKEY_MOVE_MAX : speed; | ||
| 149 | } | ||
| 150 | |||
| 151 | float mk_wheel_interval = 1000.0f / MOUSEKEY_WHEEL_INITIAL_MOVEMENTS; | ||
| 152 | |||
| 153 | static uint8_t wheel_unit(void) { | ||
| 154 | float speed = MOUSEKEY_WHEEL_INITIAL_MOVEMENTS; | ||
| 155 | |||
| 156 | if (mousekey_accel & ((1<<0) | (1<<2))) { | ||
| 157 | speed = mousekey_accel & (1<<2) ? MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS : MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS; | ||
| 158 | } else if (mousekey_repeat && mouse_timer) { | ||
| 159 | if (mk_wheel_interval != MOUSEKEY_WHEEL_BASE_MOVEMENTS) { | ||
| 160 | const float time_elapsed = timer_elapsed(mouse_timer) / 50; | ||
| 161 | speed = MOUSEKEY_WHEEL_INITIAL_MOVEMENTS + | ||
| 162 | 1 * time_elapsed + | ||
| 163 | 1 * 0.5 * time_elapsed * time_elapsed; | ||
| 164 | } | ||
| 165 | speed = speed > MOUSEKEY_WHEEL_BASE_MOVEMENTS ? MOUSEKEY_WHEEL_BASE_MOVEMENTS : speed; | ||
| 166 | } | ||
| 167 | |||
| 168 | mk_wheel_interval = 1000.0f / speed; | ||
| 169 | |||
| 170 | return 1; | ||
| 171 | } | ||
| 172 | |||
| 173 | # else /* #ifndef MK_KINETIC_SPEED */ | ||
| 108 | 174 | ||
| 109 | static uint8_t move_unit(void) { | 175 | static uint8_t move_unit(void) { |
| 110 | uint16_t unit; | 176 | uint16_t unit; |
| @@ -142,6 +208,7 @@ static uint8_t wheel_unit(void) { | |||
| 142 | return (unit > MOUSEKEY_WHEEL_MAX ? MOUSEKEY_WHEEL_MAX : (unit == 0 ? 1 : unit)); | 208 | return (unit > MOUSEKEY_WHEEL_MAX ? MOUSEKEY_WHEEL_MAX : (unit == 0 ? 1 : unit)); |
| 143 | } | 209 | } |
| 144 | 210 | ||
| 211 | # endif /* #ifndef MK_KINETIC_SPEED */ | ||
| 145 | # endif /* #ifndef MK_COMBINED */ | 212 | # endif /* #ifndef MK_COMBINED */ |
| 146 | 213 | ||
| 147 | void mousekey_task(void) { | 214 | void mousekey_task(void) { |
| @@ -193,6 +260,12 @@ void mousekey_task(void) { | |||
| 193 | } | 260 | } |
| 194 | 261 | ||
| 195 | void mousekey_on(uint8_t code) { | 262 | void mousekey_on(uint8_t code) { |
| 263 | #ifdef MK_KINETIC_SPEED | ||
| 264 | if (mouse_timer == 0) { | ||
| 265 | mouse_timer = timer_read(); | ||
| 266 | } | ||
| 267 | #endif /* #ifdef MK_KINETIC_SPEED */ | ||
| 268 | |||
| 196 | if (code == KC_MS_UP) | 269 | if (code == KC_MS_UP) |
| 197 | mouse_report.y = move_unit() * -1; | 270 | mouse_report.y = move_unit() * -1; |
| 198 | else if (code == KC_MS_DOWN) | 271 | else if (code == KC_MS_DOWN) |
| @@ -260,7 +333,12 @@ void mousekey_off(uint8_t code) { | |||
| 260 | mousekey_accel &= ~(1 << 1); | 333 | mousekey_accel &= ~(1 << 1); |
| 261 | else if (code == KC_MS_ACCEL2) | 334 | else if (code == KC_MS_ACCEL2) |
| 262 | mousekey_accel &= ~(1 << 2); | 335 | mousekey_accel &= ~(1 << 2); |
| 263 | if (mouse_report.x == 0 && mouse_report.y == 0) mousekey_repeat = 0; | 336 | if (mouse_report.x == 0 && mouse_report.y == 0) { |
| 337 | mousekey_repeat = 0; | ||
| 338 | #ifdef MK_KINETIC_SPEED | ||
| 339 | mouse_timer = 0; | ||
| 340 | #endif /* #ifdef MK_KINETIC_SPEED */ | ||
| 341 | } | ||
| 264 | if (mouse_report.v == 0 && mouse_report.h == 0) mousekey_wheel_repeat = 0; | 342 | if (mouse_report.v == 0 && mouse_report.h == 0) mousekey_wheel_repeat = 0; |
| 265 | } | 343 | } |
| 266 | 344 | ||
diff --git a/tmk_core/common/mousekey.h b/tmk_core/common/mousekey.h index 05e453823..703854b82 100644 --- a/tmk_core/common/mousekey.h +++ b/tmk_core/common/mousekey.h | |||
| @@ -38,16 +38,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 38 | # endif | 38 | # endif |
| 39 | 39 | ||
| 40 | # ifndef MOUSEKEY_MOVE_DELTA | 40 | # ifndef MOUSEKEY_MOVE_DELTA |
| 41 | #ifndef MK_KINETIC_SPEED | ||
| 41 | # define MOUSEKEY_MOVE_DELTA 5 | 42 | # define MOUSEKEY_MOVE_DELTA 5 |
| 43 | #else | ||
| 44 | # define MOUSEKEY_MOVE_DELTA 25 | ||
| 45 | #endif | ||
| 42 | # endif | 46 | # endif |
| 43 | # ifndef MOUSEKEY_WHEEL_DELTA | 47 | # ifndef MOUSEKEY_WHEEL_DELTA |
| 44 | # define MOUSEKEY_WHEEL_DELTA 1 | 48 | # define MOUSEKEY_WHEEL_DELTA 1 |
| 45 | # endif | 49 | # endif |
| 46 | # ifndef MOUSEKEY_DELAY | 50 | # ifndef MOUSEKEY_DELAY |
| 51 | #ifndef MK_KINETIC_SPEED | ||
| 47 | # define MOUSEKEY_DELAY 300 | 52 | # define MOUSEKEY_DELAY 300 |
| 53 | #else | ||
| 54 | # define MOUSEKEY_DELAY 8 | ||
| 55 | #endif | ||
| 48 | # endif | 56 | # endif |
| 49 | # ifndef MOUSEKEY_INTERVAL | 57 | # ifndef MOUSEKEY_INTERVAL |
| 58 | #ifndef MK_KINETIC_SPEED | ||
| 50 | # define MOUSEKEY_INTERVAL 50 | 59 | # define MOUSEKEY_INTERVAL 50 |
| 60 | #else | ||
| 61 | # define MOUSEKEY_INTERVAL 8 | ||
| 62 | #endif | ||
| 51 | # endif | 63 | # endif |
| 52 | # ifndef MOUSEKEY_MAX_SPEED | 64 | # ifndef MOUSEKEY_MAX_SPEED |
| 53 | # define MOUSEKEY_MAX_SPEED 10 | 65 | # define MOUSEKEY_MAX_SPEED 10 |
| @@ -68,6 +80,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 68 | # define MOUSEKEY_WHEEL_TIME_TO_MAX 40 | 80 | # define MOUSEKEY_WHEEL_TIME_TO_MAX 40 |
| 69 | # endif | 81 | # endif |
| 70 | 82 | ||
| 83 | #ifndef MOUSEKEY_INITIAL_SPEED | ||
| 84 | #define MOUSEKEY_INITIAL_SPEED 100 | ||
| 85 | #endif | ||
| 86 | #ifndef MOUSEKEY_BASE_SPEED | ||
| 87 | #define MOUSEKEY_BASE_SPEED 1000 | ||
| 88 | #endif | ||
| 89 | #ifndef MOUSEKEY_DECELERATED_SPEED | ||
| 90 | #define MOUSEKEY_DECELERATED_SPEED 400 | ||
| 91 | #endif | ||
| 92 | #ifndef MOUSEKEY_ACCELERATED_SPEED | ||
| 93 | #define MOUSEKEY_ACCELERATED_SPEED 3000 | ||
| 94 | #endif | ||
| 95 | #ifndef MOUSEKEY_WHEEL_INITIAL_MOVEMENTS | ||
| 96 | #define MOUSEKEY_WHEEL_INITIAL_MOVEMENTS 16 | ||
| 97 | #endif | ||
| 98 | #ifndef MOUSEKEY_WHEEL_BASE_MOVEMENTS | ||
| 99 | #define MOUSEKEY_WHEEL_BASE_MOVEMENTS 32 | ||
| 100 | #endif | ||
| 101 | #ifndef MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS | ||
| 102 | #define MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS 48 | ||
| 103 | #endif | ||
| 104 | #ifndef MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS | ||
| 105 | #define MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS 8 | ||
| 106 | #endif | ||
| 107 | |||
| 71 | #else /* #ifndef MK_3_SPEED */ | 108 | #else /* #ifndef MK_3_SPEED */ |
| 72 | 109 | ||
| 73 | # ifndef MK_C_OFFSET_UNMOD | 110 | # ifndef MK_C_OFFSET_UNMOD |
diff --git a/tmk_core/common/sync_timer.c b/tmk_core/common/sync_timer.c new file mode 100644 index 000000000..de24b463b --- /dev/null +++ b/tmk_core/common/sync_timer.c | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | /* | ||
| 2 | Copyright (C) 2020 Ryan Caltabiano <https://github.com/XScorpion2> | ||
| 3 | |||
| 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 5 | this software and associated documentation files (the "Software"), to deal in | ||
| 6 | the Software without restriction, including without limitation the rights to | ||
| 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
| 8 | of the Software, and to permit persons to whom the Software is furnished to do | ||
| 9 | so, subject to the following conditions: | ||
| 10 | |||
| 11 | The above copyright notice and this permission notice shall be included in all | ||
| 12 | copies or substantial portions of the Software. | ||
| 13 | |||
| 14 | If you happen to meet one of the copyright holders in a bar you are obligated | ||
| 15 | to buy them one pint of beer. | ||
| 16 | |||
| 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 23 | SOFTWARE. | ||
| 24 | */ | ||
| 25 | |||
| 26 | #include "sync_timer.h" | ||
| 27 | #include "keyboard.h" | ||
| 28 | |||
| 29 | #if defined(SPLIT_KEYBOARD) && !defined(DISABLE_SYNC_TIMER) | ||
| 30 | volatile int32_t sync_timer_ms; | ||
| 31 | |||
| 32 | void sync_timer_init(void) { sync_timer_ms = 0; } | ||
| 33 | |||
| 34 | void sync_timer_update(uint32_t time) { | ||
| 35 | if (is_keyboard_master()) return; | ||
| 36 | sync_timer_ms = time - timer_read32(); | ||
| 37 | } | ||
| 38 | |||
| 39 | uint16_t sync_timer_read(void) { | ||
| 40 | if (is_keyboard_master()) return timer_read(); | ||
| 41 | return sync_timer_read32(); | ||
| 42 | } | ||
| 43 | |||
| 44 | uint32_t sync_timer_read32(void) { | ||
| 45 | if (is_keyboard_master()) return timer_read32(); | ||
| 46 | return sync_timer_ms + timer_read32(); | ||
| 47 | } | ||
| 48 | |||
| 49 | uint16_t sync_timer_elapsed(uint16_t last) { | ||
| 50 | if (is_keyboard_master()) return timer_elapsed(last); | ||
| 51 | return TIMER_DIFF_16(sync_timer_read(), last); | ||
| 52 | } | ||
| 53 | |||
| 54 | uint32_t sync_timer_elapsed32(uint32_t last) { | ||
| 55 | if (is_keyboard_master()) return timer_elapsed32(last); | ||
| 56 | return TIMER_DIFF_32(sync_timer_read32(), last); | ||
| 57 | } | ||
| 58 | #endif | ||
diff --git a/tmk_core/common/sync_timer.h b/tmk_core/common/sync_timer.h new file mode 100644 index 000000000..9ddef45bb --- /dev/null +++ b/tmk_core/common/sync_timer.h | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | /* | ||
| 2 | Copyright (C) 2020 Ryan Caltabiano <https://github.com/XScorpion2> | ||
| 3 | |||
| 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 5 | this software and associated documentation files (the "Software"), to deal in | ||
| 6 | the Software without restriction, including without limitation the rights to | ||
| 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
| 8 | of the Software, and to permit persons to whom the Software is furnished to do | ||
| 9 | so, subject to the following conditions: | ||
| 10 | |||
| 11 | The above copyright notice and this permission notice shall be included in all | ||
| 12 | copies or substantial portions of the Software. | ||
| 13 | |||
| 14 | If you happen to meet one of the copyright holders in a bar you are obligated | ||
| 15 | to buy them one pint of beer. | ||
| 16 | |||
| 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 23 | SOFTWARE. | ||
| 24 | */ | ||
| 25 | |||
| 26 | #pragma once | ||
| 27 | |||
| 28 | #include <stdint.h> | ||
| 29 | #include "timer.h" | ||
| 30 | |||
| 31 | #ifdef __cplusplus | ||
| 32 | extern "C" { | ||
| 33 | #endif | ||
| 34 | |||
| 35 | #if defined(SPLIT_KEYBOARD) && !defined(DISABLE_SYNC_TIMER) | ||
| 36 | void sync_timer_init(void); | ||
| 37 | void sync_timer_update(uint32_t time); | ||
| 38 | uint16_t sync_timer_read(void); | ||
| 39 | uint32_t sync_timer_read32(void); | ||
| 40 | uint16_t sync_timer_elapsed(uint16_t last); | ||
| 41 | uint32_t sync_timer_elapsed32(uint32_t last); | ||
| 42 | #else | ||
| 43 | # define sync_timer_init() | ||
| 44 | # define sync_timer_clear() | ||
| 45 | # define sync_timer_update(t) | ||
| 46 | # define sync_timer_read() timer_read() | ||
| 47 | # define sync_timer_read32() timer_read32() | ||
| 48 | # define sync_timer_elapsed(t) timer_elapsed(t) | ||
| 49 | # define sync_timer_elapsed32(t) timer_elapsed32(t) | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #ifdef __cplusplus | ||
| 53 | } | ||
| 54 | #endif | ||
diff --git a/tmk_core/protocol/arm_atsam/i2c_master.c b/tmk_core/protocol/arm_atsam/i2c_master.c index d3319ab44..dda2f85b0 100644 --- a/tmk_core/protocol/arm_atsam/i2c_master.c +++ b/tmk_core/protocol/arm_atsam/i2c_master.c | |||
| @@ -28,6 +28,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 28 | 28 | ||
| 29 | # define I2C_LED_USE_DMA 1 // Set 1 to use background DMA transfers for leds, Set 0 to use inline software transfers | 29 | # define I2C_LED_USE_DMA 1 // Set 1 to use background DMA transfers for leds, Set 0 to use inline software transfers |
| 30 | 30 | ||
| 31 | DmacDescriptor dmac_desc; | ||
| 32 | DmacDescriptor dmac_desc_wb; | ||
| 33 | |||
| 31 | static uint8_t i2c_led_q[I2C_Q_SIZE]; // I2C queue circular buffer | 34 | static uint8_t i2c_led_q[I2C_Q_SIZE]; // I2C queue circular buffer |
| 32 | static uint8_t i2c_led_q_s; // Start of circular buffer | 35 | static uint8_t i2c_led_q_s; // Start of circular buffer |
| 33 | static uint8_t i2c_led_q_e; // End of circular buffer | 36 | static uint8_t i2c_led_q_e; // End of circular buffer |
diff --git a/tmk_core/protocol/arm_atsam/i2c_master.h b/tmk_core/protocol/arm_atsam/i2c_master.h index 44dbdfbff..68773f213 100644 --- a/tmk_core/protocol/arm_atsam/i2c_master.h +++ b/tmk_core/protocol/arm_atsam/i2c_master.h | |||
| @@ -24,8 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 24 | # include "issi3733_driver.h" | 24 | # include "issi3733_driver.h" |
| 25 | # include "config.h" | 25 | # include "config.h" |
| 26 | 26 | ||
| 27 | __attribute__((__aligned__(16))) DmacDescriptor dmac_desc; | 27 | extern __attribute__((__aligned__(16))) DmacDescriptor dmac_desc; |
| 28 | __attribute__((__aligned__(16))) DmacDescriptor dmac_desc_wb; | 28 | extern __attribute__((__aligned__(16))) DmacDescriptor dmac_desc_wb; |
| 29 | 29 | ||
| 30 | uint8_t I2C3733_Init_Control(void); | 30 | uint8_t I2C3733_Init_Control(void); |
| 31 | uint8_t I2C3733_Init_Drivers(void); | 31 | uint8_t I2C3733_Init_Drivers(void); |
