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

boards/nrf52840dongle: Configure PWM to drive the LEDs #15115

Merged
merged 1 commit into from Sep 29, 2020

Conversation

chrysn
Copy link
Member

@chrysn chrysn commented Sep 29, 2020

Contribution description

The nRF52840-Donle board has hardware that lends itself to PWM driving, but did not configure a default PWM setting.

This adds a single PWM peripheral that is configured for the LEDs LD1, LD2#red, LD2#green and LD2#blue.

Testing procedure

$ make BOARD=nrf52840dongle -C tests/periph_pwm all flash term
[...]
> osci

and watch the green LED and the roughly-white-appearing RGB LED fade in unison.

The LEDs are driven active-low, which is of no concern to the PWM module but will help understand the values when you test that the documented assignment ("is set to drive the LEDs LD1 and the channels LD2 red, green and blue in the four channels of PWM_DEV(0)") matches:

> init 0 0 1000 255
> set 0 0 255 # turn off LD1
> set 0 1 255 # turn off LD2#red, leaving it turquise
> set 0 2 250 # turn off almost all of LD2#green, leaving it blue
> set 0 3 255 # turn off LD2#blue, leaving the faint green from before

Issues/PRs references

This is done a) because it's a peripheral that can reasonably expected to be wired, and b) as a test case for #15106.

@chrysn chrysn added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: boards Area: Board ports labels Sep 29, 2020
@chrysn chrysn self-assigned this Sep 29, 2020
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

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

works like a charm

@benpicco benpicco merged commit bd7a9fe into RIOT-OS:master Sep 29, 2020
@chrysn chrysn deleted the nrf52840-pwm branch September 30, 2020 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants