Skip to content

Create common digital pin definition #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2022

Conversation

soburi
Copy link
Member

@soburi soburi commented Sep 19, 2022

The digitalPins enumeration, arduino_pins array,
and contents of these are determined by d[N]_gpios declaration in dts.

Interlock the declaration with the dts definition.

@soburi soburi changed the title variants: Define common digital pin definition Create common digital pin definition Sep 20, 2022
@DhruvaG2000 DhruvaG2000 requested a review from szczys September 22, 2022 15:19
@DhruvaG2000
Copy link
Collaborator

DhruvaG2000 commented Sep 22, 2022

Thank you for your contribution!
Please rebase your branch on latest main and resolve conflicts

@soburi soburi force-pushed the common_pin_definition branch from 33d603b to dec3783 Compare September 24, 2022 00:59
@soburi
Copy link
Member Author

soburi commented Sep 24, 2022

Hi, @DhruvaG2000

Thank you for your contribution! Please rebase your branch on latest main and resolve conflicts

Rebase done.

Copy link
Collaborator

@DhruvaG2000 DhruvaG2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on arduino nano 33 ble sense, and arduino mkr zero and blink LEDs work okay.
Thanks @soburi this looks much more elegant! Thanks to macro magic I guess ;)

This PR is ready to merge pending a few formatting issues:

ERROR: space prohibited before that close parenthesis ')'
#498: FILE: variants/variants.h:22:

and many more that appear upon running checkpatch.pl patches/0001-variants-Define-common-digital-pin-definition.patch

@soburi soburi force-pushed the common_pin_definition branch from dec3783 to bf0a214 Compare September 24, 2022 05:31
@soburi
Copy link
Member Author

soburi commented Sep 24, 2022

Tested on arduino nano 33 ble sense, and arduino mkr zero and blink LEDs work okay. Thanks @soburi this looks much more elegant! Thanks to macro magic I guess ;)

This PR is ready to merge pending a few formatting issues:

ERROR: space prohibited before that close parenthesis ')'
#498: FILE: variants/variants.h:22:

and many more that appear upon running checkpatch.pl patches/0001-variants-Define-common-digital-pin-definition.patch

Update done. I'll also update other PRs. I forgot to run checkpatch. Thank you.

@soburi
Copy link
Member Author

soburi commented Sep 24, 2022

Tested on arduino nano 33 ble sense, and arduino mkr zero and blink LEDs work okay.
Thanks @soburi this looks much more elegant! Thanks to macro magic I guess ;)

I think typically configuration must be able to handle without an additional header, only an overlay file.
In other words, We should create a header file only case if it can't derive from devicetree information.

(It is painful for us to manage many files and various rules.
We should make effort to only need to write an overlay file basically.)

@soburi soburi requested review from DhruvaG2000 and removed request for szczys September 24, 2022 06:45
@soburi soburi force-pushed the common_pin_definition branch from bf0a214 to 076445b Compare September 24, 2022 21:55
@DhruvaG2000
Copy link
Collaborator

DhruvaG2000 commented Sep 25, 2022

@soburi now that your arduino nano 33 iot fix is merged, there seem to be minor conflicts in this PR, kindly resolve them.

The digitalPins enumeration, arduino_pins array,
and contents of these are determined by d[N]_gpios declaration in dts.

Interlock the declaration with the dts definition.

- Automatically calculate digitalPin enumeration and arduino_pins array
  from devicetree configuration.
- LED digital pin definition read from 'leds' node in devicetree.
  Append it to enumeration and pins array.
- static struct gpio_dt_spec d0, d1, ... declaration seem bit redundant.
  Declare as array of gpio_dt_spec.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
@soburi soburi force-pushed the common_pin_definition branch from 076445b to 7aa7d7e Compare September 25, 2022 05:34
Copy link
Collaborator

@DhruvaG2000 DhruvaG2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built and tested locally, also tried blinky samples on nano 33 ble sense and mkrzero. Seem to work.
Thanks alot for your contributions @soburi !

@DhruvaG2000 DhruvaG2000 merged commit 1107a7c into zephyrproject-rtos:main Sep 25, 2022
@soburi soburi deleted the common_pin_definition branch September 25, 2022 16:10
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.

2 participants