Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into xap
Browse files Browse the repository at this point in the history
  • Loading branch information
qmk-bot committed Oct 28, 2024
2 parents ebd1b6a + 7630a80 commit c071a9f
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 43 deletions.
1 change: 0 additions & 1 deletion keyboards/bastardkb/charybdis/3x5/blackpill/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#define WS2812_EXTERNAL_PULLUP
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM1
#define WS2812_PWM_DMA_CHANNEL 3
#define WS2812_PWM_TARGET_PERIOD 800000

/* Serial configuration for split keyboard. */
#define SERIAL_USART_TX_PIN A9
Expand Down
1 change: 0 additions & 1 deletion keyboards/bastardkb/charybdis/3x6/blackpill/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#define WS2812_EXTERNAL_PULLUP
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM1
#define WS2812_PWM_DMA_CHANNEL 3
#define WS2812_PWM_TARGET_PERIOD 800000

/* Serial configuration for split keyboard. */
#define SERIAL_USART_TX_PIN A9
Expand Down
1 change: 0 additions & 1 deletion keyboards/bastardkb/charybdis/4x6/blackpill/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#define WS2812_EXTERNAL_PULLUP
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM1
#define WS2812_PWM_DMA_CHANNEL 3
#define WS2812_PWM_TARGET_PERIOD 800000

/* Serial configuration for split keyboard. */
#define SERIAL_USART_TX_PIN A9
Expand Down
1 change: 0 additions & 1 deletion keyboards/bastardkb/scylla/blackpill/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#define WS2812_EXTERNAL_PULLUP
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM1
#define WS2812_PWM_DMA_CHANNEL 3
#define WS2812_PWM_TARGET_PERIOD 800000

/* Serial configuration for split keyboard. */
#define SERIAL_USART_TX_PIN A9
Expand Down
1 change: 0 additions & 1 deletion keyboards/bastardkb/skeletyl/blackpill/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#define WS2812_EXTERNAL_PULLUP
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM1
#define WS2812_PWM_DMA_CHANNEL 3
#define WS2812_PWM_TARGET_PERIOD 800000

/* Serial configuration for split keyboard. */
#define SERIAL_USART_TX_PIN A9
Expand Down
1 change: 0 additions & 1 deletion keyboards/bastardkb/tbkmini/blackpill/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#define WS2812_EXTERNAL_PULLUP
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM1
#define WS2812_PWM_DMA_CHANNEL 3
#define WS2812_PWM_TARGET_PERIOD 800000

/* Serial configuration for split keyboard. */
#define SERIAL_USART_TX_PIN A9
Expand Down
1 change: 0 additions & 1 deletion keyboards/handwired/macroboard/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define WS2812_PWM_PAL_MODE 2
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM6 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
#define WS2812_PWM_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
#define WS2812_PWM_TARGET_PERIOD 800000
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define WS2812_PWM_COMPLEMENTARY_OUTPUT // Define for a complementary timer output (TIMx_CHyN); omit for a normal timer output (TIMx_CHy).
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM7 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
#define WS2812_PWM_DMA_CHANNEL 3 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
#define WS2812_PWM_TARGET_PERIOD 800000

#define DEBUG_LED_PIN C13

Expand Down
3 changes: 1 addition & 2 deletions keyboards/mode/m60h/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
#define WS2812_PWM_DRIVER PWMD4
#define WS2812_PWM_CHANNEL 4
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM6
#define WS2812_PWM_DMA_CHANNEL 2
#define WS2812_PWM_TARGET_PERIOD 800000
#define WS2812_PWM_DMA_CHANNEL 2
3 changes: 1 addition & 2 deletions keyboards/mode/m60h_f/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
#define WS2812_PWM_DRIVER PWMD4
#define WS2812_PWM_CHANNEL 4
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM6
#define WS2812_PWM_DMA_CHANNEL 2
#define WS2812_PWM_TARGET_PERIOD 800000
#define WS2812_PWM_DMA_CHANNEL 2
3 changes: 1 addition & 2 deletions keyboards/mode/m60s/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
#define WS2812_PWM_DRIVER PWMD4
#define WS2812_PWM_CHANNEL 4
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM6
#define WS2812_PWM_DMA_CHANNEL 2
#define WS2812_PWM_TARGET_PERIOD 800000
#define WS2812_PWM_DMA_CHANNEL 2
37 changes: 8 additions & 29 deletions platforms/chibios/drivers/ws2812_pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@
# endif
#endif

#ifndef WS2812_PWM_TARGET_PERIOD
//# define WS2812_PWM_TARGET_PERIOD 800000 // Original code is 800k...?
# define WS2812_PWM_TARGET_PERIOD 80000 // TODO: work out why 10x less on f303/f4x1
// Default is 800000Hz, which has a period of 1.25us
#ifndef WS2812_PWM_FREQUENCY
# define WS2812_PWM_FREQUENCY (1000000000 / WS2812_TIMING)
#endif

/* --- PRIVATE CONSTANTS ---------------------------------------------------- */

#define WS2812_PWM_FREQUENCY (CPU_CLOCK / 2) /**< Clock frequency of PWM, must be valid with respect to system clock! */
#define WS2812_PWM_PERIOD (WS2812_PWM_FREQUENCY / WS2812_PWM_TARGET_PERIOD) /**< Clock period in ticks. 1 / 800kHz = 1.25 uS (as per datasheet) */
#define WS2812_PWM_TICK_FREQUENCY (CPU_CLOCK / 2) /**< Clock frequency of PWM ticks, must be valid with respect to system clock! */
#define WS2812_PWM_PERIOD (WS2812_PWM_TICK_FREQUENCY / WS2812_PWM_FREQUENCY) /**< Clock period in PWM ticks. */

/**
* @brief Number of bit-periods to hold the data line low at the end of a frame
Expand All @@ -102,37 +102,16 @@

/**
* @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 / 350))
#define WS2812_DUTYCYCLE_0 (WS2812_PWM_TICK_FREQUENCY / (1000000000 / WS2812_T0H))
#if (WS2812_DUTYCYCLE_0 > 255)
# error WS2812 PWM driver: High period for a 0 is more than a byte
#endif

/**
* @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 / 800))
#define WS2812_DUTYCYCLE_1 (WS2812_PWM_TICK_FREQUENCY / (1000000000 / WS2812_T1H))
#if (WS2812_DUTYCYCLE_1 > 255)
# error WS2812 PWM driver: High period for a 1 is more than a byte
#endif
Expand Down Expand Up @@ -322,7 +301,7 @@ void ws2812_init(void) {
// 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,
.frequency = WS2812_PWM_TICK_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 =
Expand Down

0 comments on commit c071a9f

Please sign in to comment.