diff --git a/keyboards/ducky/one2mini/chconf.h b/keyboards/ducky/one2mini/chconf.h index ab5a639bebb..e38ab008671 100644 --- a/keyboards/ducky/one2mini/chconf.h +++ b/keyboards/ducky/one2mini/chconf.h @@ -41,7 +41,7 @@ /** * @brief System time counter resolution. - * @note Allowed values are 16 or 32 bits. + * @note Allowed values are 16, 32 or 64 bits. */ #if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 @@ -80,7 +80,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -103,20 +105,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 0 - -/** - * @brief Managed RAM size. - * @details Size of the RAM area to be managed by the OS. If set to zero - * then the whole available RAM is used. The core memory is made - * available to the heap allocator and/or can be used directly through - * the simplified core memory allocator. - * - * @note In order to let the OS manage the whole RAM the linker script must - * provide the @p __heap_base__ and @p __heap_end__ symbols. - * @note Requires @p CH_CFG_USE_MEMCORE. - */ -#define CH_CFG_MEMCORE_SIZE 0 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -125,7 +116,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ -#define CH_CFG_NO_IDLE_THREAD FALSE +#if !defined(CH_CFG_NO_IDLE_THREAD) +#define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -145,7 +138,7 @@ * @note The default is @p TRUE. */ #if !defined(CH_CFG_OPTIMIZE_SPEED) -#define CH_CFG_OPTIMIZE_SPEED FALSE +#define CH_CFG_OPTIMIZE_SPEED TRUE #endif /** @} */ @@ -164,7 +157,9 @@ * * @note The default is @p TRUE. */ -#define CH_CFG_USE_TM FALSE +#if !defined(CH_CFG_USE_TM) +#define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -172,7 +167,9 @@ * * @note The default is @p TRUE. */ -#define CH_CFG_USE_REGISTRY TRUE +#if !defined(CH_CFG_USE_REGISTRY) +#define CH_CFG_USE_REGISTRY FALSE +#endif /** * @brief Threads synchronization APIs. @@ -181,7 +178,9 @@ * * @note The default is @p TRUE. */ -#define CH_CFG_USE_WAITEXIT TRUE +#if !defined(CH_CFG_USE_WAITEXIT) +#define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -189,7 +188,9 @@ * * @note The default is @p TRUE. */ -#define CH_CFG_USE_SEMAPHORES TRUE +#if !defined(CH_CFG_USE_SEMAPHORES) +#define CH_CFG_USE_SEMAPHORES FALSE +#endif /** * @brief Semaphores queuing mode. @@ -200,7 +201,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ -#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) +#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -208,7 +211,9 @@ * * @note The default is @p TRUE. */ -#define CH_CFG_USE_MUTEXES TRUE +#if !defined(CH_CFG_USE_MUTEXES) +#define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -218,7 +223,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ -#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) +#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -228,7 +235,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ -#define CH_CFG_USE_CONDVARS TRUE +#if !defined(CH_CFG_USE_CONDVARS) +#define CH_CFG_USE_CONDVARS FALSE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -238,7 +247,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ -#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) +#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE +#endif /** * @brief Events Flags APIs. @@ -246,7 +257,9 @@ * * @note The default is @p TRUE. */ -#define CH_CFG_USE_EVENTS TRUE +#if !defined(CH_CFG_USE_EVENTS) +#define CH_CFG_USE_EVENTS FALSE +#endif /** * @brief Events Flags APIs with timeout. @@ -256,7 +269,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ -#define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) +#define CH_CFG_USE_EVENTS_TIMEOUT FALSE +#endif /** * @brief Synchronous Messages APIs. @@ -265,7 +280,9 @@ * * @note The default is @p TRUE. */ -#define CH_CFG_USE_MESSAGES TRUE +#if !defined(CH_CFG_USE_MESSAGES) +#define CH_CFG_USE_MESSAGES FALSE +#endif /** * @brief Synchronous Messages queuing mode. @@ -276,7 +293,31 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ -#define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) +#define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif + +/** + * @brief Dynamic Threads APIs. + * @details If enabled then the dynamic threads creation APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_WAITEXIT. + * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. + */ +#if !defined(CH_CFG_USE_DYNAMIC) +#define CH_CFG_USE_DYNAMIC FALSE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name OSLIB options + * @{ + */ +/*===========================================================================*/ /** * @brief Mailboxes APIs. @@ -295,7 +336,24 @@ * * @note The default is @p TRUE. */ -#define CH_CFG_USE_MEMCORE FALSE +#if !defined(CH_CFG_USE_MEMCORE) +#define CH_CFG_USE_MEMCORE TRUE +#endif + +/** + * @brief Managed RAM size. + * @details Size of the RAM area to be managed by the OS. If set to zero + * then the whole available RAM is used. The core memory is made + * available to the heap allocator and/or can be used directly through + * the simplified core memory allocator. + * + * @note In order to let the OS manage the whole RAM the linker script must + * provide the @p __heap_base__ and @p __heap_end__ symbols. + * @note Requires @p CH_CFG_USE_MEMCORE. + */ +#if !defined(CH_CFG_MEMCORE_SIZE) +#define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Heap Allocator APIs. @@ -343,15 +401,38 @@ #endif /** - * @brief Dynamic Threads APIs. - * @details If enabled then the dynamic threads creation APIs are included + * @brief Objects Caches APIs. + * @details If enabled then the objects caches APIs are included * in the kernel. * * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_WAITEXIT. - * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ -#define CH_CFG_USE_DYNAMIC FALSE +#if !defined(CH_CFG_USE_OBJ_CACHES) +#define CH_CFG_USE_OBJ_CACHES TRUE +#endif + +/** + * @brief Delegate threads APIs. + * @details If enabled then the delegate threads APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_DELEGATES) +#define CH_CFG_USE_DELEGATES TRUE +#endif + +/** + * @brief Jobs Queues APIs. + * @details If enabled then the jobs queues APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_JOBS) +#define CH_CFG_USE_JOBS TRUE +#endif + /** @} */ /*===========================================================================*/ @@ -437,7 +518,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_STATISTICS FALSE +#if !defined(CH_DBG_STATISTICS) +#define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -446,7 +529,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#endif /** * @brief Debug option, parameters checks. @@ -455,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS FALSE +#endif /** * @brief Debug option, consistency checks. @@ -465,7 +552,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS FALSE +#endif /** * @brief Debug option, trace buffer. @@ -473,14 +562,18 @@ * * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED +#endif /** * @brief Trace buffer entries. * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_TRACE_BUFFER_SIZE 128 +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -492,7 +585,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK FALSE +#endif /** * @brief Debug option, stacks initialization. @@ -502,7 +597,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS FALSE +#endif /** * @brief Debug option, threads profiling. @@ -513,7 +610,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ -#define CH_DBG_THREADS_PROFILING FALSE +#if !defined(CH_DBG_THREADS_PROFILING) +#define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ diff --git a/keyboards/ducky/one2mini/halconf.h b/keyboards/ducky/one2mini/halconf.h index 8ed7d085377..b0a0c81c93c 100644 --- a/keyboards/ducky/one2mini/halconf.h +++ b/keyboards/ducky/one2mini/halconf.h @@ -428,7 +428,7 @@ * buffers. */ #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_SIZE 1 +#define SERIAL_USB_BUFFERS_SIZE 256 #endif /** diff --git a/keyboards/ducky/one2mini/mcuconf.h b/keyboards/ducky/one2mini/mcuconf.h index b5c01f57727..12e9d2a82dc 100644 --- a/keyboards/ducky/one2mini/mcuconf.h +++ b/keyboards/ducky/one2mini/mcuconf.h @@ -1,25 +1,24 @@ /* - ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio - ChibiOS - Copyright (C) 2019 /u/KeepItUnder + ChibiOS - Copyright (C) 2020 Alex Lewontin - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #ifndef _MCUCONF_H_ #define _MCUCONF_H_ /* - * NUC123SD4AN0 drivers configuration. + * Board setting * The following settings override the default settings present in * the various device driver implementation headers. * Note that the settings for each driver only have effect if the whole @@ -32,110 +31,21 @@ * 5...0 Lowest...Highest. */ -#define NUC123_MCUCONF - /* * HAL driver system settings. */ -#define NUC123_NO_INIT FALSE -#define NUC123_PVD_ENABLE FALSE -#define NUC123_PLS NUC123_PLS_LEV0 -#define NUC123_HSI_ENABLED TRUE -#define NUC123_LSI_ENABLED TRUE -#define NUC123_HSE_ENABLED TRUE -#define NUC123_LSE_ENABLED FALSE -#define NUC123_SW NUC123_SW_HCLK_2 -#define NUC123_PLLSRC NUC123_PLLSRC_HSI_DIV2 +#define NUC123_HSE_ENABLED TRUE +#define NUC123_PLL_ENABLED TRUE +#define NUC123_PLLSRC NUC123_PLLSRC_HSE +#define NUC123_HCLKSRC NUC123_HCLKSRC_PLL +#define NUC123_HCLKDIV 2 +#define NUC123_PLL_NF 144 +#define NUC123_USB_USE_USB0 TRUE +#define NUC123_USB_USE_USB1 TRUE -#define NUC123_I2C1SW NUC123_I2C1SW_HSI -#define NUC123_USART1SW NUC123_USART1SW_PCLK +#define NUC123_SERIAL_USE_UART0 TRUE +#define NUC123_SERIAL_CLKSRC NUC123_SERIAL_CLKSRC_HSI -/* - * ADC driver system settings. - */ -#define NUC123_ADC_USE_ADC1 FALSE -#define NUC123_ADC_ADC1_DMA_PRIORITY 2 -#define NUC123_ADC_IRQ_PRIORITY 2 -#define NUC123_ADC_ADC1_DMA_IRQ_PRIORITY 2 - -/* - * GPT driver system settings. - */ -#define NUC123_GPT_USE_TIM1 FALSE -#define NUC123_GPT_USE_TIM2 FALSE -#define NUC123_GPT_USE_TIM3 FALSE -#define NUC123_GPT_TIM1_IRQ_PRIORITY 2 -#define NUC123_GPT_TIM2_IRQ_PRIORITY 2 -#define NUC123_GPT_TIM3_IRQ_PRIORITY 2 - -/* - * I2C driver system settings. - */ -#define NUC123_I2C_USE_I2C1 FALSE -#define NUC123_I2C_USE_I2C2 FALSE -#define NUC123_I2C_BUSY_TIMEOUT 50 -#define NUC123_I2C_I2C1_IRQ_PRIORITY 3 -#define NUC123_I2C_I2C2_IRQ_PRIORITY 3 -#define NUC123_I2C_USE_DMA TRUE -#define NUC123_I2C_I2C1_DMA_PRIORITY 1 -#define NUC123_I2C_I2C2_DMA_PRIORITY 1 -#define NUC123_I2C_I2C1_RX_DMA_STREAM NUC123_DMA_STREAM_ID(1, 7) -#define NUC123_I2C_I2C1_TX_DMA_STREAM NUC123_DMA_STREAM_ID(1, 6) -#define NUC123_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") -/* - * PWM driver system settings. - */ -#define NUC123_PWM_USE_ADVANCED FALSE -#define NUC123_PWM_USE_PWM1 TRUE -#define NUC123_PWM_USE_TIM1 FALSE -#define NUC123_PWM_USE_TIM2 FALSE -#define NUC123_PWM_USE_TIM3 TRUE -#define NUC123_PWM_TIM1_IRQ_PRIORITY 3 -#define NUC123_PWM_TIM2_IRQ_PRIORITY 3 -#define NUC123_PWM_TIM3_IRQ_PRIORITY 3 - -/* - * SERIAL driver system settings. - */ -#define NUC123_SERIAL_USE_UART1 FALSE -#define NUC123_SERIAL_USE_UART2 FALSE -#define NUC123_SERIAL_USART1_PRIORITY 3 -#define NUC123_SERIAL_USART2_PRIORITY 3 - -/* - * SPI driver system settings. - */ -#define NUC123_SPI_USE_SPI1 FALSE -#define NUC123_SPI_USE_SPI2 FALSE -#define NUC123_SPI_SPI1_DMA_PRIORITY 1 -#define NUC123_SPI_SPI2_DMA_PRIORITY 1 -#define NUC123_SPI_SPI1_IRQ_PRIORITY 2 -#define NUC123_SPI_SPI2_IRQ_PRIORITY 2 -#define NUC123_SPI_SPI2_RX_DMA_STREAM NUC123_DMA_STREAM_ID(1, 4) -#define NUC123_SPI_SPI2_TX_DMA_STREAM NUC123_DMA_STREAM_ID(1, 5) -#define NUC123_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") - -/* - * ST driver system settings. - */ -#define NUC123_ST_IRQ_PRIORITY 2 -#define NUC123_ST_USE_TIMER 2 - -/* - * UART driver system settings. - */ -#define NUC123_UART_USE_USART1 FALSE -#define NUC123_UART_USE_USART2 FALSE -#define NUC123_UART_USART1_IRQ_PRIORITY 3 -#define NUC123_UART_USART2_IRQ_PRIORITY 3 -#define NUC123_UART_USART1_DMA_PRIORITY 0 -#define NUC123_UART_USART2_DMA_PRIORITY 0 -#define NUC123_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") - -/* - * USB driver system settings. - */ -#define NUC123_USB_USE_USB1 TRUE -#define NUC123_USB_LOW_POWER_ON_SUSPEND FALSE +#define NUC123_MCUCONF #endif /* _MCUCONF_H_ */ diff --git a/keyboards/ducky/one2mini/rules.mk b/keyboards/ducky/one2mini/rules.mk index 8ce0b76d423..92bba4e2dbd 100644 --- a/keyboards/ducky/one2mini/rules.mk +++ b/keyboards/ducky/one2mini/rules.mk @@ -15,7 +15,8 @@ MCU_LDSCRIPT = NUC123xD4xx0 # startup code to use MCU_STARTUP = NUC123 -BOARD = NUC123SD4AN0 +# BOARD = NUC123SD4AN0 +BOARD = NUTINY-SDK-NUC123-V2.0 # NUC123 series is Cortex M0 MCU = cortex-m0 @@ -26,7 +27,7 @@ ARMV = 6 # change yes to no to disable # BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration -MOUSEKEY_ENABLE = yes # Mouse keys +MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration