Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PWM DMA based RGB Underglow for STM32 #7928

Merged
merged 3 commits into from
Mar 1, 2020
Merged

Conversation

zvecr
Copy link
Member

@zvecr zvecr commented Jan 18, 2020

Description

Based off https://github.com/joewa/WS2812-LED-Driver_ChibiOS, this PR aims to implement ws2812 PWM support within the new ws2812 framework.

Status
f072 ?
f103 ✔️
f303 ✔️
f401/f411 ✔️

Notes

  1. I have added a non documented WS2812_PWM_TARGET_PERIOD option
    • the original code seems to use a 10x larger value, but does not work with the testing i've done so far
    • if required, board maintainers can use whatever value works for them

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@zvecr zvecr added the core label Jan 18, 2020
@zvecr zvecr requested a review from a team January 18, 2020 16:51
@tzarc
Copy link
Member

tzarc commented Jan 19, 2020

Could this leverage something similar to https://github.com/hubmartin/WS2812B_STM32F103/blob/master/src/ws2812b.c to decrease the memory requirements?

@zvecr
Copy link
Member Author

zvecr commented Jan 19, 2020

Maybe, at the moment I am not too worried about memory usage as its in the same ball park as the SPI driver.

Just trying to remove stuff like keyboards/matrix/noah/ws2812_f4.c from the repo, the Apache stuff in the PR queue, and provide #6516/#6675.

@zvecr zvecr marked this pull request as ready for review January 20, 2020 02:24
@tzarc
Copy link
Member

tzarc commented Feb 2, 2020

Working with L0xx as well.

drivers/arm/ws2812_pwm.c Outdated Show resolved Hide resolved
@tzarc tzarc requested a review from a team February 2, 2020 21:23
zvecr added a commit that referenced this pull request Feb 4, 2020
PWM DMA based RGB Underglow for STM32
@drashna
Copy link
Member

drashna commented Feb 5, 2020

__attribute__((weak))

Want to test it, but .... not up to doing so ATM

@zvecr zvecr force-pushed the feature/ws2812_pwm branch from 3cf5f9f to 79945b6 Compare February 13, 2020 21:23
@drashna drashna requested a review from a team February 19, 2020 22:47
drivers/arm/ws2812_pwm.c Outdated Show resolved Hide resolved
@tzarc
Copy link
Member

tzarc commented Mar 1, 2020

Confirmed working with this applied over current post-future master, using L0xx.

@tzarc tzarc merged commit f74c769 into qmk:master Mar 1, 2020
cmaier pushed a commit to cmaier/qmk_firmware that referenced this pull request Mar 1, 2020
* Add pwm ws2812 driver

* Add docs for pwm ws2812 driver

* Update ws2812_pwm for ChibiOS 19

Co-Authored-By: Nick Brassel <[email protected]>

Co-authored-by: Nick Brassel <[email protected]>
#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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have used the same codes for the noah keyboard(stm32f11ce based board), and it should use 800K, not sure why it was modified to 80000.

Copy link
Member Author

@zvecr zvecr Mar 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesnt work with 800K on anything that has been tested so far, which includes some f411 blackpill boards 🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the testing system was running with HSI clock(8mHz, not the HSE at 8x9 on f303 or 8x12 on f411)?

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

#define WS2812_PWM_FREQUENCY (STM32_SYSCLK / 2) /**< Clock frequency of PWM, must be valid with respect to system clock! */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The timer's frequency depends on the specific APB1 or APB2's frequency, and which was decided by the APB divider defined on the mcuconf.h. If anyone tuned the value, the PWM frequency will be incorrect, so it better to make this MACRO overridable as the pwm driver and time channel selections.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to add an incremental PR, but as this has been merged its too late to change it within this PR.

rhruiz pushed a commit to rhruiz/qmk_firmware that referenced this pull request Mar 1, 2020
* Add pwm ws2812 driver

* Add docs for pwm ws2812 driver

* Update ws2812_pwm for ChibiOS 19

Co-Authored-By: Nick Brassel <[email protected]>

Co-authored-by: Nick Brassel <[email protected]>
Shinichi-Ohki added a commit to Shinichi-Ohki/qmk_firmware that referenced this pull request Mar 3, 2020
* 'master' of https://github.com/qmk/qmk_firmware: (37 commits)
  Update Hungarian keymap and add sendstring LUT (qmk#8220)
  Remove "ugly hack in usb_main.c" comments (qmk#8296)
  Update encoder functions for Iris VIA keymap (qmk#8295)
  Reduce PROGMEM usage for sendstring LUT (qmk#8109)
  [Docs] Update ISP Flashing guide (qmk#8149)
  Rewrite the Bathroom Epiphanies Frosty Flake matrix and LED handling (qmk#8243)
  Add onekey keymap for testing reset to bootloader. (qmk#8288)
  Get the direction right on the S75 encoder (qmk#8287)
  Prune out pure software pwm && custom driver && remove wrapping BACKLIGHT_PIN (qmk#8041)
  Make a fix to savage65 and tmov2 for via (qmk#8286)
  format code according to conventions [skip ci]
  Short term fix for conflicting types for 'tfp_printf' (qmk#8157)
  Fix recent clang-format breaking quantum.c (qmk#8282)
  format code according to conventions [skip ci]
  Remove duplicate BRTG case (qmk#8277)
  Clean up includes for glcdfont headers (qmk#7745)
  Fix the Breaking Changes doc again
  [Docs] translated 'feature_tap_dance.md' to japanese. (qmk#8137)
  PWM DMA based RGB Underglow for STM32 (qmk#7928)
  Add VIA support to Prime_M. Clean up all files (qmk#8247)
  ...
HokieGeek pushed a commit to HokieGeek/qmk_firmware that referenced this pull request Mar 5, 2020
* Add pwm ws2812 driver

* Add docs for pwm ws2812 driver

* Update ws2812_pwm for ChibiOS 19

Co-Authored-By: Nick Brassel <[email protected]>

Co-authored-by: Nick Brassel <[email protected]>
c0psrul3 pushed a commit to c0psrul3/qmk_firmware that referenced this pull request Mar 23, 2020
* Add pwm ws2812 driver

* Add docs for pwm ws2812 driver

* Update ws2812_pwm for ChibiOS 19

Co-Authored-By: Nick Brassel <[email protected]>

Co-authored-by: Nick Brassel <[email protected]>
sowbug pushed a commit to sowbug/qmk_firmware that referenced this pull request Apr 2, 2020
* Add pwm ws2812 driver

* Add docs for pwm ws2812 driver

* Update ws2812_pwm for ChibiOS 19

Co-Authored-By: Nick Brassel <[email protected]>

Co-authored-by: Nick Brassel <[email protected]>
kylekuj pushed a commit to kylekuj/qmk_firmware that referenced this pull request Apr 21, 2020
* Add pwm ws2812 driver

* Add docs for pwm ws2812 driver

* Update ws2812_pwm for ChibiOS 19

Co-Authored-By: Nick Brassel <[email protected]>

Co-authored-by: Nick Brassel <[email protected]>
@zvecr zvecr deleted the feature/ws2812_pwm branch April 28, 2020 01:10
drashna pushed a commit to zsa/qmk_firmware that referenced this pull request May 24, 2020
* Add pwm ws2812 driver

* Add docs for pwm ws2812 driver

* Update ws2812_pwm for ChibiOS 19

Co-Authored-By: Nick Brassel <[email protected]>

Co-authored-by: Nick Brassel <[email protected]>
drashna pushed a commit to zsa/qmk_firmware that referenced this pull request May 24, 2020
* Add pwm ws2812 driver

* Add docs for pwm ws2812 driver

* Update ws2812_pwm for ChibiOS 19

Co-Authored-By: Nick Brassel <[email protected]>

Co-authored-by: Nick Brassel <[email protected]>
fdidron pushed a commit to zsa/qmk_firmware that referenced this pull request Jun 12, 2020
* Add pwm ws2812 driver

* Add docs for pwm ws2812 driver

* Update ws2812_pwm for ChibiOS 19

Co-Authored-By: Nick Brassel <[email protected]>

Co-authored-by: Nick Brassel <[email protected]>
jakeisnt pushed a commit to jakeisnt/qmk_firmware that referenced this pull request Aug 20, 2020
* Add pwm ws2812 driver

* Add docs for pwm ws2812 driver

* Update ws2812_pwm for ChibiOS 19

Co-Authored-By: Nick Brassel <[email protected]>

Co-authored-by: Nick Brassel <[email protected]>
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
* Add pwm ws2812 driver

* Add docs for pwm ws2812 driver

* Update ws2812_pwm for ChibiOS 19

Co-Authored-By: Nick Brassel <[email protected]>

Co-authored-by: Nick Brassel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants