Skip to content

Commit 441a665

Browse files
committed
fix implemet pwm_write
1 parent 4fcffd4 commit 441a665

File tree

1 file changed

+2
-1
lines changed
  • hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF51822

1 file changed

+2
-1
lines changed

hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF51822/pwmout_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ void pwmout_write(pwmout_t *obj, float value)
160160
if (value > 1.0f) {
161161
value = 1.0f;
162162
}
163-
uint16_t ticks = (uint16_t)((float)app_pwm_cycle_ticks_get(pwm->instance) * value);
163+
164+
app_pwm_channel_duty_set(pwm->instance, obj->pwm_channel, (app_pwm_duty_t)(value * 100.0f) );
164165
}
165166

166167
float pwmout_read(pwmout_t *obj)

0 commit comments

Comments
 (0)