Skip to content

Conversation

soburi
Copy link
Member

@soburi soburi commented Aug 23, 2025

  • The structure has been revised and unnecessary fields have been removed.
  • Interrupt masks are now directly modified by changing the pin_mask
    parameter in struct gpio_callback.
  • Renamed non-Arduino-derived setInterruptHandler and handleGpioCallback
    functions to Zephyr-like names.

@soburi soburi changed the title zephyrCommon: Improved interrupt handling [DNM] zephyrCommon: Improved interrupt handling Aug 23, 2025
soburi and others added 14 commits August 24, 2025 07:57
Use the checkpatch.pl included with Zephyr to perform the check.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Changed boards to be specified by their normalized names.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Modify to use west.yml included in the PR version.
Accordingly, the initialization process has been changed.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Added cmsis_6 to the repository in line with the update of Zephyr.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Apply newest zephyr version

Signed-off-by: TOKITA Hiroshi <[email protected]>
Get the variant name (NORMALIZED_BOARD_TARGET) from the Zephyr build
system as early as possible. This allows to have per-target build
directories.

Note that a bug with the shield specifiers does not currently allow to
reuse the same build directory multiple times.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Co-authored-by: Luca Burelli <[email protected]>
Fixed an issue where the reference location for the interrupt
handler was a bit mask instead of an index value.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Improved to align more closely with the standard Arduino implementation.

- Eliminated the end timer and used counting to determine the end.
- Improved to handle infinity correctly.
- Added a guard to prevent the timeout value from reaching 0.
- Set the GPIO value to 0 when the timer starts.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Since the general Arduino implementation does not check the GPIO
direction, this check has been removed to improve compatibility.

Signed-off-by: TOKITA Hiroshi <[email protected]>
If gpio is not initialized, the pulseIn function will terminate
without running the timer.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Since Arduino's `delayMicroseconds` is implemented as a busy loop,
we change it to using `k_busy_wait` to improve compatibility.
Reformatting indentation for `delay` and `millis`.
Added a comment because it was difficult to understand
where the namespace ends.

Signed-off-by: TOKITA Hiroshi <[email protected]>
The PWM index range check processing was performed after the index
was referenced, so it was now performed first.

Signed-off-by: TOKITA Hiroshi <[email protected]>
@soburi soburi force-pushed the improve_interrupt branch from 3316f82 to 28b1df9 Compare August 30, 2025 03:19
@soburi soburi force-pushed the improve_interrupt branch 2 times, most recently from 03d9391 to 2beaeeb Compare August 30, 2025 05:58
Zephyr's ba48d83bec18e9f2caf61979aadf9f8537086cee
changes make it easy to configure pin numbering at compile,
so we'll change the pin numbers to be based on the GPIO pin numbers.

This is same as the traditional Arduino, using the GPIO numbers as
pin numbers. Pin names written on the board, such as D1 and D2,
are aliases for these pin numbers.

When using multiple GPIO ports, pin numbers are numbered consecutively
from the beginning. In other words, if you have two 16-port GPIOs,
17 refers to the second pin (idx=1) of the second port.

Signed-off-by: TOKITA Hiroshi <[email protected]>
@soburi soburi force-pushed the improve_interrupt branch from 2beaeeb to ffc4797 Compare August 30, 2025 13:18
soburi added 2 commits August 31, 2025 09:25
Now that GPIO can be specified generically,
we will discontinue the definition generation of LED_BUILTIN from builtin_led_gpios.
Delete this definition where automatic generation from led0 is not an issue,
and define it in variant.h in all other cases.

Signed-off-by: TOKITA Hiroshi <[email protected]>
- The structure has been revised and unnecessary fields have been removed.
- Interrupt masks are now directly modified by changing the pin_mask
  parameter in `struct gpio_callback`.
- Renamed non-Arduino-derived `setInterruptHandler` and `handleGpioCallback`
  functions to Zephyr-like names.

Signed-off-by: TOKITA Hiroshi <[email protected]>
@soburi soburi force-pushed the improve_interrupt branch from ffc4797 to 5e8e11a Compare August 31, 2025 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant