Skip to content

Commit 183ff60

Browse files
committed
pwm_index_check
1 parent 9695e40 commit 183ff60

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/arduino/zephyrCommon.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,11 @@ void analogWrite(pin_size_t pinNumber, int value)
336336
{
337337
size_t idx = pwm_pin_index(pinNumber);
338338

339-
if (!pwm_is_ready_dt(&arduino_pwm[idx])) {
339+
if (idx >= ARRAY_SIZE(arduino_pwm) ) {
340340
return;
341341
}
342342

343-
if (idx >= ARRAY_SIZE(arduino_pwm) ) {
343+
if (!pwm_is_ready_dt(&arduino_pwm[idx])) {
344344
return;
345345
}
346346

0 commit comments

Comments
 (0)