Skip to content

Conversation

soburi
Copy link
Member

@soburi soburi commented Aug 23, 2025

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.

@soburi soburi force-pushed the global_pin_number branch from 93e11fa to 084197c Compare August 23, 2025 11:50
@soburi soburi force-pushed the global_pin_number branch 2 times, most recently from 0747e08 to 014a6ed Compare August 23, 2025 22:46
@soburi soburi changed the title zephyrCommon: Changing pin numbering rules [DNM] zephyrCommon: Changing pin numbering rules Aug 23, 2025
@soburi soburi force-pushed the global_pin_number branch 4 times, most recently from 7ca4da5 to b009050 Compare August 30, 2025 13:18
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]>
If gpio is not initialized, the pulseIn function will terminate
without running the timer.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Added a comment because it was difficult to understand
where the namespace ends.

Signed-off-by: TOKITA Hiroshi <[email protected]>
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]>
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]>
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