Made the PWM frequency of the RGB driver configurable from the menu.
Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>
This commit is contained in:
parent
bc084a8505
commit
fd4dd59c3c
@ -71,6 +71,13 @@ config RGBLED
|
||||
This selection enables building of the "upper-half" RGB LED driver.
|
||||
See include/nuttx/rgbled.h for further PWM driver information.
|
||||
|
||||
config RGBLED_PWM_FREQ
|
||||
int "PWM Frequency (Hz)"
|
||||
depends on RGBLED
|
||||
default 100
|
||||
---help---
|
||||
This controls the frequency of the PWM channel powering each led.
|
||||
|
||||
config RGBLED_INVERT
|
||||
bool "Invert RGB LED Output"
|
||||
depends on RGBLED
|
||||
|
@ -360,7 +360,7 @@ static ssize_t rgbled_write(FAR struct file *filep, FAR const char *buffer,
|
||||
|
||||
#ifdef CONFIG_PWM_MULTICHAN
|
||||
memset(&pwm, 0, sizeof(struct pwm_info_s));
|
||||
pwm.frequency = 100;
|
||||
pwm.frequency = CONFIG_RGBLED_PWM_FREQ;
|
||||
|
||||
i = 0;
|
||||
pwm.channels[i].duty = red;
|
||||
@ -433,7 +433,7 @@ static ssize_t rgbled_write(FAR struct file *filep, FAR const char *buffer,
|
||||
ledb->ops->start(ledb, &pwm);
|
||||
}
|
||||
#else
|
||||
pwm.frequency = 100;
|
||||
pwm.frequency = CONFIG_RGBLED_PWM_FREQ;
|
||||
|
||||
pwm.duty = red;
|
||||
ledr->ops->start(ledr, &pwm);
|
||||
|
Loading…
Reference in New Issue
Block a user