drivers: led_pwm: Decrease power consumption
Changed pwm_pin_set_cycles into pwm_pin_set_nsec to decrease power consumption. Changed default value for period to 100000. There is no need in having period for pwm leds equal to 100 cycles as human eye has ~100 fps. Signed-off-by: Jan Zyczkowski <jan.zyczkowski@nordicsemi.no>
This commit is contained in:
parent
b9d4471dbd
commit
d435340f1b
1 changed files with 3 additions and 3 deletions
|
@ -76,7 +76,7 @@ static int led_pwm_set_brightness(const struct device *dev,
|
||||||
|
|
||||||
pulse = led_pwm->period * value / 100;
|
pulse = led_pwm->period * value / 100;
|
||||||
|
|
||||||
return pwm_pin_set_cycles(led_pwm->dev, led_pwm->channel,
|
return pwm_pin_set_nsec(led_pwm->dev, led_pwm->channel,
|
||||||
led_pwm->period, pulse, led_pwm->flags);
|
led_pwm->period, pulse, led_pwm->flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ static const struct led_driver_api led_pwm_api = {
|
||||||
{ \
|
{ \
|
||||||
.dev = DEVICE_DT_GET(DT_PWMS_CTLR(led_node_id)), \
|
.dev = DEVICE_DT_GET(DT_PWMS_CTLR(led_node_id)), \
|
||||||
.channel = DT_PWMS_CHANNEL(led_node_id), \
|
.channel = DT_PWMS_CHANNEL(led_node_id), \
|
||||||
.period = DT_PHA_OR(led_node_id, pwms, period, 100), \
|
.period = DT_PHA_OR(led_node_id, pwms, period, 100000), \
|
||||||
.flags = DT_PHA_OR(led_node_id, pwms, flags, \
|
.flags = DT_PHA_OR(led_node_id, pwms, flags, \
|
||||||
PWM_POLARITY_NORMAL), \
|
PWM_POLARITY_NORMAL), \
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue