diff options
Diffstat (limited to 'keyboards/matrix')
| -rw-r--r-- | keyboards/matrix/noah/boards/noah_bd/board.c | 157 | ||||
| -rw-r--r-- | keyboards/matrix/noah/chconf.h | 209 | ||||
| -rw-r--r-- | keyboards/matrix/noah/config.h | 7 | ||||
| -rw-r--r-- | keyboards/matrix/noah/halconf.h | 241 | ||||
| -rw-r--r-- | keyboards/matrix/noah/noah.c | 3 | ||||
| -rw-r--r-- | keyboards/matrix/noah/rules.mk | 2 | ||||
| -rw-r--r-- | keyboards/matrix/noah/ws2812_f4.c | 272 | ||||
| -rw-r--r-- | keyboards/matrix/noah/ws2812_f4.h | 102 |
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 7fd6a60b5..68cf23cdd 100644 --- a/keyboards/matrix/noah/boards/noah_bd/board.c +++ b/keyboards/matrix/noah/boards/noah_bd/board.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | 2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio |
| 3 | 3 | ||
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); | 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. | 5 | you may not use this file except in compliance with the License. |
| @@ -20,14 +20,76 @@ | |||
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include "hal.h" | 22 | #include "hal.h" |
| 23 | #include "stm32_gpio.h" | ||
| 24 | |||
| 25 | /*===========================================================================*/ | ||
| 26 | /* Driver local definitions. */ | ||
| 27 | /*===========================================================================*/ | ||
| 28 | |||
| 29 | /*===========================================================================*/ | ||
| 30 | /* Driver exported variables. */ | ||
| 31 | /*===========================================================================*/ | ||
| 32 | |||
| 33 | /*===========================================================================*/ | ||
| 34 | /* Driver local variables and types. */ | ||
| 35 | /*===========================================================================*/ | ||
| 36 | |||
| 37 | /** | ||
| 38 | * @brief Type of STM32 GPIO port setup. | ||
| 39 | */ | ||
| 40 | typedef struct { | ||
| 41 | uint32_t moder; | ||
| 42 | uint32_t otyper; | ||
| 43 | uint32_t ospeedr; | ||
| 44 | uint32_t pupdr; | ||
| 45 | uint32_t odr; | ||
| 46 | uint32_t afrl; | ||
| 47 | uint32_t afrh; | ||
| 48 | } gpio_setup_t; | ||
| 49 | |||
| 50 | /** | ||
| 51 | * @brief Type of STM32 GPIO initialization data. | ||
| 52 | */ | ||
| 53 | typedef struct { | ||
| 54 | #if STM32_HAS_GPIOA || defined(__DOXYGEN__) | ||
| 55 | gpio_setup_t PAData; | ||
| 56 | #endif | ||
| 57 | #if STM32_HAS_GPIOB || defined(__DOXYGEN__) | ||
| 58 | gpio_setup_t PBData; | ||
| 59 | #endif | ||
| 60 | #if STM32_HAS_GPIOC || defined(__DOXYGEN__) | ||
| 61 | gpio_setup_t PCData; | ||
| 62 | #endif | ||
| 63 | #if STM32_HAS_GPIOD || defined(__DOXYGEN__) | ||
| 64 | gpio_setup_t PDData; | ||
| 65 | #endif | ||
| 66 | #if STM32_HAS_GPIOE || defined(__DOXYGEN__) | ||
| 67 | gpio_setup_t PEData; | ||
| 68 | #endif | ||
| 69 | #if STM32_HAS_GPIOF || defined(__DOXYGEN__) | ||
| 70 | gpio_setup_t PFData; | ||
| 71 | #endif | ||
| 72 | #if STM32_HAS_GPIOG || defined(__DOXYGEN__) | ||
| 73 | gpio_setup_t PGData; | ||
| 74 | #endif | ||
| 75 | #if STM32_HAS_GPIOH || defined(__DOXYGEN__) | ||
| 76 | gpio_setup_t PHData; | ||
| 77 | #endif | ||
| 78 | #if STM32_HAS_GPIOI || defined(__DOXYGEN__) | ||
| 79 | gpio_setup_t PIData; | ||
| 80 | #endif | ||
| 81 | #if STM32_HAS_GPIOJ || defined(__DOXYGEN__) | ||
| 82 | gpio_setup_t PJData; | ||
| 83 | #endif | ||
| 84 | #if STM32_HAS_GPIOK || defined(__DOXYGEN__) | ||
| 85 | gpio_setup_t PKData; | ||
| 86 | #endif | ||
| 87 | } gpio_config_t; | ||
| 23 | 88 | ||
| 24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
| 25 | /** | 89 | /** |
| 26 | * @brief PAL setup. | 90 | * @brief STM32 GPIO static initialization data. |
| 27 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
| 28 | * This variable is used by the HAL when initializing the PAL driver. | ||
| 29 | */ | 91 | */ |
| 30 | const PALConfig pal_default_config = { | 92 | static const gpio_config_t gpio_default_config = { |
| 31 | #if STM32_HAS_GPIOA | 93 | #if STM32_HAS_GPIOA |
| 32 | {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, | 94 | {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, |
| 33 | VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, | 95 | VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, |
| @@ -62,20 +124,94 @@ const PALConfig pal_default_config = { | |||
| 62 | #endif | 124 | #endif |
| 63 | #if STM32_HAS_GPIOI | 125 | #if STM32_HAS_GPIOI |
| 64 | {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, | 126 | {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, |
| 65 | VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} | 127 | VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}, |
| 128 | #endif | ||
| 129 | #if STM32_HAS_GPIOJ | ||
| 130 | {VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, | ||
| 131 | VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH}, | ||
| 132 | #endif | ||
| 133 | #if STM32_HAS_GPIOK | ||
| 134 | {VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, | ||
| 135 | VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH} | ||
| 66 | #endif | 136 | #endif |
| 67 | }; | 137 | }; |
| 138 | |||
| 139 | /*===========================================================================*/ | ||
| 140 | /* Driver local functions. */ | ||
| 141 | /*===========================================================================*/ | ||
| 142 | |||
| 143 | static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) { | ||
| 144 | |||
| 145 | gpiop->OTYPER = config->otyper; | ||
| 146 | gpiop->OSPEEDR = config->ospeedr; | ||
| 147 | gpiop->PUPDR = config->pupdr; | ||
| 148 | gpiop->ODR = config->odr; | ||
| 149 | gpiop->AFRL = config->afrl; | ||
| 150 | gpiop->AFRH = config->afrh; | ||
| 151 | gpiop->MODER = config->moder; | ||
| 152 | } | ||
| 153 | |||
| 154 | static void stm32_gpio_init(void) { | ||
| 155 | |||
| 156 | /* Enabling GPIO-related clocks, the mask comes from the | ||
| 157 | registry header file.*/ | ||
| 158 | rccResetAHB1(STM32_GPIO_EN_MASK); | ||
| 159 | rccEnableAHB1(STM32_GPIO_EN_MASK, true); | ||
| 160 | |||
| 161 | /* Initializing all the defined GPIO ports.*/ | ||
| 162 | #if STM32_HAS_GPIOA | ||
| 163 | gpio_init(GPIOA, &gpio_default_config.PAData); | ||
| 164 | #endif | ||
| 165 | #if STM32_HAS_GPIOB | ||
| 166 | gpio_init(GPIOB, &gpio_default_config.PBData); | ||
| 167 | #endif | ||
| 168 | #if STM32_HAS_GPIOC | ||
| 169 | gpio_init(GPIOC, &gpio_default_config.PCData); | ||
| 170 | #endif | ||
| 171 | #if STM32_HAS_GPIOD | ||
| 172 | gpio_init(GPIOD, &gpio_default_config.PDData); | ||
| 173 | #endif | ||
| 174 | #if STM32_HAS_GPIOE | ||
| 175 | gpio_init(GPIOE, &gpio_default_config.PEData); | ||
| 176 | #endif | ||
| 177 | #if STM32_HAS_GPIOF | ||
| 178 | gpio_init(GPIOF, &gpio_default_config.PFData); | ||
| 179 | #endif | ||
| 180 | #if STM32_HAS_GPIOG | ||
| 181 | gpio_init(GPIOG, &gpio_default_config.PGData); | ||
| 182 | #endif | ||
| 183 | #if STM32_HAS_GPIOH | ||
| 184 | gpio_init(GPIOH, &gpio_default_config.PHData); | ||
| 185 | #endif | ||
| 186 | #if STM32_HAS_GPIOI | ||
| 187 | gpio_init(GPIOI, &gpio_default_config.PIData); | ||
| 68 | #endif | 188 | #endif |
| 189 | #if STM32_HAS_GPIOJ | ||
| 190 | gpio_init(GPIOJ, &gpio_default_config.PJData); | ||
| 191 | #endif | ||
| 192 | #if STM32_HAS_GPIOK | ||
| 193 | gpio_init(GPIOK, &gpio_default_config.PKData); | ||
| 194 | #endif | ||
| 195 | } | ||
| 69 | 196 | ||
| 70 | void enter_bootloader_mode_if_requested(void); | 197 | /*===========================================================================*/ |
| 198 | /* Driver interrupt handlers. */ | ||
| 199 | /*===========================================================================*/ | ||
| 200 | |||
| 201 | /*===========================================================================*/ | ||
| 202 | /* Driver exported functions. */ | ||
| 203 | /*===========================================================================*/ | ||
| 71 | 204 | ||
| 72 | /** | 205 | /** |
| 73 | * @brief Early initialization code. | 206 | * @brief Early initialization code. |
| 74 | * @details This initialization must be performed just after stack setup | 207 | * @details GPIO ports and system clocks are initialized before everything |
| 75 | * and before any other initialization. | 208 | * else. |
| 76 | */ | 209 | */ |
| 77 | void __early_init(void) { | 210 | void __early_init(void) { |
| 211 | extern void enter_bootloader_mode_if_requested(void); | ||
| 78 | enter_bootloader_mode_if_requested(); | 212 | enter_bootloader_mode_if_requested(); |
| 213 | |||
| 214 | stm32_gpio_init(); | ||
| 79 | stm32_clock_init(); | 215 | stm32_clock_init(); |
| 80 | } | 216 | } |
| 81 | 217 | ||
| @@ -128,4 +264,5 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) { | |||
| 128 | * @todo Add your board-specific code, if any. | 264 | * @todo Add your board-specific code, if any. |
| 129 | */ | 265 | */ |
| 130 | void boardInit(void) { | 266 | void boardInit(void) { |
| 267 | |||
| 131 | } | 268 | } |
diff --git a/keyboards/matrix/noah/chconf.h b/keyboards/matrix/noah/chconf.h index 228a0827d..7dc4f84a8 100644 --- a/keyboards/matrix/noah/chconf.h +++ b/keyboards/matrix/noah/chconf.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | 2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio |
| 3 | 3 | ||
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); | 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. | 5 | you may not use this file except in compliance with the License. |
| @@ -15,7 +15,7 @@ | |||
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | * @file templates/chconf.h | 18 | * @file rt/templates/chconf.h |
| 19 | * @brief Configuration file template. | 19 | * @brief Configuration file template. |
| 20 | * @details A copy of this file must be placed in each project directory, it | 20 | * @details A copy of this file must be placed in each project directory, it |
| 21 | * contains the application specific kernel settings. | 21 | * contains the application specific kernel settings. |
| @@ -29,6 +29,7 @@ | |||
| 29 | #define CHCONF_H | 29 | #define CHCONF_H |
| 30 | 30 | ||
| 31 | #define _CHIBIOS_RT_CONF_ | 31 | #define _CHIBIOS_RT_CONF_ |
| 32 | #define _CHIBIOS_RT_CONF_VER_6_0_ | ||
| 32 | 33 | ||
| 33 | /*===========================================================================*/ | 34 | /*===========================================================================*/ |
| 34 | /** | 35 | /** |
| @@ -41,14 +42,34 @@ | |||
| 41 | * @brief System time counter resolution. | 42 | * @brief System time counter resolution. |
| 42 | * @note Allowed values are 16 or 32 bits. | 43 | * @note Allowed values are 16 or 32 bits. |
| 43 | */ | 44 | */ |
| 45 | #if !defined(CH_CFG_ST_RESOLUTION) | ||
| 44 | #define CH_CFG_ST_RESOLUTION 32 | 46 | #define CH_CFG_ST_RESOLUTION 32 |
| 47 | #endif | ||
| 45 | 48 | ||
| 46 | /** | 49 | /** |
| 47 | * @brief System tick frequency. | 50 | * @brief System tick frequency. |
| 48 | * @details Frequency of the system timer that drives the system ticks. This | 51 | * @details Frequency of the system timer that drives the system ticks. This |
| 49 | * setting also defines the system tick time unit. | 52 | * setting also defines the system tick time unit. |
| 50 | */ | 53 | */ |
| 54 | #if !defined(CH_CFG_ST_FREQUENCY) | ||
| 51 | #define CH_CFG_ST_FREQUENCY 10000 | 55 | #define CH_CFG_ST_FREQUENCY 10000 |
| 56 | #endif | ||
| 57 | |||
| 58 | /** | ||
| 59 | * @brief Time intervals data size. | ||
| 60 | * @note Allowed values are 16, 32 or 64 bits. | ||
| 61 | */ | ||
| 62 | #if !defined(CH_CFG_INTERVALS_SIZE) | ||
| 63 | #define CH_CFG_INTERVALS_SIZE 32 | ||
| 64 | #endif | ||
| 65 | |||
| 66 | /** | ||
| 67 | * @brief Time types data size. | ||
| 68 | * @note Allowed values are 16 or 32 bits. | ||
| 69 | */ | ||
| 70 | #if !defined(CH_CFG_TIME_TYPES_SIZE) | ||
| 71 | #define CH_CFG_TIME_TYPES_SIZE 32 | ||
| 72 | #endif | ||
| 52 | 73 | ||
| 53 | /** | 74 | /** |
| 54 | * @brief Time delta constant for the tick-less mode. | 75 | * @brief Time delta constant for the tick-less mode. |
| @@ -58,7 +79,9 @@ | |||
| 58 | * The value one is not valid, timeouts are rounded up to | 79 | * The value one is not valid, timeouts are rounded up to |
| 59 | * this value. | 80 | * this value. |
| 60 | */ | 81 | */ |
| 82 | #if !defined(CH_CFG_ST_TIMEDELTA) | ||
| 61 | #define CH_CFG_ST_TIMEDELTA 2 | 83 | #define CH_CFG_ST_TIMEDELTA 2 |
| 84 | #endif | ||
| 62 | 85 | ||
| 63 | /** @} */ | 86 | /** @} */ |
| 64 | 87 | ||
| @@ -81,7 +104,9 @@ | |||
| 81 | * @note The round robin preemption is not supported in tickless mode and | 104 | * @note The round robin preemption is not supported in tickless mode and |
| 82 | * must be set to zero in that case. | 105 | * must be set to zero in that case. |
| 83 | */ | 106 | */ |
| 107 | #if !defined(CH_CFG_TIME_QUANTUM) | ||
| 84 | #define CH_CFG_TIME_QUANTUM 0 | 108 | #define CH_CFG_TIME_QUANTUM 0 |
| 109 | #endif | ||
| 85 | 110 | ||
| 86 | /** | 111 | /** |
| 87 | * @brief Managed RAM size. | 112 | * @brief Managed RAM size. |
| @@ -94,7 +119,9 @@ | |||
| 94 | * provide the @p __heap_base__ and @p __heap_end__ symbols. | 119 | * provide the @p __heap_base__ and @p __heap_end__ symbols. |
| 95 | * @note Requires @p CH_CFG_USE_MEMCORE. | 120 | * @note Requires @p CH_CFG_USE_MEMCORE. |
| 96 | */ | 121 | */ |
| 122 | #if !defined(CH_CFG_MEMCORE_SIZE) | ||
| 97 | #define CH_CFG_MEMCORE_SIZE 0 | 123 | #define CH_CFG_MEMCORE_SIZE 0 |
| 124 | #endif | ||
| 98 | 125 | ||
| 99 | /** | 126 | /** |
| 100 | * @brief Idle thread automatic spawn suppression. | 127 | * @brief Idle thread automatic spawn suppression. |
| @@ -103,12 +130,9 @@ | |||
| 103 | * function becomes the idle thread and must implement an | 130 | * function becomes the idle thread and must implement an |
| 104 | * infinite loop. | 131 | * infinite loop. |
| 105 | */ | 132 | */ |
| 133 | #if !defined(CH_CFG_NO_IDLE_THREAD) | ||
| 106 | #define CH_CFG_NO_IDLE_THREAD FALSE | 134 | #define CH_CFG_NO_IDLE_THREAD FALSE |
| 107 | 135 | #endif | |
| 108 | |||
| 109 | /* Use __WFI in the idle thread for waiting. Does lower the power | ||
| 110 | * consumption. */ | ||
| 111 | #define CORTEX_ENABLE_WFI_IDLE TRUE | ||
| 112 | 136 | ||
| 113 | /** @} */ | 137 | /** @} */ |
| 114 | 138 | ||
| @@ -127,7 +151,9 @@ | |||
| 127 | * @note This is not related to the compiler optimization options. | 151 | * @note This is not related to the compiler optimization options. |
| 128 | * @note The default is @p TRUE. | 152 | * @note The default is @p TRUE. |
| 129 | */ | 153 | */ |
| 154 | #if !defined(CH_CFG_OPTIMIZE_SPEED) | ||
| 130 | #define CH_CFG_OPTIMIZE_SPEED TRUE | 155 | #define CH_CFG_OPTIMIZE_SPEED TRUE |
| 156 | #endif | ||
| 131 | 157 | ||
| 132 | /** @} */ | 158 | /** @} */ |
| 133 | 159 | ||
| @@ -145,7 +171,9 @@ | |||
| 145 | * | 171 | * |
| 146 | * @note The default is @p TRUE. | 172 | * @note The default is @p TRUE. |
| 147 | */ | 173 | */ |
| 174 | #if !defined(CH_CFG_USE_TM) | ||
| 148 | #define CH_CFG_USE_TM TRUE | 175 | #define CH_CFG_USE_TM TRUE |
| 176 | #endif | ||
| 149 | 177 | ||
| 150 | /** | 178 | /** |
| 151 | * @brief Threads registry APIs. | 179 | * @brief Threads registry APIs. |
| @@ -153,7 +181,9 @@ | |||
| 153 | * | 181 | * |
| 154 | * @note The default is @p TRUE. | 182 | * @note The default is @p TRUE. |
| 155 | */ | 183 | */ |
| 184 | #if !defined(CH_CFG_USE_REGISTRY) | ||
| 156 | #define CH_CFG_USE_REGISTRY TRUE | 185 | #define CH_CFG_USE_REGISTRY TRUE |
| 186 | #endif | ||
| 157 | 187 | ||
| 158 | /** | 188 | /** |
| 159 | * @brief Threads synchronization APIs. | 189 | * @brief Threads synchronization APIs. |
| @@ -162,7 +192,9 @@ | |||
| 162 | * | 192 | * |
| 163 | * @note The default is @p TRUE. | 193 | * @note The default is @p TRUE. |
| 164 | */ | 194 | */ |
| 195 | #if !defined(CH_CFG_USE_WAITEXIT) | ||
| 165 | #define CH_CFG_USE_WAITEXIT TRUE | 196 | #define CH_CFG_USE_WAITEXIT TRUE |
| 197 | #endif | ||
| 166 | 198 | ||
| 167 | /** | 199 | /** |
| 168 | * @brief Semaphores APIs. | 200 | * @brief Semaphores APIs. |
| @@ -170,7 +202,9 @@ | |||
| 170 | * | 202 | * |
| 171 | * @note The default is @p TRUE. | 203 | * @note The default is @p TRUE. |
| 172 | */ | 204 | */ |
| 205 | #if !defined(CH_CFG_USE_SEMAPHORES) | ||
| 173 | #define CH_CFG_USE_SEMAPHORES TRUE | 206 | #define CH_CFG_USE_SEMAPHORES TRUE |
| 207 | #endif | ||
| 174 | 208 | ||
| 175 | /** | 209 | /** |
| 176 | * @brief Semaphores queuing mode. | 210 | * @brief Semaphores queuing mode. |
| @@ -181,7 +215,9 @@ | |||
| 181 | * requirements. | 215 | * requirements. |
| 182 | * @note Requires @p CH_CFG_USE_SEMAPHORES. | 216 | * @note Requires @p CH_CFG_USE_SEMAPHORES. |
| 183 | */ | 217 | */ |
| 218 | #if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) | ||
| 184 | #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE | 219 | #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE |
| 220 | #endif | ||
| 185 | 221 | ||
| 186 | /** | 222 | /** |
| 187 | * @brief Mutexes APIs. | 223 | * @brief Mutexes APIs. |
| @@ -189,7 +225,9 @@ | |||
| 189 | * | 225 | * |
| 190 | * @note The default is @p TRUE. | 226 | * @note The default is @p TRUE. |
| 191 | */ | 227 | */ |
| 228 | #if !defined(CH_CFG_USE_MUTEXES) | ||
| 192 | #define CH_CFG_USE_MUTEXES TRUE | 229 | #define CH_CFG_USE_MUTEXES TRUE |
| 230 | #endif | ||
| 193 | 231 | ||
| 194 | /** | 232 | /** |
| 195 | * @brief Enables recursive behavior on mutexes. | 233 | * @brief Enables recursive behavior on mutexes. |
| @@ -199,7 +237,9 @@ | |||
| 199 | * @note The default is @p FALSE. | 237 | * @note The default is @p FALSE. |
| 200 | * @note Requires @p CH_CFG_USE_MUTEXES. | 238 | * @note Requires @p CH_CFG_USE_MUTEXES. |
| 201 | */ | 239 | */ |
| 240 | #if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) | ||
| 202 | #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE | 241 | #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE |
| 242 | #endif | ||
| 203 | 243 | ||
| 204 | /** | 244 | /** |
| 205 | * @brief Conditional Variables APIs. | 245 | * @brief Conditional Variables APIs. |
| @@ -209,7 +249,9 @@ | |||
| 209 | * @note The default is @p TRUE. | 249 | * @note The default is @p TRUE. |
| 210 | * @note Requires @p CH_CFG_USE_MUTEXES. | 250 | * @note Requires @p CH_CFG_USE_MUTEXES. |
| 211 | */ | 251 | */ |
| 252 | #if !defined(CH_CFG_USE_CONDVARS) | ||
| 212 | #define CH_CFG_USE_CONDVARS TRUE | 253 | #define CH_CFG_USE_CONDVARS TRUE |
| 254 | #endif | ||
| 213 | 255 | ||
| 214 | /** | 256 | /** |
| 215 | * @brief Conditional Variables APIs with timeout. | 257 | * @brief Conditional Variables APIs with timeout. |
| @@ -219,7 +261,9 @@ | |||
| 219 | * @note The default is @p TRUE. | 261 | * @note The default is @p TRUE. |
| 220 | * @note Requires @p CH_CFG_USE_CONDVARS. | 262 | * @note Requires @p CH_CFG_USE_CONDVARS. |
| 221 | */ | 263 | */ |
| 264 | #if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) | ||
| 222 | #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE | 265 | #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE |
| 266 | #endif | ||
| 223 | 267 | ||
| 224 | /** | 268 | /** |
| 225 | * @brief Events Flags APIs. | 269 | * @brief Events Flags APIs. |
| @@ -227,7 +271,9 @@ | |||
| 227 | * | 271 | * |
| 228 | * @note The default is @p TRUE. | 272 | * @note The default is @p TRUE. |
| 229 | */ | 273 | */ |
| 274 | #if !defined(CH_CFG_USE_EVENTS) | ||
| 230 | #define CH_CFG_USE_EVENTS TRUE | 275 | #define CH_CFG_USE_EVENTS TRUE |
| 276 | #endif | ||
| 231 | 277 | ||
| 232 | /** | 278 | /** |
| 233 | * @brief Events Flags APIs with timeout. | 279 | * @brief Events Flags APIs with timeout. |
| @@ -237,7 +283,9 @@ | |||
| 237 | * @note The default is @p TRUE. | 283 | * @note The default is @p TRUE. |
| 238 | * @note Requires @p CH_CFG_USE_EVENTS. | 284 | * @note Requires @p CH_CFG_USE_EVENTS. |
| 239 | */ | 285 | */ |
| 286 | #if !defined(CH_CFG_USE_EVENTS_TIMEOUT) | ||
| 240 | #define CH_CFG_USE_EVENTS_TIMEOUT TRUE | 287 | #define CH_CFG_USE_EVENTS_TIMEOUT TRUE |
| 288 | #endif | ||
| 241 | 289 | ||
| 242 | /** | 290 | /** |
| 243 | * @brief Synchronous Messages APIs. | 291 | * @brief Synchronous Messages APIs. |
| @@ -246,7 +294,9 @@ | |||
| 246 | * | 294 | * |
| 247 | * @note The default is @p TRUE. | 295 | * @note The default is @p TRUE. |
| 248 | */ | 296 | */ |
| 297 | #if !defined(CH_CFG_USE_MESSAGES) | ||
| 249 | #define CH_CFG_USE_MESSAGES TRUE | 298 | #define CH_CFG_USE_MESSAGES TRUE |
| 299 | #endif | ||
| 250 | 300 | ||
| 251 | /** | 301 | /** |
| 252 | * @brief Synchronous Messages queuing mode. | 302 | * @brief Synchronous Messages queuing mode. |
| @@ -257,7 +307,9 @@ | |||
| 257 | * requirements. | 307 | * requirements. |
| 258 | * @note Requires @p CH_CFG_USE_MESSAGES. | 308 | * @note Requires @p CH_CFG_USE_MESSAGES. |
| 259 | */ | 309 | */ |
| 310 | #if !defined(CH_CFG_USE_MESSAGES_PRIORITY) | ||
| 260 | #define CH_CFG_USE_MESSAGES_PRIORITY FALSE | 311 | #define CH_CFG_USE_MESSAGES_PRIORITY FALSE |
| 312 | #endif | ||
| 261 | 313 | ||
| 262 | /** | 314 | /** |
| 263 | * @brief Mailboxes APIs. | 315 | * @brief Mailboxes APIs. |
| @@ -267,7 +319,9 @@ | |||
| 267 | * @note The default is @p TRUE. | 319 | * @note The default is @p TRUE. |
| 268 | * @note Requires @p CH_CFG_USE_SEMAPHORES. | 320 | * @note Requires @p CH_CFG_USE_SEMAPHORES. |
| 269 | */ | 321 | */ |
| 322 | #if !defined(CH_CFG_USE_MAILBOXES) | ||
| 270 | #define CH_CFG_USE_MAILBOXES TRUE | 323 | #define CH_CFG_USE_MAILBOXES TRUE |
| 324 | #endif | ||
| 271 | 325 | ||
| 272 | /** | 326 | /** |
| 273 | * @brief Core Memory Manager APIs. | 327 | * @brief Core Memory Manager APIs. |
| @@ -276,7 +330,9 @@ | |||
| 276 | * | 330 | * |
| 277 | * @note The default is @p TRUE. | 331 | * @note The default is @p TRUE. |
| 278 | */ | 332 | */ |
| 333 | #if !defined(CH_CFG_USE_MEMCORE) | ||
| 279 | #define CH_CFG_USE_MEMCORE TRUE | 334 | #define CH_CFG_USE_MEMCORE TRUE |
| 335 | #endif | ||
| 280 | 336 | ||
| 281 | /** | 337 | /** |
| 282 | * @brief Heap Allocator APIs. | 338 | * @brief Heap Allocator APIs. |
| @@ -288,7 +344,9 @@ | |||
| 288 | * @p CH_CFG_USE_SEMAPHORES. | 344 | * @p CH_CFG_USE_SEMAPHORES. |
| 289 | * @note Mutexes are recommended. | 345 | * @note Mutexes are recommended. |
| 290 | */ | 346 | */ |
| 347 | #if !defined(CH_CFG_USE_HEAP) | ||
| 291 | #define CH_CFG_USE_HEAP TRUE | 348 | #define CH_CFG_USE_HEAP TRUE |
| 349 | #endif | ||
| 292 | 350 | ||
| 293 | /** | 351 | /** |
| 294 | * @brief Memory Pools Allocator APIs. | 352 | * @brief Memory Pools Allocator APIs. |
| @@ -297,7 +355,31 @@ | |||
| 297 | * | 355 | * |
| 298 | * @note The default is @p TRUE. | 356 | * @note The default is @p TRUE. |
| 299 | */ | 357 | */ |
| 358 | #if !defined(CH_CFG_USE_MEMPOOLS) | ||
| 300 | #define CH_CFG_USE_MEMPOOLS TRUE | 359 | #define CH_CFG_USE_MEMPOOLS TRUE |
| 360 | #endif | ||
| 361 | |||
| 362 | /** | ||
| 363 | * @brief Objects FIFOs APIs. | ||
| 364 | * @details If enabled then the objects FIFOs APIs are included | ||
| 365 | * in the kernel. | ||
| 366 | * | ||
| 367 | * @note The default is @p TRUE. | ||
| 368 | */ | ||
| 369 | #if !defined(CH_CFG_USE_OBJ_FIFOS) | ||
| 370 | #define CH_CFG_USE_OBJ_FIFOS TRUE | ||
| 371 | #endif | ||
| 372 | |||
| 373 | /** | ||
| 374 | * @brief Pipes APIs. | ||
| 375 | * @details If enabled then the pipes APIs are included | ||
| 376 | * in the kernel. | ||
| 377 | * | ||
| 378 | * @note The default is @p TRUE. | ||
| 379 | */ | ||
| 380 | #if !defined(CH_CFG_USE_PIPES) | ||
| 381 | #define CH_CFG_USE_PIPES TRUE | ||
| 382 | #endif | ||
| 301 | 383 | ||
| 302 | /** | 384 | /** |
| 303 | * @brief Dynamic Threads APIs. | 385 | * @brief Dynamic Threads APIs. |
| @@ -308,7 +390,80 @@ | |||
| 308 | * @note Requires @p CH_CFG_USE_WAITEXIT. | 390 | * @note Requires @p CH_CFG_USE_WAITEXIT. |
| 309 | * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. | 391 | * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. |
| 310 | */ | 392 | */ |
| 393 | #if !defined(CH_CFG_USE_DYNAMIC) | ||
| 311 | #define CH_CFG_USE_DYNAMIC TRUE | 394 | #define CH_CFG_USE_DYNAMIC TRUE |
| 395 | #endif | ||
| 396 | |||
| 397 | /** @} */ | ||
| 398 | |||
| 399 | /*===========================================================================*/ | ||
| 400 | /** | ||
| 401 | * @name Objects factory options | ||
| 402 | * @{ | ||
| 403 | */ | ||
| 404 | /*===========================================================================*/ | ||
| 405 | |||
| 406 | /** | ||
| 407 | * @brief Objects Factory APIs. | ||
| 408 | * @details If enabled then the objects factory APIs are included in the | ||
| 409 | * kernel. | ||
| 410 | * | ||
| 411 | * @note The default is @p FALSE. | ||
| 412 | */ | ||
| 413 | #if !defined(CH_CFG_USE_FACTORY) | ||
| 414 | #define CH_CFG_USE_FACTORY TRUE | ||
| 415 | #endif | ||
| 416 | |||
| 417 | /** | ||
| 418 | * @brief Maximum length for object names. | ||
| 419 | * @details If the specified length is zero then the name is stored by | ||
| 420 | * pointer but this could have unintended side effects. | ||
| 421 | */ | ||
| 422 | #if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) | ||
| 423 | #define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 | ||
| 424 | #endif | ||
| 425 | |||
| 426 | /** | ||
| 427 | * @brief Enables the registry of generic objects. | ||
| 428 | */ | ||
| 429 | #if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) | ||
| 430 | #define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE | ||
| 431 | #endif | ||
| 432 | |||
| 433 | /** | ||
| 434 | * @brief Enables factory for generic buffers. | ||
| 435 | */ | ||
| 436 | #if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) | ||
| 437 | #define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE | ||
| 438 | #endif | ||
| 439 | |||
| 440 | /** | ||
| 441 | * @brief Enables factory for semaphores. | ||
| 442 | */ | ||
| 443 | #if !defined(CH_CFG_FACTORY_SEMAPHORES) | ||
| 444 | #define CH_CFG_FACTORY_SEMAPHORES TRUE | ||
| 445 | #endif | ||
| 446 | |||
| 447 | /** | ||
| 448 | * @brief Enables factory for mailboxes. | ||
| 449 | */ | ||
| 450 | #if !defined(CH_CFG_FACTORY_MAILBOXES) | ||
| 451 | #define CH_CFG_FACTORY_MAILBOXES TRUE | ||
| 452 | #endif | ||
| 453 | |||
| 454 | /** | ||
| 455 | * @brief Enables factory for objects FIFOs. | ||
| 456 | */ | ||
| 457 | #if !defined(CH_CFG_FACTORY_OBJ_FIFOS) | ||
| 458 | #define CH_CFG_FACTORY_OBJ_FIFOS TRUE | ||
| 459 | #endif | ||
| 460 | |||
| 461 | /** | ||
| 462 | * @brief Enables factory for Pipes. | ||
| 463 | */ | ||
| 464 | #if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__) | ||
| 465 | #define CH_CFG_FACTORY_PIPES TRUE | ||
| 466 | #endif | ||
| 312 | 467 | ||
| 313 | /** @} */ | 468 | /** @} */ |
| 314 | 469 | ||
| @@ -324,7 +479,9 @@ | |||
| 324 | * | 479 | * |
| 325 | * @note The default is @p FALSE. | 480 | * @note The default is @p FALSE. |
| 326 | */ | 481 | */ |
| 482 | #if !defined(CH_DBG_STATISTICS) | ||
| 327 | #define CH_DBG_STATISTICS FALSE | 483 | #define CH_DBG_STATISTICS FALSE |
| 484 | #endif | ||
| 328 | 485 | ||
| 329 | /** | 486 | /** |
| 330 | * @brief Debug option, system state check. | 487 | * @brief Debug option, system state check. |
| @@ -333,7 +490,9 @@ | |||
| 333 | * | 490 | * |
| 334 | * @note The default is @p FALSE. | 491 | * @note The default is @p FALSE. |
| 335 | */ | 492 | */ |
| 493 | #if !defined(CH_DBG_SYSTEM_STATE_CHECK) | ||
| 336 | #define CH_DBG_SYSTEM_STATE_CHECK FALSE | 494 | #define CH_DBG_SYSTEM_STATE_CHECK FALSE |
| 495 | #endif | ||
| 337 | 496 | ||
| 338 | /** | 497 | /** |
| 339 | * @brief Debug option, parameters checks. | 498 | * @brief Debug option, parameters checks. |
| @@ -342,7 +501,9 @@ | |||
| 342 | * | 501 | * |
| 343 | * @note The default is @p FALSE. | 502 | * @note The default is @p FALSE. |
| 344 | */ | 503 | */ |
| 504 | #if !defined(CH_DBG_ENABLE_CHECKS) | ||
| 345 | #define CH_DBG_ENABLE_CHECKS FALSE | 505 | #define CH_DBG_ENABLE_CHECKS FALSE |
| 506 | #endif | ||
| 346 | 507 | ||
| 347 | /** | 508 | /** |
| 348 | * @brief Debug option, consistency checks. | 509 | * @brief Debug option, consistency checks. |
| @@ -352,7 +513,9 @@ | |||
| 352 | * | 513 | * |
| 353 | * @note The default is @p FALSE. | 514 | * @note The default is @p FALSE. |
| 354 | */ | 515 | */ |
| 516 | #if !defined(CH_DBG_ENABLE_ASSERTS) | ||
| 355 | #define CH_DBG_ENABLE_ASSERTS FALSE | 517 | #define CH_DBG_ENABLE_ASSERTS FALSE |
| 518 | #endif | ||
| 356 | 519 | ||
| 357 | /** | 520 | /** |
| 358 | * @brief Debug option, trace buffer. | 521 | * @brief Debug option, trace buffer. |
| @@ -360,14 +523,18 @@ | |||
| 360 | * | 523 | * |
| 361 | * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. | 524 | * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. |
| 362 | */ | 525 | */ |
| 526 | #if !defined(CH_DBG_TRACE_MASK) | ||
| 363 | #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED | 527 | #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED |
| 528 | #endif | ||
| 364 | 529 | ||
| 365 | /** | 530 | /** |
| 366 | * @brief Trace buffer entries. | 531 | * @brief Trace buffer entries. |
| 367 | * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is | 532 | * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is |
| 368 | * different from @p CH_DBG_TRACE_MASK_DISABLED. | 533 | * different from @p CH_DBG_TRACE_MASK_DISABLED. |
| 369 | */ | 534 | */ |
| 535 | #if !defined(CH_DBG_TRACE_BUFFER_SIZE) | ||
| 370 | #define CH_DBG_TRACE_BUFFER_SIZE 128 | 536 | #define CH_DBG_TRACE_BUFFER_SIZE 128 |
| 537 | #endif | ||
| 371 | 538 | ||
| 372 | /** | 539 | /** |
| 373 | * @brief Debug option, stack checks. | 540 | * @brief Debug option, stack checks. |
| @@ -379,7 +546,9 @@ | |||
| 379 | * @note The default failure mode is to halt the system with the global | 546 | * @note The default failure mode is to halt the system with the global |
| 380 | * @p panic_msg variable set to @p NULL. | 547 | * @p panic_msg variable set to @p NULL. |
| 381 | */ | 548 | */ |
| 549 | #if !defined(CH_DBG_ENABLE_STACK_CHECK) | ||
| 382 | #define CH_DBG_ENABLE_STACK_CHECK FALSE | 550 | #define CH_DBG_ENABLE_STACK_CHECK FALSE |
| 551 | #endif | ||
| 383 | 552 | ||
| 384 | /** | 553 | /** |
| 385 | * @brief Debug option, stacks initialization. | 554 | * @brief Debug option, stacks initialization. |
| @@ -389,7 +558,9 @@ | |||
| 389 | * | 558 | * |
| 390 | * @note The default is @p FALSE. | 559 | * @note The default is @p FALSE. |
| 391 | */ | 560 | */ |
| 561 | #if !defined(CH_DBG_FILL_THREADS) | ||
| 392 | #define CH_DBG_FILL_THREADS FALSE | 562 | #define CH_DBG_FILL_THREADS FALSE |
| 563 | #endif | ||
| 393 | 564 | ||
| 394 | /** | 565 | /** |
| 395 | * @brief Debug option, threads profiling. | 566 | * @brief Debug option, threads profiling. |
| @@ -400,7 +571,9 @@ | |||
| 400 | * @note This debug option is not currently compatible with the | 571 | * @note This debug option is not currently compatible with the |
| 401 | * tickless mode. | 572 | * tickless mode. |
| 402 | */ | 573 | */ |
| 574 | #if !defined(CH_DBG_THREADS_PROFILING) | ||
| 403 | #define CH_DBG_THREADS_PROFILING FALSE | 575 | #define CH_DBG_THREADS_PROFILING FALSE |
| 576 | #endif | ||
| 404 | 577 | ||
| 405 | /** @} */ | 578 | /** @} */ |
| 406 | 579 | ||
| @@ -412,6 +585,22 @@ | |||
| 412 | /*===========================================================================*/ | 585 | /*===========================================================================*/ |
| 413 | 586 | ||
| 414 | /** | 587 | /** |
| 588 | * @brief System structure extension. | ||
| 589 | * @details User fields added to the end of the @p ch_system_t structure. | ||
| 590 | */ | ||
| 591 | #define CH_CFG_SYSTEM_EXTRA_FIELDS \ | ||
| 592 | /* Add threads custom fields here.*/ | ||
| 593 | |||
| 594 | /** | ||
| 595 | * @brief System initialization hook. | ||
| 596 | * @details User initialization code added to the @p chSysInit() function | ||
| 597 | * just before interrupts are enabled globally. | ||
| 598 | */ | ||
| 599 | #define CH_CFG_SYSTEM_INIT_HOOK() { \ | ||
| 600 | /* Add threads initialization code here.*/ \ | ||
| 601 | } | ||
| 602 | |||
| 603 | /** | ||
| 415 | * @brief Threads descriptor structure extension. | 604 | * @brief Threads descriptor structure extension. |
| 416 | * @details User fields added to the end of the @p thread_t structure. | 605 | * @details User fields added to the end of the @p thread_t structure. |
| 417 | */ | 606 | */ |
| @@ -420,9 +609,9 @@ | |||
| 420 | 609 | ||
| 421 | /** | 610 | /** |
| 422 | * @brief Threads initialization hook. | 611 | * @brief Threads initialization hook. |
| 423 | * @details User initialization code added to the @p chThdInit() API. | 612 | * @details User initialization code added to the @p _thread_init() function. |
| 424 | * | 613 | * |
| 425 | * @note It is invoked from within @p chThdInit() and implicitly from all | 614 | * @note It is invoked from within @p _thread_init() and implicitly from all |
| 426 | * the threads creation APIs. | 615 | * the threads creation APIs. |
| 427 | */ | 616 | */ |
| 428 | #define CH_CFG_THREAD_INIT_HOOK(tp) { \ | 617 | #define CH_CFG_THREAD_INIT_HOOK(tp) { \ |
| @@ -459,8 +648,6 @@ | |||
| 459 | /* IRQ epilogue code here.*/ \ | 648 | /* IRQ epilogue code here.*/ \ |
| 460 | } | 649 | } |
| 461 | 650 | ||
| 462 | #define ARM_WFI_IMPL __WFI | ||
| 463 | |||
| 464 | /** | 651 | /** |
| 465 | * @brief Idle thread enter hook. | 652 | * @brief Idle thread enter hook. |
| 466 | * @note This hook is invoked within a critical zone, no OS functions | 653 | * @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 a5a77067a..ccedd43cc 100644 --- a/keyboards/matrix/noah/config.h +++ b/keyboards/matrix/noah/config.h | |||
| @@ -39,12 +39,7 @@ | |||
| 39 | /* indicator rgb */ | 39 | /* indicator rgb */ |
| 40 | #define WS2812_LED_N 7 | 40 | #define WS2812_LED_N 7 |
| 41 | #define RGBLED_NUM WS2812_LED_N | 41 | #define RGBLED_NUM WS2812_LED_N |
| 42 | #define WS2812_TIM_N 3 | 42 | #define RGB_DI_PIN B1 |
| 43 | #define WS2812_TIM_CH 3 | ||
| 44 | #define PORT_WS2812 GPIOB | ||
| 45 | #define PIN_WS2812 1 | ||
| 46 | #define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection) | ||
| 47 | #define WS2812_DMA_CHANNEL 5 // DMA channel for TIMx_UP | ||
| 48 | #define RGBLIGHT_ANIMATIONS | 43 | #define RGBLIGHT_ANIMATIONS |
| 49 | //#define WS2812_EXTERNAL_PULLUP | 44 | //#define WS2812_EXTERNAL_PULLUP |
| 50 | 45 | ||
diff --git a/keyboards/matrix/noah/halconf.h b/keyboards/matrix/noah/halconf.h index 8c4257198..2fccb45e1 100644 --- a/keyboards/matrix/noah/halconf.h +++ b/keyboards/matrix/noah/halconf.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | 2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio |
| 3 | 3 | ||
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); | 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. | 5 | you may not use this file except in compliance with the License. |
| @@ -28,153 +28,190 @@ | |||
| 28 | #ifndef HALCONF_H | 28 | #ifndef HALCONF_H |
| 29 | #define HALCONF_H | 29 | #define HALCONF_H |
| 30 | 30 | ||
| 31 | #define _CHIBIOS_HAL_CONF_ | ||
| 32 | #define _CHIBIOS_HAL_CONF_VER_7_0_ | ||
| 33 | |||
| 31 | #include "mcuconf.h" | 34 | #include "mcuconf.h" |
| 32 | 35 | ||
| 33 | /** | 36 | /** |
| 34 | * @brief Enables the PAL subsystem. | 37 | * @brief Enables the PAL subsystem. |
| 35 | */ | 38 | */ |
| 36 | #if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) | 39 | #if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) |
| 37 | #define HAL_USE_PAL TRUE | 40 | #define HAL_USE_PAL TRUE |
| 38 | #endif | 41 | #endif |
| 39 | 42 | ||
| 40 | /** | 43 | /** |
| 41 | * @brief Enables the ADC subsystem. | 44 | * @brief Enables the ADC subsystem. |
| 42 | */ | 45 | */ |
| 43 | #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) | 46 | #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) |
| 44 | #define HAL_USE_ADC FALSE | 47 | #define HAL_USE_ADC FALSE |
| 45 | #endif | 48 | #endif |
| 46 | 49 | ||
| 47 | /** | 50 | /** |
| 48 | * @brief Enables the CAN subsystem. | 51 | * @brief Enables the CAN subsystem. |
| 49 | */ | 52 | */ |
| 50 | #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) | 53 | #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) |
| 51 | #define HAL_USE_CAN FALSE | 54 | #define HAL_USE_CAN FALSE |
| 52 | #endif | 55 | #endif |
| 53 | 56 | ||
| 54 | /** | 57 | /** |
| 55 | * @brief Enables the DAC subsystem. | 58 | * @brief Enables the cryptographic subsystem. |
| 56 | */ | 59 | */ |
| 57 | #if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) | 60 | #if !defined(HAL_USE_CRY) || defined(__DOXYGEN__) |
| 58 | #define HAL_USE_DAC FALSE | 61 | #define HAL_USE_CRY FALSE |
| 59 | #endif | 62 | #endif |
| 60 | 63 | ||
| 61 | /** | 64 | /** |
| 62 | * @brief Enables the EXT subsystem. | 65 | * @brief Enables the DAC subsystem. |
| 63 | */ | 66 | */ |
| 64 | #if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) | 67 | #if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) |
| 65 | #define HAL_USE_EXT FALSE | 68 | #define HAL_USE_DAC FALSE |
| 66 | #endif | 69 | #endif |
| 67 | 70 | ||
| 68 | /** | 71 | /** |
| 69 | * @brief Enables the GPT subsystem. | 72 | * @brief Enables the GPT subsystem. |
| 70 | */ | 73 | */ |
| 71 | #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) | 74 | #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) |
| 72 | #define HAL_USE_GPT TRUE | 75 | #define HAL_USE_GPT TRUE |
| 73 | #endif | 76 | #endif |
| 74 | 77 | ||
| 75 | /** | 78 | /** |
| 76 | * @brief Enables the I2C subsystem. | 79 | * @brief Enables the I2C subsystem. |
| 77 | */ | 80 | */ |
| 78 | #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) | 81 | #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) |
| 79 | #define HAL_USE_I2C TRUE | 82 | #define HAL_USE_I2C TRUE |
| 80 | #endif | 83 | #endif |
| 81 | 84 | ||
| 82 | /** | 85 | /** |
| 83 | * @brief Enables the I2S subsystem. | 86 | * @brief Enables the I2S subsystem. |
| 84 | */ | 87 | */ |
| 85 | #if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) | 88 | #if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) |
| 86 | #define HAL_USE_I2S FALSE | 89 | #define HAL_USE_I2S FALSE |
| 87 | #endif | 90 | #endif |
| 88 | 91 | ||
| 89 | /** | 92 | /** |
| 90 | * @brief Enables the ICU subsystem. | 93 | * @brief Enables the ICU subsystem. |
| 91 | */ | 94 | */ |
| 92 | #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) | 95 | #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) |
| 93 | #define HAL_USE_ICU FALSE | 96 | #define HAL_USE_ICU FALSE |
| 94 | #endif | 97 | #endif |
| 95 | 98 | ||
| 96 | /** | 99 | /** |
| 97 | * @brief Enables the MAC subsystem. | 100 | * @brief Enables the MAC subsystem. |
| 98 | */ | 101 | */ |
| 99 | #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) | 102 | #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) |
| 100 | #define HAL_USE_MAC FALSE | 103 | #define HAL_USE_MAC FALSE |
| 101 | #endif | 104 | #endif |
| 102 | 105 | ||
| 103 | /** | 106 | /** |
| 104 | * @brief Enables the MMC_SPI subsystem. | 107 | * @brief Enables the MMC_SPI subsystem. |
| 105 | */ | 108 | */ |
| 106 | #if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) | 109 | #if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) |
| 107 | #define HAL_USE_MMC_SPI FALSE | 110 | #define HAL_USE_MMC_SPI FALSE |
| 108 | #endif | 111 | #endif |
| 109 | 112 | ||
| 110 | /** | 113 | /** |
| 111 | * @brief Enables the PWM subsystem. | 114 | * @brief Enables the PWM subsystem. |
| 112 | */ | 115 | */ |
| 113 | #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) | 116 | #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) |
| 114 | #define HAL_USE_PWM TRUE | 117 | #define HAL_USE_PWM TRUE |
| 115 | #endif | ||
| 116 | |||
| 117 | /** | ||
| 118 | * @brief Enables the QSPI subsystem. | ||
| 119 | */ | ||
| 120 | #if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__) | ||
| 121 | #define HAL_USE_QSPI FALSE | ||
| 122 | #endif | 118 | #endif |
| 123 | 119 | ||
| 124 | /** | 120 | /** |
| 125 | * @brief Enables the RTC subsystem. | 121 | * @brief Enables the RTC subsystem. |
| 126 | */ | 122 | */ |
| 127 | #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) | 123 | #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) |
| 128 | #define HAL_USE_RTC FALSE | 124 | #define HAL_USE_RTC FALSE |
| 129 | #endif | 125 | #endif |
| 130 | 126 | ||
| 131 | /** | 127 | /** |
| 132 | * @brief Enables the SDC subsystem. | 128 | * @brief Enables the SDC subsystem. |
| 133 | */ | 129 | */ |
| 134 | #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) | 130 | #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) |
| 135 | #define HAL_USE_SDC FALSE | 131 | #define HAL_USE_SDC FALSE |
| 136 | #endif | 132 | #endif |
| 137 | 133 | ||
| 138 | /** | 134 | /** |
| 139 | * @brief Enables the SERIAL subsystem. | 135 | * @brief Enables the SERIAL subsystem. |
| 140 | */ | 136 | */ |
| 141 | #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) | 137 | #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) |
| 142 | #define HAL_USE_SERIAL FALSE | 138 | #define HAL_USE_SERIAL FALSE |
| 143 | #endif | 139 | #endif |
| 144 | 140 | ||
| 145 | /** | 141 | /** |
| 146 | * @brief Enables the SERIAL over USB subsystem. | 142 | * @brief Enables the SERIAL over USB subsystem. |
| 147 | */ | 143 | */ |
| 148 | #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) | 144 | #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) |
| 149 | #define HAL_USE_SERIAL_USB FALSE | 145 | #define HAL_USE_SERIAL_USB FALSE |
| 146 | #endif | ||
| 147 | |||
| 148 | /** | ||
| 149 | * @brief Enables the SIO subsystem. | ||
| 150 | */ | ||
| 151 | #if !defined(HAL_USE_SIO) || defined(__DOXYGEN__) | ||
| 152 | #define HAL_USE_SIO FALSE | ||
| 150 | #endif | 153 | #endif |
| 151 | 154 | ||
| 152 | /** | 155 | /** |
| 153 | * @brief Enables the SPI subsystem. | 156 | * @brief Enables the SPI subsystem. |
| 154 | */ | 157 | */ |
| 155 | #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) | 158 | #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) |
| 156 | #define HAL_USE_SPI TRUE | 159 | #define HAL_USE_SPI TRUE |
| 160 | #endif | ||
| 161 | |||
| 162 | /** | ||
| 163 | * @brief Enables the TRNG subsystem. | ||
| 164 | */ | ||
| 165 | #if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__) | ||
| 166 | #define HAL_USE_TRNG FALSE | ||
| 157 | #endif | 167 | #endif |
| 158 | 168 | ||
| 159 | /** | 169 | /** |
| 160 | * @brief Enables the UART subsystem. | 170 | * @brief Enables the UART subsystem. |
| 161 | */ | 171 | */ |
| 162 | #if !defined(HAL_USE_UART) || defined(__DOXYGEN__) | 172 | #if !defined(HAL_USE_UART) || defined(__DOXYGEN__) |
| 163 | #define HAL_USE_UART FALSE | 173 | #define HAL_USE_UART FALSE |
| 164 | #endif | 174 | #endif |
| 165 | 175 | ||
| 166 | /** | 176 | /** |
| 167 | * @brief Enables the USB subsystem. | 177 | * @brief Enables the USB subsystem. |
| 168 | */ | 178 | */ |
| 169 | #if !defined(HAL_USE_USB) || defined(__DOXYGEN__) | 179 | #if !defined(HAL_USE_USB) || defined(__DOXYGEN__) |
| 170 | #define HAL_USE_USB TRUE | 180 | #define HAL_USE_USB TRUE |
| 171 | #endif | 181 | #endif |
| 172 | 182 | ||
| 173 | /** | 183 | /** |
| 174 | * @brief Enables the WDG subsystem. | 184 | * @brief Enables the WDG subsystem. |
| 175 | */ | 185 | */ |
| 176 | #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) | 186 | #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) |
| 177 | #define HAL_USE_WDG FALSE | 187 | #define HAL_USE_WDG FALSE |
| 188 | #endif | ||
| 189 | |||
| 190 | /** | ||
| 191 | * @brief Enables the WSPI subsystem. | ||
| 192 | */ | ||
| 193 | #if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__) | ||
| 194 | #define HAL_USE_WSPI FALSE | ||
| 195 | #endif | ||
| 196 | |||
| 197 | /*===========================================================================*/ | ||
| 198 | /* PAL driver related settings. */ | ||
| 199 | /*===========================================================================*/ | ||
| 200 | |||
| 201 | /** | ||
| 202 | * @brief Enables synchronous APIs. | ||
| 203 | * @note Disabling this option saves both code and data space. | ||
| 204 | */ | ||
| 205 | #if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) | ||
| 206 | #define PAL_USE_CALLBACKS FALSE | ||
| 207 | #endif | ||
| 208 | |||
| 209 | /** | ||
| 210 | * @brief Enables synchronous APIs. | ||
| 211 | * @note Disabling this option saves both code and data space. | ||
| 212 | */ | ||
| 213 | #if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__) | ||
| 214 | #define PAL_USE_WAIT FALSE | ||
| 178 | #endif | 215 | #endif |
| 179 | 216 | ||
| 180 | /*===========================================================================*/ | 217 | /*===========================================================================*/ |
| @@ -186,7 +223,7 @@ | |||
| 186 | * @note Disabling this option saves both code and data space. | 223 | * @note Disabling this option saves both code and data space. |
| 187 | */ | 224 | */ |
| 188 | #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) | 225 | #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) |
| 189 | #define ADC_USE_WAIT TRUE | 226 | #define ADC_USE_WAIT TRUE |
| 190 | #endif | 227 | #endif |
| 191 | 228 | ||
| 192 | /** | 229 | /** |
| @@ -194,7 +231,7 @@ | |||
| 194 | * @note Disabling this option saves both code and data space. | 231 | * @note Disabling this option saves both code and data space. |
| 195 | */ | 232 | */ |
| 196 | #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | 233 | #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) |
| 197 | #define ADC_USE_MUTUAL_EXCLUSION TRUE | 234 | #define ADC_USE_MUTUAL_EXCLUSION TRUE |
| 198 | #endif | 235 | #endif |
| 199 | 236 | ||
| 200 | /*===========================================================================*/ | 237 | /*===========================================================================*/ |
| @@ -205,7 +242,56 @@ | |||
| 205 | * @brief Sleep mode related APIs inclusion switch. | 242 | * @brief Sleep mode related APIs inclusion switch. |
| 206 | */ | 243 | */ |
| 207 | #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) | 244 | #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) |
| 208 | #define CAN_USE_SLEEP_MODE TRUE | 245 | #define CAN_USE_SLEEP_MODE TRUE |
| 246 | #endif | ||
| 247 | |||
| 248 | /** | ||
| 249 | * @brief Enforces the driver to use direct callbacks rather than OSAL events. | ||
| 250 | */ | ||
| 251 | #if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__) | ||
| 252 | #define CAN_ENFORCE_USE_CALLBACKS FALSE | ||
| 253 | #endif | ||
| 254 | |||
| 255 | /*===========================================================================*/ | ||
| 256 | /* CRY driver related settings. */ | ||
| 257 | /*===========================================================================*/ | ||
| 258 | |||
| 259 | /** | ||
| 260 | * @brief Enables the SW fall-back of the cryptographic driver. | ||
| 261 | * @details When enabled, this option, activates a fall-back software | ||
| 262 | * implementation for algorithms not supported by the underlying | ||
| 263 | * hardware. | ||
| 264 | * @note Fall-back implementations may not be present for all algorithms. | ||
| 265 | */ | ||
| 266 | #if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__) | ||
| 267 | #define HAL_CRY_USE_FALLBACK FALSE | ||
| 268 | #endif | ||
| 269 | |||
| 270 | /** | ||
| 271 | * @brief Makes the driver forcibly use the fall-back implementations. | ||
| 272 | */ | ||
| 273 | #if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__) | ||
| 274 | #define HAL_CRY_ENFORCE_FALLBACK FALSE | ||
| 275 | #endif | ||
| 276 | |||
| 277 | /*===========================================================================*/ | ||
| 278 | /* DAC driver related settings. */ | ||
| 279 | /*===========================================================================*/ | ||
| 280 | |||
| 281 | /** | ||
| 282 | * @brief Enables synchronous APIs. | ||
| 283 | * @note Disabling this option saves both code and data space. | ||
| 284 | */ | ||
| 285 | #if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__) | ||
| 286 | #define DAC_USE_WAIT TRUE | ||
| 287 | #endif | ||
| 288 | |||
| 289 | /** | ||
| 290 | * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs. | ||
| 291 | * @note Disabling this option saves both code and data space. | ||
| 292 | */ | ||
| 293 | #if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
| 294 | #define DAC_USE_MUTUAL_EXCLUSION TRUE | ||
| 209 | #endif | 295 | #endif |
| 210 | 296 | ||
| 211 | /*===========================================================================*/ | 297 | /*===========================================================================*/ |
| @@ -216,7 +302,7 @@ | |||
| 216 | * @brief Enables the mutual exclusion APIs on the I2C bus. | 302 | * @brief Enables the mutual exclusion APIs on the I2C bus. |
| 217 | */ | 303 | */ |
| 218 | #if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | 304 | #if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) |
| 219 | #define I2C_USE_MUTUAL_EXCLUSION TRUE | 305 | #define I2C_USE_MUTUAL_EXCLUSION TRUE |
| 220 | #endif | 306 | #endif |
| 221 | 307 | ||
| 222 | /*===========================================================================*/ | 308 | /*===========================================================================*/ |
| @@ -224,17 +310,17 @@ | |||
| 224 | /*===========================================================================*/ | 310 | /*===========================================================================*/ |
| 225 | 311 | ||
| 226 | /** | 312 | /** |
| 227 | * @brief Enables an event sources for incoming packets. | 313 | * @brief Enables the zero-copy API. |
| 228 | */ | 314 | */ |
| 229 | #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) | 315 | #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) |
| 230 | #define MAC_USE_ZERO_COPY FALSE | 316 | #define MAC_USE_ZERO_COPY FALSE |
| 231 | #endif | 317 | #endif |
| 232 | 318 | ||
| 233 | /** | 319 | /** |
| 234 | * @brief Enables an event sources for incoming packets. | 320 | * @brief Enables an event sources for incoming packets. |
| 235 | */ | 321 | */ |
| 236 | #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) | 322 | #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) |
| 237 | #define MAC_USE_EVENTS TRUE | 323 | #define MAC_USE_EVENTS TRUE |
| 238 | #endif | 324 | #endif |
| 239 | 325 | ||
| 240 | /*===========================================================================*/ | 326 | /*===========================================================================*/ |
| @@ -250,7 +336,7 @@ | |||
| 250 | * use a DMA channel and heavily loads the CPU. | 336 | * use a DMA channel and heavily loads the CPU. |
| 251 | */ | 337 | */ |
| 252 | #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) | 338 | #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) |
| 253 | #define MMC_NICE_WAITING TRUE | 339 | #define MMC_NICE_WAITING TRUE |
| 254 | #endif | 340 | #endif |
| 255 | 341 | ||
| 256 | /*===========================================================================*/ | 342 | /*===========================================================================*/ |
| @@ -262,7 +348,7 @@ | |||
| 262 | * @note Attempts are performed at 10mS intervals. | 348 | * @note Attempts are performed at 10mS intervals. |
| 263 | */ | 349 | */ |
| 264 | #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) | 350 | #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) |
| 265 | #define SDC_INIT_RETRY 100 | 351 | #define SDC_INIT_RETRY 100 |
| 266 | #endif | 352 | #endif |
| 267 | 353 | ||
| 268 | /** | 354 | /** |
| @@ -271,7 +357,7 @@ | |||
| 271 | * at @p FALSE. | 357 | * at @p FALSE. |
| 272 | */ | 358 | */ |
| 273 | #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) | 359 | #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) |
| 274 | #define SDC_MMC_SUPPORT FALSE | 360 | #define SDC_MMC_SUPPORT FALSE |
| 275 | #endif | 361 | #endif |
| 276 | 362 | ||
| 277 | /** | 363 | /** |
| @@ -281,7 +367,21 @@ | |||
| 281 | * lower priority, this may slow down the driver a bit however. | 367 | * lower priority, this may slow down the driver a bit however. |
| 282 | */ | 368 | */ |
| 283 | #if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) | 369 | #if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) |
| 284 | #define SDC_NICE_WAITING TRUE | 370 | #define SDC_NICE_WAITING TRUE |
| 371 | #endif | ||
| 372 | |||
| 373 | /** | ||
| 374 | * @brief OCR initialization constant for V20 cards. | ||
| 375 | */ | ||
| 376 | #if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__) | ||
| 377 | #define SDC_INIT_OCR_V20 0x50FF8000U | ||
| 378 | #endif | ||
| 379 | |||
| 380 | /** | ||
| 381 | * @brief OCR initialization constant for non-V20 cards. | ||
| 382 | */ | ||
| 383 | #if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__) | ||
| 384 | #define SDC_INIT_OCR 0x80100000U | ||
| 285 | #endif | 385 | #endif |
| 286 | 386 | ||
| 287 | /*===========================================================================*/ | 387 | /*===========================================================================*/ |
| @@ -294,7 +394,7 @@ | |||
| 294 | * default configuration. | 394 | * default configuration. |
| 295 | */ | 395 | */ |
| 296 | #if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) | 396 | #if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) |
| 297 | #define SERIAL_DEFAULT_BITRATE 38400 | 397 | #define SERIAL_DEFAULT_BITRATE 38400 |
| 298 | #endif | 398 | #endif |
| 299 | 399 | ||
| 300 | /** | 400 | /** |
| @@ -305,7 +405,7 @@ | |||
| 305 | * buffers. | 405 | * buffers. |
| 306 | */ | 406 | */ |
| 307 | #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) | 407 | #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) |
| 308 | #define SERIAL_BUFFERS_SIZE 16 | 408 | #define SERIAL_BUFFERS_SIZE 16 |
| 309 | #endif | 409 | #endif |
| 310 | 410 | ||
| 311 | /*===========================================================================*/ | 411 | /*===========================================================================*/ |
| @@ -320,7 +420,7 @@ | |||
| 320 | * buffers. | 420 | * buffers. |
| 321 | */ | 421 | */ |
| 322 | #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) | 422 | #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) |
| 323 | #define SERIAL_USB_BUFFERS_SIZE 256 | 423 | #define SERIAL_USB_BUFFERS_SIZE 256 |
| 324 | #endif | 424 | #endif |
| 325 | 425 | ||
| 326 | /** | 426 | /** |
| @@ -328,7 +428,7 @@ | |||
| 328 | * @note The default is 2 buffers. | 428 | * @note The default is 2 buffers. |
| 329 | */ | 429 | */ |
| 330 | #if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) | 430 | #if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) |
| 331 | #define SERIAL_USB_BUFFERS_NUMBER 2 | 431 | #define SERIAL_USB_BUFFERS_NUMBER 2 |
| 332 | #endif | 432 | #endif |
| 333 | 433 | ||
| 334 | /*===========================================================================*/ | 434 | /*===========================================================================*/ |
| @@ -340,15 +440,32 @@ | |||
| 340 | * @note Disabling this option saves both code and data space. | 440 | * @note Disabling this option saves both code and data space. |
| 341 | */ | 441 | */ |
| 342 | #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) | 442 | #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) |
| 343 | #define SPI_USE_WAIT TRUE | 443 | #define SPI_USE_WAIT TRUE |
| 344 | #endif | 444 | #endif |
| 345 | 445 | ||
| 346 | /** | 446 | /** |
| 447 | * @brief Enables circular transfers APIs. | ||
| 448 | * @note Disabling this option saves both code and data space. | ||
| 449 | */ | ||
| 450 | #if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) | ||
| 451 | #define SPI_USE_CIRCULAR FALSE | ||
| 452 | #endif | ||
| 453 | |||
| 454 | |||
| 455 | /** | ||
| 347 | * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. | 456 | * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. |
| 348 | * @note Disabling this option saves both code and data space. | 457 | * @note Disabling this option saves both code and data space. |
| 349 | */ | 458 | */ |
| 350 | #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | 459 | #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) |
| 351 | #define SPI_USE_MUTUAL_EXCLUSION FALSE | 460 | #define SPI_USE_MUTUAL_EXCLUSION FALSE |
| 461 | #endif | ||
| 462 | |||
| 463 | /** | ||
| 464 | * @brief Handling method for SPI CS line. | ||
| 465 | * @note Disabling this option saves both code and data space. | ||
| 466 | */ | ||
| 467 | #if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__) | ||
| 468 | #define SPI_SELECT_MODE SPI_SELECT_MODE_PAD | ||
| 352 | #endif | 469 | #endif |
| 353 | 470 | ||
| 354 | /*===========================================================================*/ | 471 | /*===========================================================================*/ |
| @@ -360,7 +477,7 @@ | |||
| 360 | * @note Disabling this option saves both code and data space. | 477 | * @note Disabling this option saves both code and data space. |
| 361 | */ | 478 | */ |
| 362 | #if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) | 479 | #if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) |
| 363 | #define UART_USE_WAIT FALSE | 480 | #define UART_USE_WAIT FALSE |
| 364 | #endif | 481 | #endif |
| 365 | 482 | ||
| 366 | /** | 483 | /** |
| @@ -368,7 +485,7 @@ | |||
| 368 | * @note Disabling this option saves both code and data space. | 485 | * @note Disabling this option saves both code and data space. |
| 369 | */ | 486 | */ |
| 370 | #if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | 487 | #if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) |
| 371 | #define UART_USE_MUTUAL_EXCLUSION FALSE | 488 | #define UART_USE_MUTUAL_EXCLUSION FALSE |
| 372 | #endif | 489 | #endif |
| 373 | 490 | ||
| 374 | /*===========================================================================*/ | 491 | /*===========================================================================*/ |
| @@ -380,7 +497,27 @@ | |||
| 380 | * @note Disabling this option saves both code and data space. | 497 | * @note Disabling this option saves both code and data space. |
| 381 | */ | 498 | */ |
| 382 | #if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) | 499 | #if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) |
| 383 | #define USB_USE_WAIT TRUE | 500 | #define USB_USE_WAIT TRUE |
| 501 | #endif | ||
| 502 | |||
| 503 | /*===========================================================================*/ | ||
| 504 | /* WSPI driver related settings. */ | ||
| 505 | /*===========================================================================*/ | ||
| 506 | |||
| 507 | /** | ||
| 508 | * @brief Enables synchronous APIs. | ||
| 509 | * @note Disabling this option saves both code and data space. | ||
| 510 | */ | ||
| 511 | #if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__) | ||
| 512 | #define WSPI_USE_WAIT TRUE | ||
| 513 | #endif | ||
| 514 | |||
| 515 | /** | ||
| 516 | * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs. | ||
| 517 | * @note Disabling this option saves both code and data space. | ||
| 518 | */ | ||
| 519 | #if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
| 520 | #define WSPI_USE_MUTUAL_EXCLUSION TRUE | ||
| 384 | #endif | 521 | #endif |
| 385 | 522 | ||
| 386 | #endif /* HALCONF_H */ | 523 | #endif /* HALCONF_H */ |
diff --git a/keyboards/matrix/noah/noah.c b/keyboards/matrix/noah/noah.c index 184be4370..64069148e 100644 --- a/keyboards/matrix/noah/noah.c +++ b/keyboards/matrix/noah/noah.c | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #ifdef RGBLIGHT_ENABLE | 7 | #ifdef RGBLIGHT_ENABLE |
| 8 | #include <string.h> | 8 | #include <string.h> |
| 9 | #include "rgblight.h" | 9 | #include "rgblight.h" |
| 10 | #include "ws2812_f4.h" | 10 | #include "ws2812.h" |
| 11 | extern rgblight_config_t rgblight_config; | 11 | extern rgblight_config_t rgblight_config; |
| 12 | 12 | ||
| 13 | // led 0 for caps lock, led 1 for scroll lock, led 3 for num lock | 13 | // led 0 for caps lock, led 1 for scroll lock, led 3 for num lock |
| @@ -58,7 +58,6 @@ void matrix_init_kb(void) { | |||
| 58 | __attribute__((weak)) | 58 | __attribute__((weak)) |
| 59 | void matrix_init_user(void) { | 59 | void matrix_init_user(void) { |
| 60 | #ifdef RGBLIGHT_ENABLE | 60 | #ifdef RGBLIGHT_ENABLE |
| 61 | ws2812_init(); | ||
| 62 | rgblight_enable(); | 61 | rgblight_enable(); |
| 63 | #endif | 62 | #endif |
| 64 | 63 | ||
diff --git a/keyboards/matrix/noah/rules.mk b/keyboards/matrix/noah/rules.mk index 68163386f..c24cfd906 100644 --- a/keyboards/matrix/noah/rules.mk +++ b/keyboards/matrix/noah/rules.mk | |||
| @@ -53,4 +53,4 @@ RGBLIGHT_CUSTOM_DRIVER = yes | |||
| 53 | # project specific files | 53 | # project specific files |
| 54 | SRC += \ | 54 | SRC += \ |
| 55 | matrix.c \ | 55 | matrix.c \ |
| 56 | ws2812_f4.c | 56 | ws2812.c |
diff --git a/keyboards/matrix/noah/ws2812_f4.c b/keyboards/matrix/noah/ws2812_f4.c deleted file mode 100644 index 7536d6d8c..000000000 --- a/keyboards/matrix/noah/ws2812_f4.c +++ /dev/null | |||
| @@ -1,272 +0,0 @@ | |||
| 1 | /** | ||
| 2 | * @file ws2812.c | ||
| 3 | * @author Austin Glaser <austin.glaser@gmail.com>, Joerg Wangemann <joerg.wangemann@gmail.com> | ||
| 4 | * @brief WS2812 LED driver | ||
| 5 | * | ||
| 6 | * Copyright (C) 2016 Austin Glaser, 2017 Joerg Wangemann | ||
| 7 | * | ||
| 8 | * This software may be modified and distributed under the terms | ||
| 9 | * of the MIT license. See the LICENSE file for details. | ||
| 10 | * | ||
| 11 | * @todo Put in names and descriptions of variables which need to be defined to use this file | ||
| 12 | * | ||
| 13 | * @addtogroup WS2812 | ||
| 14 | * @{ | ||
| 15 | */ | ||
| 16 | |||
| 17 | /* --- PRIVATE DEPENDENCIES ------------------------------------------------- */ | ||
| 18 | |||
| 19 | // This Driver | ||
| 20 | #include "ws2812_f4.h" | ||
| 21 | |||
| 22 | // Standard | ||
| 23 | #include <stdint.h> | ||
| 24 | |||
| 25 | // ChibiOS | ||
| 26 | #include "ch.h" | ||
| 27 | #include "hal.h" | ||
| 28 | |||
| 29 | #include "wait.h" | ||
| 30 | // Application | ||
| 31 | //#include "board.h" | ||
| 32 | |||
| 33 | // TODO: Add these #define's to the headers of your project. | ||
| 34 | // Pin, timer and dma are all connected, check them all if you change one. | ||
| 35 | // Tested with STM32F4, working at 144 or 168 MHz. | ||
| 36 | //#define WS2812_LED_N 2 // Number of LEDs | ||
| 37 | //#define PORT_WS2812 GPIOB | ||
| 38 | //#define PIN_WS2812 9 | ||
| 39 | //#define WS2812_TIM_N 4 // timer, 1-11 | ||
| 40 | //#define WS2812_TIM_CH 3 // timer channel, 0-3 | ||
| 41 | //#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection) | ||
| 42 | //#define WS2812_DMA_CHANNEL 6 // DMA channel for TIMx_UP | ||
| 43 | // The WS2812 expects 5V signal level (or at least 0.7 * VDD). Sometimes it works | ||
| 44 | // with a 3V signal level, otherwise the easiest way to get the signal level to 5V | ||
| 45 | // is to add an external pullup resistor from the DI pin to 5V (10k will do) and | ||
| 46 | // configure the pin as open drain. | ||
| 47 | // (An SMD resistor is easily solders on the connections of a light strip) | ||
| 48 | // Uncomment the next line if an external pullup resistor is used. | ||
| 49 | //#define WS2812_EXTERNAL_PULLUP | ||
| 50 | |||
| 51 | /* --- CONFIGURATION CHECK -------------------------------------------------- */ | ||
| 52 | |||
| 53 | #if !defined(WS2812_LED_N) | ||
| 54 | #error WS2812 LED chain length not specified | ||
| 55 | #elif WS2812_LED_N <= 0 | ||
| 56 | #error WS2812 LED chain length set to invalid value | ||
| 57 | #endif | ||
| 58 | |||
| 59 | #if !defined(WS2812_TIM_N) | ||
| 60 | #error WS2812 timer not specified | ||
| 61 | #endif | ||
| 62 | #if defined(STM32F2XX) || defined(STM32F4XX) || defined(STM32F7XX) | ||
| 63 | #if WS2812_TIM_N <= 2 | ||
| 64 | #define WS2812_AF 1 | ||
| 65 | #elif WS2812_TIM_N <= 5 | ||
| 66 | #define WS2812_AF 2 | ||
| 67 | #elif WS2812_TIM_N <= 11 | ||
| 68 | #define WS2812_AF 3 | ||
| 69 | #endif | ||
| 70 | #elif !defined(WS2812_AF) | ||
| 71 | #error WS2812_AF timer alternate function not specified | ||
| 72 | #endif | ||
| 73 | |||
| 74 | #if !defined(WS2812_TIM_CH) | ||
| 75 | #error WS2812 timer channel not specified | ||
| 76 | #elif WS2812_TIM_CH >= 4 | ||
| 77 | #error WS2812 timer channel set to invalid value | ||
| 78 | #endif | ||
| 79 | |||
| 80 | /* --- PRIVATE CONSTANTS ---------------------------------------------------- */ | ||
| 81 | |||
| 82 | #define WS2812_PWM_FREQUENCY (STM32_SYSCLK/2) /**< Clock frequency of PWM, must be valid with respect to system clock! */ | ||
| 83 | #define WS2812_PWM_PERIOD (WS2812_PWM_FREQUENCY/800000) /**< Clock period in ticks. 1 / 800kHz = 1.25 uS (as per datasheet) */ | ||
| 84 | |||
| 85 | /** | ||
| 86 | * @brief Number of bit-periods to hold the data line low at the end of a frame | ||
| 87 | * | ||
| 88 | * The reset period for each frame must be at least 50 uS; so we add in 50 bit-times | ||
| 89 | * of zeroes at the end. (50 bits)*(1.25 uS/bit) = 62.5 uS, which gives us some | ||
| 90 | * slack in the timing requirements | ||
| 91 | */ | ||
| 92 | #define WS2812_RESET_BIT_N (50) | ||
| 93 | #define WS2812_COLOR_BIT_N (WS2812_LED_N*24) /**< Number of data bits */ | ||
| 94 | #define WS2812_BIT_N (WS2812_COLOR_BIT_N + WS2812_RESET_BIT_N) /**< Total number of bits in a frame */ | ||
| 95 | |||
| 96 | /** | ||
| 97 | * @brief High period for a zero, in ticks | ||
| 98 | * | ||
| 99 | * Per the datasheet: | ||
| 100 | * WS2812: | ||
| 101 | * - T0H: 200 nS to 500 nS, inclusive | ||
| 102 | * - T0L: 650 nS to 950 nS, inclusive | ||
| 103 | * WS2812B: | ||
| 104 | * - T0H: 200 nS to 500 nS, inclusive | ||
| 105 | * - T0L: 750 nS to 1050 nS, inclusive | ||
| 106 | * | ||
| 107 | * The duty cycle is calculated for a high period of 350 nS. | ||
| 108 | */ | ||
| 109 | #define WS2812_DUTYCYCLE_0 (WS2812_PWM_FREQUENCY/(1000000000/450)) | ||
| 110 | |||
| 111 | /** | ||
| 112 | * @brief High period for a one, in ticks | ||
| 113 | * | ||
| 114 | * Per the datasheet: | ||
| 115 | * WS2812: | ||
| 116 | * - T1H: 550 nS to 850 nS, inclusive | ||
| 117 | * - T1L: 450 nS to 750 nS, inclusive | ||
| 118 | * WS2812B: | ||
| 119 | * - T1H: 750 nS to 1050 nS, inclusive | ||
| 120 | * - T1L: 200 nS to 500 nS, inclusive | ||
| 121 | * | ||
| 122 | * The duty cycle is calculated for a high period of 800 nS. | ||
| 123 | * This is in the middle of the specifications of the WS2812 and WS2812B. | ||
| 124 | */ | ||
| 125 | #define WS2812_DUTYCYCLE_1 (WS2812_PWM_FREQUENCY/(1000000000/900)) | ||
| 126 | |||
| 127 | /* --- PRIVATE MACROS ------------------------------------------------------- */ | ||
| 128 | |||
| 129 | /** | ||
| 130 | * @brief Generates a reference to a numbered PWM driver | ||
| 131 | * | ||
| 132 | * @param[in] n: The driver (timer) number | ||
| 133 | * | ||
| 134 | * @return A reference to the driver | ||
| 135 | */ | ||
| 136 | #define PWMD(n) CONCAT_EXPANDED_SYMBOLS(PWMD, n) | ||
| 137 | |||
| 138 | #define WS2812_PWMD PWMD(WS2812_TIM_N) /**< The PWM driver to use for the LED chain */ | ||
| 139 | |||
| 140 | /** | ||
| 141 | * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given bit | ||
| 142 | * | ||
| 143 | * @param[in] led: The led index [0, @ref WS2812_LED_N) | ||
| 144 | * @param[in] byte: The byte number [0, 2] | ||
| 145 | * @param[in] bit: The bit number [0, 7] | ||
| 146 | * | ||
| 147 | * @return The bit index | ||
| 148 | */ | ||
| 149 | #define WS2812_BIT(led, byte, bit) (24*(led) + 8*(byte) + (7 - (bit))) | ||
| 150 | |||
| 151 | /** | ||
| 152 | * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given red bit | ||
| 153 | * | ||
| 154 | * @note The red byte is the middle byte in the color packet | ||
| 155 | * | ||
| 156 | * @param[in] led: The led index [0, @ref WS2812_LED_N) | ||
| 157 | * @param[in] bit: The bit number [0, 7] | ||
| 158 | * | ||
| 159 | * @return The bit index | ||
| 160 | */ | ||
| 161 | #define WS2812_RED_BIT(led, bit) WS2812_BIT((led), 1, (bit)) | ||
| 162 | |||
| 163 | /** | ||
| 164 | * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given green bit | ||
| 165 | * | ||
| 166 | * @note The green byte is the first byte in the color packet | ||
| 167 | * | ||
| 168 | * @param[in] led: The led index [0, @ref WS2812_LED_N) | ||
| 169 | * @param[in] bit: The bit number [0, 7] | ||
| 170 | * | ||
| 171 | * @return The bit index | ||
| 172 | */ | ||
| 173 | #define WS2812_GREEN_BIT(led, bit) WS2812_BIT((led), 0, (bit)) | ||
| 174 | |||
| 175 | /** | ||
| 176 | * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given blue bit | ||
| 177 | * | ||
| 178 | * @note The blue byte is the last byte in the color packet | ||
| 179 | * | ||
| 180 | * @param[in] led: The led index [0, @ref WS2812_LED_N) | ||
| 181 | * @param[in] bit: The bit index [0, 7] | ||
| 182 | * | ||
| 183 | * @return The bit index | ||
| 184 | */ | ||
| 185 | #define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 2, (bit)) | ||
| 186 | |||
| 187 | /* --- PRIVATE VARIABLES ---------------------------------------------------- */ | ||
| 188 | |||
| 189 | static uint32_t ws2812_frame_buffer[WS2812_BIT_N + 1]; /**< Buffer for a frame */ | ||
| 190 | |||
| 191 | /* --- PUBLIC FUNCTIONS ----------------------------------------------------- */ | ||
| 192 | /* | ||
| 193 | * Gedanke: Double-buffer type transactions: double buffer transfers using two memory pointers for | ||
| 194 | the memory (while the DMA is reading/writing from/to a buffer, the application can | ||
| 195 | write/read to/from the other buffer). | ||
| 196 | */ | ||
| 197 | |||
| 198 | void ws2812_init(void) | ||
| 199 | { | ||
| 200 | // Initialize led frame buffer | ||
| 201 | uint32_t i; | ||
| 202 | for (i = 0; i < WS2812_COLOR_BIT_N; i++) ws2812_frame_buffer[i] = WS2812_DUTYCYCLE_0; // All color bits are zero duty cycle | ||
| 203 | for (i = 0; i < WS2812_RESET_BIT_N; i++) ws2812_frame_buffer[i + WS2812_COLOR_BIT_N] = 0; // All reset bits are zero | ||
| 204 | // Configure pin as AF output. If there's an external pull up resistor the signal level is brought to 5V using open drain mode. | ||
| 205 | #ifdef WS2812_EXTERNAL_PULLUP | ||
| 206 | palSetPadMode(PORT_WS2812, PIN_WS2812, PAL_MODE_ALTERNATE(WS2812_AF) | PAL_STM32_OTYPE_OPENDRAIN); | ||
| 207 | #else | ||
| 208 | palSetPadMode(PORT_WS2812, PIN_WS2812, PAL_MODE_ALTERNATE(WS2812_AF) | PAL_STM32_OTYPE_PUSHPULL); //PAL_MODE_STM32_ALTERNATE_PUSHPULL); | ||
| 209 | #endif | ||
| 210 | //palClearPad(PORT_WS2812, PIN_WS2812); | ||
| 211 | //wait_ms(1); | ||
| 212 | // PWM Configuration | ||
| 213 | #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 | ||
| 214 | static const PWMConfig ws2812_pwm_config = { | ||
| 215 | .frequency = WS2812_PWM_FREQUENCY, | ||
| 216 | .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 | ||
| 217 | .callback = NULL, | ||
| 218 | .channels = { | ||
| 219 | [0 ... 3] = {.mode = PWM_OUTPUT_DISABLED, .callback = NULL}, // Channels default to disabled | ||
| 220 | [WS2812_TIM_CH] = {.mode = PWM_OUTPUT_ACTIVE_HIGH, .callback = NULL}, // Turn on the channel we care about | ||
| 221 | }, | ||
| 222 | .cr2 = 0, | ||
| 223 | .dier = TIM_DIER_UDE, // DMA on update event for next period | ||
| 224 | }; | ||
| 225 | #pragma GCC diagnostic pop // Restore command-line warning options | ||
| 226 | |||
| 227 | // Configure DMA | ||
| 228 | //dmaInit(); // Joe added this | ||
| 229 | dmaStreamAllocate(WS2812_DMA_STREAM, 10, NULL, NULL); | ||
| 230 | dmaStreamSetPeripheral(WS2812_DMA_STREAM, &(WS2812_PWMD.tim->CCR[WS2812_TIM_CH])); // Ziel ist der An-Zeit im Cap-Comp-Register | ||
| 231 | dmaStreamSetMemory0(WS2812_DMA_STREAM, ws2812_frame_buffer); | ||
| 232 | dmaStreamSetTransactionSize(WS2812_DMA_STREAM, WS2812_BIT_N); | ||
| 233 | dmaStreamSetMode(WS2812_DMA_STREAM, | ||
| 234 | STM32_DMA_CR_CHSEL(WS2812_DMA_CHANNEL) | STM32_DMA_CR_DIR_M2P | STM32_DMA_CR_PSIZE_WORD | STM32_DMA_CR_MSIZE_WORD | | ||
| 235 | STM32_DMA_CR_MINC | STM32_DMA_CR_CIRC | STM32_DMA_CR_PL(3)); | ||
| 236 | // M2P: Memory 2 Periph; PL: Priority Level | ||
| 237 | |||
| 238 | // Start DMA | ||
| 239 | dmaStreamEnable(WS2812_DMA_STREAM); | ||
| 240 | |||
| 241 | // Configure PWM | ||
| 242 | // NOTE: It's required that preload be enabled on the timer channel CCR register. This is currently enabled in the | ||
| 243 | // 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, | ||
| 244 | // disable counting, enable the channel, and then make whatever configuration changes we need. | ||
| 245 | pwmStart(&WS2812_PWMD, &ws2812_pwm_config); | ||
| 246 | pwmEnableChannel(&WS2812_PWMD, WS2812_TIM_CH, 0); // Initial period is 0; output will be low until first duty cycle is DMA'd in | ||
| 247 | } | ||
| 248 | |||
| 249 | ws2812_err_t ws2812_write_led(uint32_t led_number, uint8_t r, uint8_t g, uint8_t b) | ||
| 250 | { | ||
| 251 | // Check for valid LED | ||
| 252 | if (led_number > WS2812_LED_N) return WS2812_LED_INVALID; | ||
| 253 | |||
| 254 | // Write color to frame buffer | ||
| 255 | for (uint32_t bit = 0; bit < 8; bit++) { | ||
| 256 | ws2812_frame_buffer[WS2812_RED_BIT(led_number, bit)] = ((r >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0; | ||
| 257 | ws2812_frame_buffer[WS2812_GREEN_BIT(led_number, bit)] = ((g >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0; | ||
| 258 | ws2812_frame_buffer[WS2812_BLUE_BIT(led_number, bit)] = ((b >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0; | ||
| 259 | } | ||
| 260 | |||
| 261 | // Success | ||
| 262 | return WS2812_SUCCESS; | ||
| 263 | } | ||
| 264 | |||
| 265 | void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds) | ||
| 266 | { | ||
| 267 | for(int i = 0; i < number_of_leds; i++) { | ||
| 268 | ws2812_write_led(i, ledarray[i].r, ledarray[i].g, ledarray[i].b); | ||
| 269 | } | ||
| 270 | } | ||
| 271 | |||
| 272 | /** @} addtogroup WS2812 */ | ||
diff --git a/keyboards/matrix/noah/ws2812_f4.h b/keyboards/matrix/noah/ws2812_f4.h deleted file mode 100644 index 245bd15fe..000000000 --- a/keyboards/matrix/noah/ws2812_f4.h +++ /dev/null | |||
| @@ -1,102 +0,0 @@ | |||
| 1 | /** | ||
| 2 | * @file ws2812.h | ||
| 3 | * @author Austin Glaser <austin.glaser@gmail.com> | ||
| 4 | * @brief Interface to WS2812 LED driver | ||
| 5 | * | ||
| 6 | * Copyright (C) 2016 Austin Glaser | ||
| 7 | * | ||
| 8 | * This software may be modified and distributed under the terms | ||
| 9 | * of the MIT license. See the LICENSE file for details. | ||
| 10 | * | ||
| 11 | * @todo Put in names and descriptions of variables which need to be defined to use this file | ||
| 12 | */ | ||
| 13 | |||
| 14 | #ifndef WS2812_H_ | ||
| 15 | #define WS2812_H_ | ||
| 16 | |||
| 17 | /** | ||
| 18 | * @defgroup WS2812 WS2812 Driver | ||
| 19 | * @{ | ||
| 20 | * | ||
| 21 | * @brief DMA-based WS2812 LED driver | ||
| 22 | * | ||
| 23 | * A driver for WS2812 LEDs | ||
| 24 | */ | ||
| 25 | |||
| 26 | /* --- PUBLIC DEPENDENCIES -------------------------------------------------- */ | ||
| 27 | |||
| 28 | // Standard | ||
| 29 | #include <stdint.h> | ||
| 30 | #include "color.h" | ||
| 31 | |||
| 32 | /* --- PUBLIC MACROS -------------------------------------------------------- */ | ||
| 33 | |||
| 34 | /** | ||
| 35 | * @brief Concatenates two symbols s1 and s2 exactly, without expanding either | ||
| 36 | * | ||
| 37 | * @param[in] s1: The first symbol to concatenate | ||
| 38 | * @param[in] s2: The second symbol to concatenate | ||
| 39 | * | ||
| 40 | * @return A single symbol containing s1 and s2 concatenated without expansion | ||
| 41 | */ | ||
| 42 | #define CONCAT_SYMBOLS(s1, s2) s1##s2 | ||
| 43 | |||
| 44 | /** | ||
| 45 | * @brief Concatenate the symbols s1 and s2, expanding both of them | ||
| 46 | * | ||
| 47 | * This is important because simply applying s1##s2 doesn't expand them if they're | ||
| 48 | * preprocessor tokens themselves | ||
| 49 | * | ||
| 50 | * @param[in] s1: The first symbol to concatenate | ||
| 51 | * @param[in] s2: The second symbol to concatenate | ||
| 52 | * | ||
| 53 | * @return A single symbol containing s1 expanded followed by s2 expanded | ||
| 54 | */ | ||
| 55 | #define CONCAT_EXPANDED_SYMBOLS(s1, s2) CONCAT_SYMBOLS(s1, s2) | ||
| 56 | |||
| 57 | /* --- PUBLIC CONSTANTS ----------------------------------------------------- */ | ||
| 58 | |||
| 59 | /** | ||
| 60 | * @brief Return codes from ws2812 interface functions | ||
| 61 | */ | ||
| 62 | typedef enum { | ||
| 63 | WS2812_SUCCESS = 0x00, /**< Operation completeed successfully */ | ||
| 64 | WS2812_LED_INVALID, /**< Attempted to index an invalid LED (@ref WS2812_N_LEDS) */ | ||
| 65 | MAX_WS2812_ERR, /**< Total number of possible error codes */ | ||
| 66 | WS2812_ERR_INVALID /**< Invalid error value */ | ||
| 67 | } ws2812_err_t; | ||
| 68 | |||
| 69 | /* --- PUBLIC FUNCTIONS ----------------------------------------------------- */ | ||
| 70 | |||
| 71 | /** | ||
| 72 | * @brief Initialize the driver | ||
| 73 | * | ||
| 74 | * After this function is called, all necessary background tasks will be started. | ||
| 75 | * The frame is initially dark. | ||
| 76 | */ | ||
| 77 | void ws2812_init(void); | ||
| 78 | |||
| 79 | /** | ||
| 80 | * @brief Write the value of a single LED in the chain | ||
| 81 | * | ||
| 82 | * The color value is written to a frame buffer, and will not | ||
| 83 | * be updated until the next frame is written. Frames are written | ||
| 84 | * at the maximum possible speed -- the longest latency between a | ||
| 85 | * call to this function and the value being displayed is | ||
| 86 | * 1.25uS*(24*@ref WS2812_LED_N + 50) | ||
| 87 | * | ||
| 88 | * @param[in] led_number: The index of the LED to be written. Must be strictly less than | ||
| 89 | * @ref WS2812_N_LEDS | ||
| 90 | * @param[in] r: The red level of the LED | ||
| 91 | * @param[in] g: The green level of the LED | ||
| 92 | * @param[in] b: The blue level of the LED | ||
| 93 | * | ||
| 94 | * @retval WS2812_SUCCESS: The write was successful | ||
| 95 | * @retval WS2812_LED_INVALID: The write was to an invalid LED index | ||
| 96 | */ | ||
| 97 | ws2812_err_t ws2812_write_led(uint32_t led_number, uint8_t r, uint8_t g, uint8_t b); | ||
| 98 | |||
| 99 | void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds); | ||
| 100 | /** @} defgroup WS2812 */ | ||
| 101 | |||
| 102 | #endif // ifndef WS2812_H_ | ||
