Skip to content

Commit 674a703

Browse files
committed
zephyrCommon: Removed pulseIn GPIO direction check
Since the general Arduino implementation does not check the GPIO direction, this check has been removed to improve compatibility.
1 parent 211d5dc commit 674a703

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

cores/arduino/zephyrCommon.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,6 @@ long random(long max) {
407407

408408
#endif
409409

410-
#ifdef CONFIG_GPIO_GET_DIRECTION
411-
412410
unsigned long pulseIn(pin_size_t pinNumber, uint8_t state, unsigned long timeout) {
413411
struct k_timer timer;
414412
int64_t start, end, delta = 0;
@@ -421,10 +419,6 @@ unsigned long pulseIn(pin_size_t pinNumber, uint8_t state, unsigned long timeout
421419
goto cleanup;
422420
}
423421

424-
if (!gpio_pin_is_input_dt(spec)) {
425-
goto cleanup;
426-
}
427-
428422
while(gpio_pin_get_dt(spec) == state && k_timer_status_get(&timer) == 0);
429423
if (k_timer_status_get(&timer) > 0) {
430424
goto cleanup;
@@ -449,8 +443,6 @@ unsigned long pulseIn(pin_size_t pinNumber, uint8_t state, unsigned long timeout
449443
return (unsigned long)delta;
450444
}
451445

452-
#endif // CONFIG_GPIO_GET_DIRECTION
453-
454446
void enableInterrupt(pin_size_t pinNumber) {
455447
struct gpio_port_callback *pcb = find_gpio_port_callback(arduino_pins[pinNumber].port);
456448

0 commit comments

Comments
 (0)