We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 347a80d commit c095fecCopy full SHA for c095fec
cores/arduino/zephyrCommon.cpp
@@ -217,6 +217,10 @@ void analogWrite(pin_size_t pinNumber, int value)
217
{
218
size_t idx = pwm_pin_index(pinNumber);
219
220
+ if (!pwm_is_ready_dt(&arduino_pwm[idx])) {
221
+ return;
222
+ }
223
+
224
if (idx >= ARRAY_SIZE(arduino_pwm) ) {
225
return;
226
}
@@ -231,8 +235,7 @@ void analogWrite(pin_size_t pinNumber, int value)
231
235
* A duty ratio determines by the period value defined in dts
232
236
* and the value arguments. So usually the period value sets as 255.
233
237
*/
234
- (void)pwm_set_cycles(arduino_pwm[idx].dev, arduino_pwm[idx].channel,
- arduino_pwm[idx].period, value, arduino_pwm[idx].flags);
238
+ (void)pwm_set_pulse_dt(&arduino_pwm[idx], value);
239
240
241
#endif
0 commit comments