summaryrefslogtreecommitdiff
path: root/keyboards/matrix
diff options
context:
space:
mode:
authorJames Young <xxiinophobia@yahoo.com>2020-02-29 12:00:00 -0800
committerJames Young <xxiinophobia@yahoo.com>2020-02-29 11:59:30 -0800
commit26eef35f07698d23aafae90e1c230b52e100a334 (patch)
treeeb8e43fc58ca55788e6e89430af0db55ea79e324 /keyboards/matrix
parent85041ff05bf0e5f4ff4535caf6e638491a5614c8 (diff)
2020 February 29 Breaking Changes Update (#8064)
Diffstat (limited to 'keyboards/matrix')
-rw-r--r--keyboards/matrix/noah/boards/noah_bd/board.c157
-rw-r--r--keyboards/matrix/noah/chconf.h209
-rw-r--r--keyboards/matrix/noah/config.h7
-rw-r--r--keyboards/matrix/noah/halconf.h241
-rw-r--r--keyboards/matrix/noah/noah.c3
-rw-r--r--keyboards/matrix/noah/rules.mk2
-rw-r--r--keyboards/matrix/noah/ws2812_f4.c272
-rw-r--r--keyboards/matrix/noah/ws2812_f4.h102
8 files changed, 537 insertions, 456 deletions
diff --git a/keyboards/matrix/noah/boards/noah_bd/board.c b/keyboards/matrix/noah/boards/noah_bd/board.c
index 7fd6a60b5f..68cf23cddc 100644
--- a/keyboards/matrix/noah/boards/noah_bd/board.c
+++ b/keyboards/matrix/noah/boards/noah_bd/board.c
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -20,14 +20,76 @@
*/
#include "hal.h"
+#include "stm32_gpio.h"
+
+/*===========================================================================*/
+/* Driver local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local variables and types. */
+/*===========================================================================*/
+
+/**
+ * @brief Type of STM32 GPIO port setup.
+ */
+typedef struct {
+ uint32_t moder;
+ uint32_t otyper;
+ uint32_t ospeedr;
+ uint32_t pupdr;
+ uint32_t odr;
+ uint32_t afrl;
+ uint32_t afrh;
+} gpio_setup_t;
+
+/**
+ * @brief Type of STM32 GPIO initialization data.
+ */
+typedef struct {
+#if STM32_HAS_GPIOA || defined(__DOXYGEN__)
+ gpio_setup_t PAData;
+#endif
+#if STM32_HAS_GPIOB || defined(__DOXYGEN__)
+ gpio_setup_t PBData;
+#endif
+#if STM32_HAS_GPIOC || defined(__DOXYGEN__)
+ gpio_setup_t PCData;
+#endif
+#if STM32_HAS_GPIOD || defined(__DOXYGEN__)
+ gpio_setup_t PDData;
+#endif
+#if STM32_HAS_GPIOE || defined(__DOXYGEN__)
+ gpio_setup_t PEData;
+#endif
+#if STM32_HAS_GPIOF || defined(__DOXYGEN__)
+ gpio_setup_t PFData;
+#endif
+#if STM32_HAS_GPIOG || defined(__DOXYGEN__)
+ gpio_setup_t PGData;
+#endif
+#if STM32_HAS_GPIOH || defined(__DOXYGEN__)
+ gpio_setup_t PHData;
+#endif
+#if STM32_HAS_GPIOI || defined(__DOXYGEN__)
+ gpio_setup_t PIData;
+#endif
+#if STM32_HAS_GPIOJ || defined(__DOXYGEN__)
+ gpio_setup_t PJData;
+#endif
+#if STM32_HAS_GPIOK || defined(__DOXYGEN__)
+ gpio_setup_t PKData;
+#endif
+} gpio_config_t;
-#if HAL_USE_PAL || defined(__DOXYGEN__)
/**
- * @brief PAL setup.
- * @details Digital I/O ports static configuration as defined in @p board.h.
- * This variable is used by the HAL when initializing the PAL driver.
+ * @brief STM32 GPIO static initialization data.
*/
-const PALConfig pal_default_config = {
+static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
@@ -62,20 +124,94 @@ const PALConfig pal_default_config = {
#endif
#if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
- VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}
+ VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
+#endif
+#if STM32_HAS_GPIOJ
+ {VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
+ VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
+#endif
+#if STM32_HAS_GPIOK
+ {VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
+ VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif
};
+
+/*===========================================================================*/
+/* Driver local functions. */
+/*===========================================================================*/
+
+static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) {
+
+ gpiop->OTYPER = config->otyper;
+ gpiop->OSPEEDR = config->ospeedr;
+ gpiop->PUPDR = config->pupdr;
+ gpiop->ODR = config->odr;
+ gpiop->AFRL = config->afrl;
+ gpiop->AFRH = config->afrh;
+ gpiop->MODER = config->moder;
+}
+
+static void stm32_gpio_init(void) {
+
+ /* Enabling GPIO-related clocks, the mask comes from the
+ registry header file.*/
+ rccResetAHB1(STM32_GPIO_EN_MASK);
+ rccEnableAHB1(STM32_GPIO_EN_MASK, true);
+
+ /* Initializing all the defined GPIO ports.*/
+#if STM32_HAS_GPIOA
+ gpio_init(GPIOA, &gpio_default_config.PAData);
+#endif
+#if STM32_HAS_GPIOB
+ gpio_init(GPIOB, &gpio_default_config.PBData);
+#endif
+#if STM32_HAS_GPIOC
+ gpio_init(GPIOC, &gpio_default_config.PCData);
+#endif
+#if STM32_HAS_GPIOD
+ gpio_init(GPIOD, &gpio_default_config.PDData);
+#endif
+#if STM32_HAS_GPIOE
+ gpio_init(GPIOE, &gpio_default_config.PEData);
+#endif
+#if STM32_HAS_GPIOF
+ gpio_init(GPIOF, &gpio_default_config.PFData);
+#endif
+#if STM32_HAS_GPIOG
+ gpio_init(GPIOG, &gpio_default_config.PGData);
+#endif
+#if STM32_HAS_GPIOH
+ gpio_init(GPIOH, &gpio_default_config.PHData);
+#endif
+#if STM32_HAS_GPIOI
+ gpio_init(GPIOI, &gpio_default_config.PIData);
#endif
+#if STM32_HAS_GPIOJ
+ gpio_init(GPIOJ, &gpio_default_config.PJData);
+#endif
+#if STM32_HAS_GPIOK
+ gpio_init(GPIOK, &gpio_default_config.PKData);
+#endif
+}
-void enter_bootloader_mode_if_requested(void);
+/*===========================================================================*/
+/* Driver interrupt handlers. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
/**
* @brief Early initialization code.
- * @details This initialization must be performed just after stack setup
- * and before any other initialization.
+ * @details GPIO ports and system clocks are initialized before everything
+ * else.
*/
void __early_init(void) {
+ extern void enter_bootloader_mode_if_requested(void);
enter_bootloader_mode_if_requested();
+
+ stm32_gpio_init();
stm32_clock_init();
}
@@ -128,4 +264,5 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
* @todo Add your board-specific code, if any.
*/
void boardInit(void) {
+
}
diff --git a/keyboards/matrix/noah/chconf.h b/keyboards/matrix/noah/chconf.h
index 228a0827d8..7dc4f84a8a 100644
--- a/keyboards/matrix/noah/chconf.h
+++ b/keyboards/matrix/noah/chconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
*/
/**
- * @file templates/chconf.h
+ * @file rt/templates/chconf.h
* @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings.
@@ -29,6 +29,7 @@
#define CHCONF_H
#define _CHIBIOS_RT_CONF_
+#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/
/**
@@ -41,14 +42,34 @@
* @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits.
*/
+#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
+#endif
/**
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
*/
+#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
+#endif
+
+/**
+ * @brief Time intervals data size.
+ * @note Allowed values are 16, 32 or 64 bits.
+ */
+#if !defined(CH_CFG_INTERVALS_SIZE)
+#define CH_CFG_INTERVALS_SIZE 32
+#endif
+
+/**
+ * @brief Time types data size.
+ * @note Allowed values are 16 or 32 bits.
+ */
+#if !defined(CH_CFG_TIME_TYPES_SIZE)
+#define CH_CFG_TIME_TYPES_SIZE 32
+#endif
/**
* @brief Time delta constant for the tick-less mode.
@@ -58,7 +79,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 2
+#endif
/** @} */
@@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case.
*/
+#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0
+#endif
/**
* @brief Managed RAM size.
@@ -94,7 +119,9 @@
* 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 Idle thread automatic spawn suppression.
@@ -103,12 +130,9 @@
* function becomes the idle thread and must implement an
* infinite loop.
*/
+#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE
-
-
-/* Use __WFI in the idle thread for waiting. Does lower the power
- * consumption. */
-#define CORTEX_ENABLE_WFI_IDLE TRUE
+#endif
/** @} */
@@ -127,7 +151,9 @@
* @note This is not related to the compiler optimization options.
* @note The default is @p TRUE.
*/
+#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE
+#endif
/** @} */
@@ -145,7 +171,9 @@
*
* @note The default is @p TRUE.
*/
+#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM TRUE
+#endif
/**
* @brief Threads registry APIs.
@@ -153,7 +181,9 @@
*
* @note The default is @p TRUE.
*/
+#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE
+#endif
/**
* @brief Threads synchronization APIs.
@@ -162,7 +192,9 @@
*
* @note The default is @p TRUE.
*/
+#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE
+#endif
/**
* @brief Semaphores APIs.
@@ -170,7 +202,9 @@
*
* @note The default is @p TRUE.
*/
+#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE
+#endif
/**
* @brief Semaphores queuing mode.
@@ -181,7 +215,9 @@
* requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES.
*/
+#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
+#endif
/**
* @brief Mutexes APIs.
@@ -189,7 +225,9 @@
*
* @note The default is @p TRUE.
*/
+#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE
+#endif
/**
* @brief Enables recursive behavior on mutexes.
@@ -199,7 +237,9 @@
* @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES.
*/
+#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
+#endif
/**
* @brief Conditional Variables APIs.
@@ -209,7 +249,9 @@
* @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES.
*/
+#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE
+#endif
/**
* @brief Conditional Variables APIs with timeout.
@@ -219,7 +261,9 @@
* @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS.
*/
+#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
+#endif
/**
* @brief Events Flags APIs.
@@ -227,7 +271,9 @@
*
* @note The default is @p TRUE.
*/
+#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE
+#endif
/**
* @brief Events Flags APIs with timeout.
@@ -237,7 +283,9 @@
* @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS.
*/
+#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
+#endif
/**
* @brief Synchronous Messages APIs.
@@ -246,7 +294,9 @@
*
* @note The default is @p TRUE.
*/
+#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE
+#endif
/**
* @brief Synchronous Messages queuing mode.
@@ -257,7 +307,9 @@
* requirements.
* @note Requires @p CH_CFG_USE_MESSAGES.
*/
+#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
+#endif
/**
* @brief Mailboxes APIs.
@@ -267,7 +319,9 @@
* @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES.
*/
+#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE
+#endif
/**
* @brief Core Memory Manager APIs.
@@ -276,7 +330,9 @@
*
* @note The default is @p TRUE.
*/
+#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE
+#endif
/**
* @brief Heap Allocator APIs.
@@ -288,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended.
*/
+#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE
+#endif
/**
* @brief Memory Pools Allocator APIs.
@@ -297,7 +355,31 @@
*
* @note The default is @p TRUE.
*/
+#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS TRUE
+#endif
+
+/**
+ * @brief Objects FIFOs APIs.
+ * @details If enabled then the objects FIFOs APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_OBJ_FIFOS)
+#define CH_CFG_USE_OBJ_FIFOS TRUE
+#endif
+
+/**
+ * @brief Pipes APIs.
+ * @details If enabled then the pipes APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_PIPES)
+#define CH_CFG_USE_PIPES TRUE
+#endif
/**
* @brief Dynamic Threads APIs.
@@ -308,7 +390,80 @@
* @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 TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Objects factory options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Objects Factory APIs.
+ * @details If enabled then the objects factory APIs are included in the
+ * kernel.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_CFG_USE_FACTORY)
+#define CH_CFG_USE_FACTORY TRUE
+#endif
+
+/**
+ * @brief Maximum length for object names.
+ * @details If the specified length is zero then the name is stored by
+ * pointer but this could have unintended side effects.
+ */
+#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
+#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
+#endif
+
+/**
+ * @brief Enables the registry of generic objects.
+ */
+#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
+#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
+#endif
+
+/**
+ * @brief Enables factory for generic buffers.
+ */
+#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
+#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
+#endif
+
+/**
+ * @brief Enables factory for semaphores.
+ */
+#if !defined(CH_CFG_FACTORY_SEMAPHORES)
+#define CH_CFG_FACTORY_SEMAPHORES TRUE
+#endif
+
+/**
+ * @brief Enables factory for mailboxes.
+ */
+#if !defined(CH_CFG_FACTORY_MAILBOXES)
+#define CH_CFG_FACTORY_MAILBOXES TRUE
+#endif
+
+/**
+ * @brief Enables factory for objects FIFOs.
+ */
+#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
+#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
+#endif
+
+/**
+ * @brief Enables factory for Pipes.
+ */
+#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
+#define CH_CFG_FACTORY_PIPES TRUE
+#endif
/** @} */
@@ -324,7 +479,9 @@
*
* @note The default is @p FALSE.
*/
+#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE
+#endif
/**
* @brief Debug option, system state check.
@@ -333,7 +490,9 @@
*
* @note The default is @p FALSE.
*/
+#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE
+#endif
/**
* @brief Debug option, parameters checks.
@@ -342,7 +501,9 @@
*
* @note The default is @p FALSE.
*/
+#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE
+#endif
/**
* @brief Debug option, consistency checks.
@@ -352,7 +513,9 @@
*
* @note The default is @p FALSE.
*/
+#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE
+#endif
/**
* @brief Debug option, trace buffer.
@@ -360,14 +523,18 @@
*
* @note The default is @p 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.
*/
+#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128
+#endif
/**
* @brief Debug option, stack checks.
@@ -379,7 +546,9 @@
* @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL.
*/
+#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE
+#endif
/**
* @brief Debug option, stacks initialization.
@@ -389,7 +558,9 @@
*
* @note The default is @p FALSE.
*/
+#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE
+#endif
/**
* @brief Debug option, threads profiling.
@@ -400,7 +571,9 @@
* @note This debug option is not currently compatible with the
* tickless mode.
*/
+#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE
+#endif
/** @} */
@@ -412,6 +585,22 @@
/*===========================================================================*/
/**
+ * @brief System structure extension.
+ * @details User fields added to the end of the @p ch_system_t structure.
+ */
+#define CH_CFG_SYSTEM_EXTRA_FIELDS \
+ /* Add threads custom fields here.*/
+
+/**
+ * @brief System initialization hook.
+ * @details User initialization code added to the @p chSysInit() function
+ * just before interrupts are enabled globally.
+ */
+#define CH_CFG_SYSTEM_INIT_HOOK() { \
+ /* Add threads initialization code here.*/ \
+}
+
+/**
* @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure.
*/
@@ -420,9 +609,9 @@
/**
* @brief Threads initialization hook.
- * @details User initialization code added to the @p chThdInit() API.
+ * @details User initialization code added to the @p _thread_init() function.
*
- * @note It is invoked from within @p chThdInit() and implicitly from all
+ * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs.
*/
#define CH_CFG_THREAD_INIT_HOOK(tp) { \
@@ -459,8 +648,6 @@
/* IRQ epilogue code here.*/ \
}
-#define ARM_WFI_IMPL __WFI
-
/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
diff --git a/keyboards/matrix/noah/config.h b/keyboards/matrix/noah/config.h
index a5a77067a6..ccedd43ccf 100644
--- a/keyboards/matrix/noah/config.h
+++ b/keyboards/matrix/noah/config.h
@@ -39,12 +39,7 @@
/* indicator rgb */
#define WS2812_LED_N 7
#define RGBLED_NUM WS2812_LED_N
-#define WS2812_TIM_N 3
-#define WS2812_TIM_CH 3
-#define PORT_WS2812 GPIOB
-#define PIN_WS2812 1
-#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection)
-#define WS2812_DMA_CHANNEL 5 // DMA channel for TIMx_UP
+#define RGB_DI_PIN B1
#define RGBLIGHT_ANIMATIONS
//#define WS2812_EXTERNAL_PULLUP
diff --git a/keyboards/matrix/noah/halconf.h b/keyboards/matrix/noah/halconf.h
index 8c42571983..2fccb45e1d 100644
--- a/keyboards/matrix/noah/halconf.h
+++ b/keyboards/matrix/noah/halconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -28,153 +28,190 @@
#ifndef HALCONF_H
#define HALCONF_H
+#define _CHIBIOS_HAL_CONF_
+#define _CHIBIOS_HAL_CONF_VER_7_0_
+
#include "mcuconf.h"
/**
* @brief Enables the PAL subsystem.
*/
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
-#define HAL_USE_PAL TRUE
+#define HAL_USE_PAL TRUE
#endif
/**
* @brief Enables the ADC subsystem.
*/
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
-#define HAL_USE_ADC FALSE
+#define HAL_USE_ADC FALSE
#endif
/**
* @brief Enables the CAN subsystem.
*/
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
-#define HAL_USE_CAN FALSE
+#define HAL_USE_CAN FALSE
#endif
/**
- * @brief Enables the DAC subsystem.
+ * @brief Enables the cryptographic subsystem.
*/
-#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
-#define HAL_USE_DAC FALSE
+#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
+#define HAL_USE_CRY FALSE
#endif
/**
- * @brief Enables the EXT subsystem.
+ * @brief Enables the DAC subsystem.
*/
-#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
-#define HAL_USE_EXT FALSE
+#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
+#define HAL_USE_DAC FALSE
#endif
/**
* @brief Enables the GPT subsystem.
*/
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
-#define HAL_USE_GPT TRUE
+#define HAL_USE_GPT TRUE
#endif
/**
* @brief Enables the I2C subsystem.
*/
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
-#define HAL_USE_I2C TRUE
+#define HAL_USE_I2C TRUE
#endif
/**
* @brief Enables the I2S subsystem.
*/
#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
-#define HAL_USE_I2S FALSE
+#define HAL_USE_I2S FALSE
#endif
/**
* @brief Enables the ICU subsystem.
*/
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
-#define HAL_USE_ICU FALSE
+#define HAL_USE_ICU FALSE
#endif
/**
* @brief Enables the MAC subsystem.
*/
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
-#define HAL_USE_MAC FALSE
+#define HAL_USE_MAC FALSE
#endif
/**
* @brief Enables the MMC_SPI subsystem.
*/
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
-#define HAL_USE_MMC_SPI FALSE
+#define HAL_USE_MMC_SPI FALSE
#endif
/**
* @brief Enables the PWM subsystem.
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
-#define HAL_USE_PWM TRUE
-#endif
-
-/**
- * @brief Enables the QSPI subsystem.
- */
-#if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__)
-#define HAL_USE_QSPI FALSE
+#define HAL_USE_PWM TRUE
#endif
/**
* @brief Enables the RTC subsystem.
*/
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
-#define HAL_USE_RTC FALSE
+#define HAL_USE_RTC FALSE
#endif
/**
* @brief Enables the SDC subsystem.
*/
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
-#define HAL_USE_SDC FALSE
+#define HAL_USE_SDC FALSE
#endif
/**
* @brief Enables the SERIAL subsystem.
*/
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
-#define HAL_USE_SERIAL FALSE
+#define HAL_USE_SERIAL FALSE
#endif
/**
* @brief Enables the SERIAL over USB subsystem.
*/
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
-#define HAL_USE_SERIAL_USB FALSE
+#define HAL_USE_SERIAL_USB FALSE
+#endif
+
+/**
+ * @brief Enables the SIO subsystem.
+ */
+#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
+#define HAL_USE_SIO FALSE
#endif
/**
* @brief Enables the SPI subsystem.
*/
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
-#define HAL_USE_SPI TRUE
+#define HAL_USE_SPI TRUE
+#endif
+
+/**
+ * @brief Enables the TRNG subsystem.
+ */
+#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
+#define HAL_USE_TRNG FALSE
#endif
/**
* @brief Enables the UART subsystem.
*/
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
-#define HAL_USE_UART FALSE
+#define HAL_USE_UART FALSE
#endif
/**
* @brief Enables the USB subsystem.
*/
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
-#define HAL_USE_USB TRUE
+#define HAL_USE_USB TRUE
#endif
/**
* @brief Enables the WDG subsystem.
*/
#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
-#define HAL_USE_WDG FALSE
+#define HAL_USE_WDG FALSE
+#endif
+
+/**
+ * @brief Enables the WSPI subsystem.
+ */
+#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
+#define HAL_USE_WSPI FALSE
+#endif
+
+/*===========================================================================*/
+/* PAL driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
+#define PAL_USE_CALLBACKS FALSE
+#endif
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
+#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/
@@ -186,7 +223,7 @@
* @note Disabling this option saves both code and data space.
*/
#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
-#define ADC_USE_WAIT TRUE
+#define ADC_USE_WAIT TRUE
#endif
/**
@@ -194,7 +231,7 @@
* @note Disabling this option saves both code and data space.
*/
#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
-#define ADC_USE_MUTUAL_EXCLUSION TRUE
+#define ADC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/
@@ -205,7 +242,56 @@
* @brief Sleep mode related APIs inclusion switch.
*/
#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
-#define CAN_USE_SLEEP_MODE TRUE
+#define CAN_USE_SLEEP_MODE TRUE
+#endif
+
+/**
+ * @brief Enforces the driver to use direct callbacks rather than OSAL events.
+ */
+#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
+#define CAN_ENFORCE_USE_CALLBACKS FALSE
+#endif
+
+/*===========================================================================*/
+/* CRY driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables the SW fall-back of the cryptographic driver.
+ * @details When enabled, this option, activates a fall-back software
+ * implementation for algorithms not supported by the underlying
+ * hardware.
+ * @note Fall-back implementations may not be present for all algorithms.
+ */
+#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
+#define HAL_CRY_USE_FALLBACK FALSE
+#endif
+
+/**
+ * @brief Makes the driver forcibly use the fall-back implementations.
+ */
+#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
+#define HAL_CRY_ENFORCE_FALLBACK FALSE
+#endif
+
+/*===========================================================================*/
+/* DAC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
+#define DAC_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/
@@ -216,7 +302,7 @@
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
-#define I2C_USE_MUTUAL_EXCLUSION TRUE
+#define I2C_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/
@@ -224,17 +310,17 @@
/*===========================================================================*/
/**
- * @brief Enables an event sources for incoming packets.
+ * @brief Enables the zero-copy API.
*/
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
-#define MAC_USE_ZERO_COPY FALSE
+#define MAC_USE_ZERO_COPY FALSE
#endif
/**
* @brief Enables an event sources for incoming packets.
*/
#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
-#define MAC_USE_EVENTS TRUE
+#define MAC_USE_EVENTS TRUE
#endif
/*===========================================================================*/
@@ -250,7 +336,7 @@
* use a DMA channel and heavily loads the CPU.
*/
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
-#define MMC_NICE_WAITING TRUE
+#define MMC_NICE_WAITING TRUE
#endif
/*===========================================================================*/
@@ -262,7 +348,7 @@
* @note Attempts are performed at 10mS intervals.
*/
#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
-#define SDC_INIT_RETRY 100
+#define SDC_INIT_RETRY 100
#endif
/**
@@ -271,7 +357,7 @@
* at @p FALSE.
*/
#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
-#define SDC_MMC_SUPPORT FALSE
+#define SDC_MMC_SUPPORT FALSE
#endif
/**
@@ -281,7 +367,21 @@
* lower priority, this may slow down the driver a bit however.
*/
#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
-#define SDC_NICE_WAITING TRUE
+#define SDC_NICE_WAITING TRUE
+#endif
+
+/**
+ * @brief OCR initialization constant for V20 cards.
+ */
+#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
+#define SDC_INIT_OCR_V20 0x50FF8000U
+#endif
+
+/**
+ * @brief OCR initialization constant for non-V20 cards.
+ */
+#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
+#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/
@@ -294,7 +394,7 @@
* default configuration.
*/
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
-#define SERIAL_DEFAULT_BITRATE 38400
+#define SERIAL_DEFAULT_BITRATE 38400
#endif
/**
@@ -305,7 +405,7 @@
* buffers.
*/
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
-#define SERIAL_BUFFERS_SIZE 16
+#define SERIAL_BUFFERS_SIZE 16
#endif
/*===========================================================================*/
@@ -320,7 +420,7 @@
* buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
-#define SERIAL_USB_BUFFERS_SIZE 256
+#define SERIAL_USB_BUFFERS_SIZE 256
#endif
/**
@@ -328,7 +428,7 @@
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
-#define SERIAL_USB_BUFFERS_NUMBER 2
+#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/
@@ -340,15 +440,32 @@
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
-#define SPI_USE_WAIT TRUE
+#define SPI_USE_WAIT TRUE
#endif
/**
+ * @brief Enables circular transfers APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
+#define SPI_USE_CIRCULAR FALSE
+#endif
+
+
+/**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
-#define SPI_USE_MUTUAL_EXCLUSION FALSE
+#define SPI_USE_MUTUAL_EXCLUSION FALSE
+#endif
+
+/**
+ * @brief Handling method for SPI CS line.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
+#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
@@ -360,7 +477,7 @@
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
-#define UART_USE_WAIT FALSE
+#define UART_USE_WAIT FALSE
#endif
/**
@@ -368,7 +485,7 @@
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
-#define UART_USE_MUTUAL_EXCLUSION FALSE
+#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/
@@ -380,7 +497,27 @@
* @note Disabling this option saves both code and data space.
*/
#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
-#define USB_USE_WAIT TRUE
+#define USB_USE_WAIT TRUE
+#endif
+
+/*===========================================================================*/
+/* WSPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
+#define WSPI_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
diff --git a/keyboards/matrix/noah/noah.c b/keyboards/matrix/noah/noah.c
index 184be43704..64069148e5 100644
--- a/keyboards/matrix/noah/noah.c
+++ b/keyboards/matrix/noah/noah.c
@@ -7,7 +7,7 @@
#ifdef RGBLIGHT_ENABLE
#include <string.h>
#include "rgblight.h"
-#include "ws2812_f4.h"
+#include "ws2812.h"
extern rgblight_config_t rgblight_config;
// led 0 for caps lock, led 1 for scroll lock, led 3 for num lock
@@ -58,7 +58,6 @@ void matrix_init_kb(void) {
__attribute__((weak))
void matrix_init_user(void) {
#ifdef RGBLIGHT_ENABLE
- ws2812_init();
rgblight_enable();
#endif
diff --git a/keyboards/matrix/noah/rules.mk b/keyboards/matrix/noah/rules.mk
index 68163386f1..c24cfd9069 100644
--- a/keyboards/matrix/noah/rules.mk
+++ b/keyboards/matrix/noah/rules.mk
@@ -53,4 +53,4 @@ RGBLIGHT_CUSTOM_DRIVER = yes
# project specific files
SRC += \
matrix.c \
- ws2812_f4.c
+ ws2812.c
diff --git a/keyboards/matrix/noah/ws2812_f4.c b/keyboards/matrix/noah/ws2812_f4.c
deleted file mode 100644
index 7536d6d8c2..0000000000
--- a/keyboards/matrix/noah/ws2812_f4.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/**
- * @file ws2812.c
- * @author Austin Glaser <austin.glaser@gmail.com>, Joerg Wangemann <joerg.wangemann@gmail.com>
- * @brief WS2812 LED driver
- *
- * Copyright (C) 2016 Austin Glaser, 2017 Joerg Wangemann
- *
- * This software may be modified and distributed under the terms
- * of the MIT license. See the LICENSE file for details.
- *
- * @todo Put in names and descriptions of variables which need to be defined to use this file
- *
- * @addtogroup WS2812
- * @{
- */
-
-/* --- PRIVATE DEPENDENCIES ------------------------------------------------- */
-
-// This Driver
-#include "ws2812_f4.h"
-
-// Standard
-#include <stdint.h>
-
-// ChibiOS
-#include "ch.h"
-#include "hal.h"
-
-#include "wait.h"
-// Application
-//#include "board.h"
-
-// TODO: Add these #define's to the headers of your project.
-// Pin, timer and dma are all connected, check them all if you change one.
-// Tested with STM32F4, working at 144 or 168 MHz.
-//#define WS2812_LED_N 2 // Number of LEDs
-//#define PORT_WS2812 GPIOB
-//#define PIN_WS2812 9
-//#define WS2812_TIM_N 4 // timer, 1-11
-//#define WS2812_TIM_CH 3 // timer channel, 0-3
-//#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection)
-//#define WS2812_DMA_CHANNEL 6 // DMA channel for TIMx_UP
-// The WS2812 expects 5V signal level (or at least 0.7 * VDD). Sometimes it works
-// with a 3V signal level, otherwise the easiest way to get the signal level to 5V
-// is to add an external pullup resistor from the DI pin to 5V (10k will do) and
-// configure the pin as open drain.
-// (An SMD resistor is easily solders on the connections of a light strip)
-// Uncomment the next line if an external pullup resistor is used.
-//#define WS2812_EXTERNAL_PULLUP
-
-/* --- CONFIGURATION CHECK -------------------------------------------------- */
-
-#if !defined(WS2812_LED_N)
- #error WS2812 LED chain length not specified
-#elif WS2812_LED_N <= 0
- #error WS2812 LED chain length set to invalid value
-#endif
-
-#if !defined(WS2812_TIM_N)
- #error WS2812 timer not specified
-#endif
-#if defined(STM32F2XX) || defined(STM32F4XX) || defined(STM32F7XX)
- #if WS2812_TIM_N <= 2
- #define WS2812_AF 1
- #elif WS2812_TIM_N <= 5
- #define WS2812_AF 2
- #elif WS2812_TIM_N <= 11
- #define WS2812_AF 3
- #endif
-#elif !defined(WS2812_AF)
- #error WS2812_AF timer alternate function not specified
-#endif
-
-#if !defined(WS2812_TIM_CH)
- #error WS2812 timer channel not specified
-#elif WS2812_TIM_CH >= 4
- #error WS2812 timer channel set to invalid value
-#endif
-
-/* --- PRIVATE CONSTANTS ---------------------------------------------------- */
-
-#define WS2812_PWM_FREQUENCY (STM32_SYSCLK/2) /**< Clock frequency of PWM, must be valid with respect to system clock! */
-#define WS2812_PWM_PERIOD (WS2812_PWM_FREQUENCY/800000) /**< Clock period in ticks. 1 / 800kHz = 1.25 uS (as per datasheet) */
-
-/**
- * @brief Number of bit-periods to hold the data line low at the end of a frame
- *
- * The reset period for each frame must be at least 50 uS; so we add in 50 bit-times
- * of zeroes at the end. (50 bits)*(1.25 uS/bit) = 62.5 uS, which gives us some
- * slack in the timing requirements
- */
-#define WS2812_RESET_BIT_N (50)
-#define WS2812_COLOR_BIT_N (WS2812_LED_N*24) /**< Number of data bits */
-#define WS2812_BIT_N (WS2812_COLOR_BIT_N + WS2812_RESET_BIT_N) /**< Total number of bits in a frame */
-
-/**
- * @brief High period for a zero, in ticks
- *
- * Per the datasheet:
- * WS2812:
- * - T0H: 200 nS to 500 nS, inclusive
- * - T0L: 650 nS to 950 nS, inclusive
- * WS2812B:
- * - T0H: 200 nS to 500 nS, inclusive
- * - T0L: 750 nS to 1050 nS, inclusive
- *
- * The duty cycle is calculated for a high period of 350 nS.
- */
-#define WS2812_DUTYCYCLE_0 (WS2812_PWM_FREQUENCY/(1000000000/450))
-
-/**
- * @brief High period for a one, in ticks
- *
- * Per the datasheet:
- * WS2812:
- * - T1H: 550 nS to 850 nS, inclusive
- * - T1L: 450 nS to 750 nS, inclusive
- * WS2812B:
- * - T1H: 750 nS to 1050 nS, inclusive
- * - T1L: 200 nS to 500 nS, inclusive
- *
- * The duty cycle is calculated for a high period of 800 nS.
- * This is in the middle of the specifications of the WS2812 and WS2812B.
- */
-#define WS2812_DUTYCYCLE_1 (WS2812_PWM_FREQUENCY/(1000000000/900))
-
-/* --- PRIVATE MACROS ------------------------------------------------------- */
-
-/**
- * @brief Generates a reference to a numbered PWM driver
- *
- * @param[in] n: The driver (timer) number
- *
- * @return A reference to the driver
- */
-#define PWMD(n) CONCAT_EXPANDED_SYMBOLS(PWMD, n)
-
-#define WS2812_PWMD PWMD(WS2812_TIM_N) /**< The PWM driver to use for the LED chain */
-
-/**
- * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given bit
- *
- * @param[in] led: The led index [0, @ref WS2812_LED_N)
- * @param[in] byte: The byte number [0, 2]
- * @param[in] bit: The bit number [0, 7]
- *
- * @return The bit index
- */
-#define WS2812_BIT(led, byte, bit) (24*(led) + 8*(byte) + (7 - (bit)))
-
-/**
- * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given red bit
- *
- * @note The red byte is the middle byte in the color packet
- *
- * @param[in] led: The led index [0, @ref WS2812_LED_N)
- * @param[in] bit: The bit number [0, 7]
- *
- * @return The bit index
- */
-#define WS2812_RED_BIT(led, bit) WS2812_BIT((led), 1, (bit))
-
-/**
- * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given green bit
- *
- * @note The green byte is the first byte in the color packet
- *
- * @param[in] led: The led index [0, @ref WS2812_LED_N)
- * @param[in] bit: The bit number [0, 7]
- *
- * @return The bit index
- */
-#define WS2812_GREEN_BIT(led, bit) WS2812_BIT((led), 0, (bit))
-
-/**
- * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given blue bit
- *
- * @note The blue byte is the last byte in the color packet
- *
- * @param[in] led: The led index [0, @ref WS2812_LED_N)
- * @param[in] bit: The bit index [0, 7]
- *
- * @return The bit index
- */
-#define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 2, (bit))
-
-/* --- PRIVATE VARIABLES ---------------------------------------------------- */
-
-static uint32_t ws2812_frame_buffer[WS2812_BIT_N + 1]; /**< Buffer for a frame */
-
-/* --- PUBLIC FUNCTIONS ----------------------------------------------------- */
-/*
- * Gedanke: Double-buffer type transactions: double buffer transfers using two memory pointers for
-the memory (while the DMA is reading/writing from/to a buffer, the application can
-write/read to/from the other buffer).
- */
-
-void ws2812_init(void)
-{
- // Initialize led frame buffer
- uint32_t i;
- for (i = 0; i < WS2812_COLOR_BIT_N; i++) ws2812_frame_buffer[i] = WS2812_DUTYCYCLE_0; // All color bits are zero duty cycle
- for (i = 0; i < WS2812_RESET_BIT_N; i++) ws2812_frame_buffer[i + WS2812_COLOR_BIT_N] = 0; // All reset bits are zero
- // Configure pin as AF output. If there's an external pull up resistor the signal level is brought to 5V using open drain mode.
-#ifdef WS2812_EXTERNAL_PULLUP
- palSetPadMode(PORT_WS2812, PIN_WS2812, PAL_MODE_ALTERNATE(WS2812_AF) | PAL_STM32_OTYPE_OPENDRAIN);
-#else
- palSetPadMode(PORT_WS2812, PIN_WS2812, PAL_MODE_ALTERNATE(WS2812_AF) | PAL_STM32_OTYPE_PUSHPULL); //PAL_MODE_STM32_ALTERNATE_PUSHPULL);
-#endif
- //palClearPad(PORT_WS2812, PIN_WS2812);
- //wait_ms(1);
- // PWM Configuration
- #pragma GCC diagnostic ignored "-Woverride-init" // Turn off override-init warning for this struct. We use the overriding ability to set a "default" channel config
- static const PWMConfig ws2812_pwm_config = {
- .frequency = WS2812_PWM_FREQUENCY,
- .period = WS2812_PWM_PERIOD, //Mit dieser Periode wird UDE-Event erzeugt und ein neuer Wert (Länge WS2812_BIT_N) vom DMA ins CCR geschrieben
- .callback = NULL,
- .channels = {
- [0 ... 3] = {.mode = PWM_OUTPUT_DISABLED, .callback = NULL}, // Channels default to disabled
- [WS2812_TIM_CH] = {.mode = PWM_OUTPUT_ACTIVE_HIGH, .callback = NULL}, // Turn on the channel we care about
- },
- .cr2 = 0,
- .dier = TIM_DIER_UDE, // DMA on update event for next period
- };
- #pragma GCC diagnostic pop // Restore command-line warning options
-
- // Configure DMA
- //dmaInit(); // Joe added this
- dmaStreamAllocate(WS2812_DMA_STREAM, 10, NULL, NULL);
- dmaStreamSetPeripheral(WS2812_DMA_STREAM, &(WS2812_PWMD.tim->CCR[WS2812_TIM_CH])); // Ziel ist der An-Zeit im Cap-Comp-Register
- dmaStreamSetMemory0(WS2812_DMA_STREAM, ws2812_frame_buffer);
- dmaStreamSetTransactionSize(WS2812_DMA_STREAM, WS2812_BIT_N);
- dmaStreamSetMode(WS2812_DMA_STREAM,
- STM32_DMA_CR_CHSEL(WS2812_DMA_CHANNEL) | STM32_DMA_CR_DIR_M2P | STM32_DMA_CR_PSIZE_WORD | STM32_DMA_CR_MSIZE_WORD |
- STM32_DMA_CR_MINC | STM32_DMA_CR_CIRC | STM32_DMA_CR_PL(3));
- // M2P: Memory 2 Periph; PL: Priority Level
-
- // Start DMA
- dmaStreamEnable(WS2812_DMA_STREAM);
-
- // Configure PWM
- // NOTE: It's required that preload be enabled on the timer channel CCR register. This is currently enabled in the
- // ChibiOS driver code, so we don't have to do anything special to the timer. If we did, we'd have to start the timer,
- // disable counting, enable the channel, and then make whatever configuration changes we need.
- pwmStart(&WS2812_PWMD, &ws2812_pwm_config);
- pwmEnableChannel(&WS2812_PWMD, WS2812_TIM_CH, 0); // Initial period is 0; output will be low until first duty cycle is DMA'd in
-}
-
-ws2812_err_t ws2812_write_led(uint32_t led_number, uint8_t r, uint8_t g, uint8_t b)
-{
- // Check for valid LED
- if (led_number > WS2812_LED_N) return WS2812_LED_INVALID;
-
- // Write color to frame buffer
- for (uint32_t bit = 0; bit < 8; bit++) {
- ws2812_frame_buffer[WS2812_RED_BIT(led_number, bit)] = ((r >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
- ws2812_frame_buffer[WS2812_GREEN_BIT(led_number, bit)] = ((g >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
- ws2812_frame_buffer[WS2812_BLUE_BIT(led_number, bit)] = ((b >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
- }
-
- // Success
- return WS2812_SUCCESS;
-}
-
-void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds)
-{
- for(int i = 0; i < number_of_leds; i++) {
- ws2812_write_led(i, ledarray[i].r, ledarray[i].g, ledarray[i].b);
- }
-}
-
-/** @} addtogroup WS2812 */
diff --git a/keyboards/matrix/noah/ws2812_f4.h b/keyboards/matrix/noah/ws2812_f4.h
deleted file mode 100644
index 245bd15fef..0000000000
--- a/keyboards/matrix/noah/ws2812_f4.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file ws2812.h
- * @author Austin Glaser <austin.glaser@gmail.com>
- * @brief Interface to WS2812 LED driver
- *
- * Copyright (C) 2016 Austin Glaser
- *
- * This software may be modified and distributed under the terms
- * of the MIT license. See the LICENSE file for details.
- *
- * @todo Put in names and descriptions of variables which need to be defined to use this file
- */
-
-#ifndef WS2812_H_
-#define WS2812_H_
-
-/**
- * @defgroup WS2812 WS2812 Driver
- * @{
- *
- * @brief DMA-based WS2812 LED driver
- *
- * A driver for WS2812 LEDs
- */
-
-/* --- PUBLIC DEPENDENCIES -------------------------------------------------- */
-
-// Standard
-#include <stdint.h>
-#include "color.h"
-
-/* --- PUBLIC MACROS -------------------------------------------------------- */
-
-/**
- * @brief Concatenates two symbols s1 and s2 exactly, without expanding either
- *
- * @param[in] s1: The first symbol to concatenate
- * @param[in] s2: The second symbol to concatenate
- *
- * @return A single symbol containing s1 and s2 concatenated without expansion
- */
-#define CONCAT_SYMBOLS(s1, s2) s1##s2
-
-/**
- * @brief Concatenate the symbols s1 and s2, expanding both of them
- *
- * This is important because simply applying s1##s2 doesn't expand them if they're
- * preprocessor tokens themselves
- *
- * @param[in] s1: The first symbol to concatenate
- * @param[in] s2: The second symbol to concatenate
- *
- * @return A single symbol containing s1 expanded followed by s2 expanded
- */
-#define CONCAT_EXPANDED_SYMBOLS(s1, s2) CONCAT_SYMBOLS(s1, s2)
-
-/* --- PUBLIC CONSTANTS ----------------------------------------------------- */
-
-/**
- * @brief Return codes from ws2812 interface functions
- */
-typedef enum {
- WS2812_SUCCESS = 0x00, /**< Operation completeed successfully */
- WS2812_LED_INVALID, /**< Attempted to index an invalid LED (@ref WS2812_N_LEDS) */
- MAX_WS2812_ERR, /**< Total number of possible error codes */
- WS2812_ERR_INVALID /**< Invalid error value */
-} ws2812_err_t;
-
-/* --- PUBLIC FUNCTIONS ----------------------------------------------------- */
-
-/**
- * @brief Initialize the driver
- *
- * After this function is called, all necessary background tasks will be started.
- * The frame is initially dark.
- */
-void ws2812_init(void);
-
-/**
- * @brief Write the value of a single LED in the chain
- *
- * The color value is written to a frame buffer, and will not
- * be updated until the next frame is written. Frames are written
- * at the maximum possible speed -- the longest latency between a
- * call to this function and the value being displayed is
- * 1.25uS*(24*@ref WS2812_LED_N + 50)
- *
- * @param[in] led_number: The index of the LED to be written. Must be strictly less than
- * @ref WS2812_N_LEDS
- * @param[in] r: The red level of the LED
- * @param[in] g: The green level of the LED
- * @param[in] b: The blue level of the LED
- *
- * @retval WS2812_SUCCESS: The write was successful
- * @retval WS2812_LED_INVALID: The write was to an invalid LED index
- */
-ws2812_err_t ws2812_write_led(uint32_t led_number, uint8_t r, uint8_t g, uint8_t b);
-
-void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds);
-/** @} defgroup WS2812 */
-
-#endif // ifndef WS2812_H_