mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 09:38:37 +08:00
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:
@@ -71,6 +71,13 @@ config RGBLED
|
|||||||
This selection enables building of the "upper-half" RGB LED driver.
|
This selection enables building of the "upper-half" RGB LED driver.
|
||||||
See include/nuttx/rgbled.h for further PWM driver information.
|
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
|
config RGBLED_INVERT
|
||||||
bool "Invert RGB LED Output"
|
bool "Invert RGB LED Output"
|
||||||
depends on RGBLED
|
depends on RGBLED
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ static ssize_t rgbled_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
|
|
||||||
#ifdef CONFIG_PWM_MULTICHAN
|
#ifdef CONFIG_PWM_MULTICHAN
|
||||||
memset(&pwm, 0, sizeof(struct pwm_info_s));
|
memset(&pwm, 0, sizeof(struct pwm_info_s));
|
||||||
pwm.frequency = 100;
|
pwm.frequency = CONFIG_RGBLED_PWM_FREQ;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
pwm.channels[i].duty = red;
|
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);
|
ledb->ops->start(ledb, &pwm);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
pwm.frequency = 100;
|
pwm.frequency = CONFIG_RGBLED_PWM_FREQ;
|
||||||
|
|
||||||
pwm.duty = red;
|
pwm.duty = red;
|
||||||
ledr->ops->start(ledr, &pwm);
|
ledr->ops->start(ledr, &pwm);
|
||||||
|
|||||||
Reference in New Issue
Block a user