From f108623011a17c04de202fb13dccdda72893655f Mon Sep 17 00:00:00 2001 From: flabbergast Date: Thu, 3 Dec 2015 08:49:55 +0000 Subject: [PATCH] Add maple mini code. --- keyboard/stm32_f103_onekey/Makefile | 15 ++- keyboard/stm32_f103_onekey/chconf.h | 8 +- keyboard/stm32_f103_onekey/led.c | 16 ++- keyboard/stm32_f103_onekey/matrix.c | 14 +++ keyboard/stm32_f103_onekey/mcuconf.h | 145 +++++++++++++++++---------- tmk_core/protocol/chibios/usb_main.c | 4 +- 6 files changed, 133 insertions(+), 69 deletions(-) diff --git a/keyboard/stm32_f103_onekey/Makefile b/keyboard/stm32_f103_onekey/Makefile index ea2ee08b..89e58144 100644 --- a/keyboard/stm32_f103_onekey/Makefile +++ b/keyboard/stm32_f103_onekey/Makefile @@ -1,6 +1,5 @@ # Target file name (without extension). PROJECT = ch -TARGET = alps64 # Directory common source files exist TMK_DIR = ../../tmk_core @@ -26,14 +25,14 @@ CONFIG_H = config.h # BOARD = GENERIC_STM32_F103 # GENERIC STM32F103C8T6 board - no bootloader (programmer over serial or SWD) -OPT_DEFS = -MCU_LDSCRIPT = STM32F103x8 -BOARD = GENERIC_STM32_F103 +# OPT_DEFS = +# MCU_LDSCRIPT = STM32F103x8 +# BOARD = GENERIC_STM32_F103 # MAPLE MINI -# OPT_DEFS = -DCORTEX_VTOR_INIT=0x5000 -# MCU_LDSCRIPT = STM32F103xE_maplemini_bootloader.ld -# BOARD = MAPLEMINI_STM32_F103 +OPT_DEFS = -DCORTEX_VTOR_INIT=0x5000 +MCU_LDSCRIPT = STM32F103xE_maplemini_bootloader +BOARD = MAPLEMINI_STM32_F103 ## chip/board settings # the next two should match the directories in @@ -71,7 +70,7 @@ ARMV = 7 ## BOOTMAGIC is not supported on STM32 chips yet. MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug +# CONSOLE_ENABLE = yes # Console for debug COMMAND_ENABLE = yes # Commands for debug and configuration SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover diff --git a/keyboard/stm32_f103_onekey/chconf.h b/keyboard/stm32_f103_onekey/chconf.h index 689d4b39..acce6a1f 100644 --- a/keyboard/stm32_f103_onekey/chconf.h +++ b/keyboard/stm32_f103_onekey/chconf.h @@ -46,7 +46,7 @@ * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ -#define CH_CFG_ST_FREQUENCY 10000 +#define CH_CFG_ST_FREQUENCY 2000 /** * @brief Time delta constant for the tick-less mode. @@ -124,7 +124,7 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ -#define CH_CFG_OPTIMIZE_SPEED FALSE +#define CH_CFG_OPTIMIZE_SPEED TRUE /** @} */ @@ -281,7 +281,7 @@ * * @note The default is @p TRUE. */ -#define CH_CFG_USE_MEMCORE FALSE +#define CH_CFG_USE_MEMCORE TRUE /** * @brief Heap Allocator APIs. @@ -293,7 +293,7 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ -#define CH_CFG_USE_HEAP FALSE +#define CH_CFG_USE_HEAP TRUE /** * @brief Memory Pools Allocator APIs. diff --git a/keyboard/stm32_f103_onekey/led.c b/keyboard/stm32_f103_onekey/led.c index ddacfd8c..3c86963c 100644 --- a/keyboard/stm32_f103_onekey/led.c +++ b/keyboard/stm32_f103_onekey/led.c @@ -22,11 +22,25 @@ along with this program. If not, see . void led_set(uint8_t usb_led) { if (usb_led & (1<CTL &= ~USBx_CTL_RESUME; #endif /* KINETIS_USB_USE_USB0 */ -#elif defined(STM32F0XX) /* K20x || KL2x */ +#elif defined(STM32F0XX) || defined(STM32F1XX) /* K20x || KL2x */ STM32_USB->CNTR |= CNTR_RESUME; chThdSleepMilliseconds(15); STM32_USB->CNTR &= ~CNTR_RESUME; -#else /* STM32F0XX */ +#else /* STM32F0XX || STM32F1XX */ #warning Sending remote wakeup packet not implemented for your platform. #endif /* K20x || KL2x */ }