Skip to content
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

boards,sys/arduino: major clean up #19759

Merged
merged 2 commits into from
Jun 26, 2023
Merged

Conversation

maribu
Copy link
Member

@maribu maribu commented Jun 23, 2023

Contribution description

  • Rename all arduino_pinmap.h to arduino_iomap.h
    • An empty arduino_pinmap.h that just includes arduino_iomap.h is provided for backward compatibility
    • Move all info from arduino_board.h into the new file as trivial macros, so that they can also be used outside of sketches
    • The new name reflects the fact not just pin mappings, but also other I/O features such as PWMs are mapped
  • Drop all arduino_board.h
    • arduino_board.h and arduino_iomap.h now provide the exact same information, just in a different format
    • a generic arduino_board.h is provided instead that just uses the info in arduinio_iomap.h and provides them in the format the code in sys/arduino expects it
  • Add fine grained features to indicate for mappings
    • availability of mappings for analog pins, DAC pins, PWM pins, UART devices, SPI/I2C buses to the corresponding RIOT identification can now be expressed:
      • arduino_pins: ARDUINO_PIN_0 etc. are available
      • arduino_analog: ARDUINO_A0 etc. are available
      • arduino_pwm: ARDUINO_PIN_13_PWM_DEV etc. are available
      • arduino_dac: ARDUINO_DAC0 etc. are available
      • arduino_uart: ARDUINO_UART_D0D1 or similar are available
      • arduino_spi: ARDUINO_SPI_ISP or similar are available
      • arduino_i2c: ARDUINO_I2C_UNO or similar are available
    • mechanical/electrical compatibility with specific form factors can now be expressed as features:
      • aruino_shield_nano: Arduino NANO compatible headers
      • aruino_shield_uno: Arduino UNO compatible headers
      • aruino_shield_mega: Arduino MEGA compatible headers
      • aruino_shield_isp: ISP header is available

This provides the groundwork to implement shield support as modules that can rely on the I/O mappings, rather than having to provide a configuration per board.

Testing procedure

CI + lots of code review ...

In the long term the peripheral self testing shield will allow automatic testing for some of the I/O mappings for Arduino UNO compatible boards. But this PR would be required first for any soft of meaningful shield support in RIOT first.

Issues/PRs references

None

@maribu maribu added State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 23, 2023
@github-actions github-actions bot added Area: doc Area: Documentation Area: drivers Area: Device drivers Area: arduino API Area: Arduino wrapper API Area: boards Area: Board ports Area: sys Area: System labels Jun 23, 2023
@riot-ci
Copy link

riot-ci commented Jun 23, 2023

Murdock results

✔️ PASSED

efb3a32 dist/tools/doccheck: update exclude patterns

Success Failures Total Runtime
6930 0 6930 11m:00s

Artifacts

@maribu maribu force-pushed the arduino-features branch from c9627a1 to 395d8eb Compare June 24, 2023 20:33
@github-actions github-actions bot added Area: tests Area: tests and testing framework Area: Kconfig Area: Kconfig integration labels Jun 24, 2023
@maribu maribu force-pushed the arduino-features branch 2 times, most recently from b783a36 to 63d4fd7 Compare June 24, 2023 21:52
@maribu maribu added CI: full build disable CI build filter CI: low priority If set, builds of this PR will be queued behind others CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet labels Jun 24, 2023
@maribu maribu removed CI: full build disable CI build filter CI: low priority If set, builds of this PR will be queued behind others labels Jun 25, 2023
@maribu maribu force-pushed the arduino-features branch from 63d4fd7 to 7bdc012 Compare June 25, 2023 19:20
@github-actions github-actions bot added the Area: tools Area: Supplementary tools label Jun 26, 2023
@maribu maribu force-pushed the arduino-features branch 3 times, most recently from c906367 to e89e40a Compare June 26, 2023 08:53
@maribu
Copy link
Member Author

maribu commented Jun 26, 2023

@kfessel I split the arduino_board.h as you suggested out-of-band

maribu added 2 commits June 26, 2023 17:24
- Rename all `arduino_pinmap.h` to `arduino_iomap.h`
    - An empty `arduino_pinmap.h` that just includes `arduino_iomap.h`
      is provided for backward compatibility
    - Move all info from `arduino_board.h` into the new file as trivial
      macros, so that they can also be used outside of sketches
    - The new name reflects the fact not just pin mappings, but also
      other I/O features such as PWMs are mapped
- Drop all `arduino_board.h`
    - `arduino_board.h` and `arduino_iomap.h` now provide the exact
      same information, just in a different format
    - a generic `arduino_board.h` is provided instead that just
      uses the info in `arduinio_iomap.h` and provides them in the
      format the code in `sys/arduino` expects it
- Add fine grained features to indicate for mappings
    - availability of mappings for analog pins, DAC pins, PWM pins,
      UART devices, SPI/I2C buses to the corresponding RIOT
      identification can now be expressed:
        - `arduino_pins`: `ARDUINO_PIN_0` etc. are available
        - `arduino_analog`: `ARDUINO_A0` etc. are available
        - `arduino_pwm`: `ARDUINO_PIN_13_PWM_DEV` etc. are available
        - `arduino_dac`: `ARDUINO_DAC0` etc. are available
        - `arduino_uart`: `ARDUINO_UART_D0D1` or similar are available
        - `arduino_spi`: `ARDUINO_SPI_ISP` or similar are available
        - `arduino_i2c`: `ARDUINO_I2C_UNO` or similar are available
    - mechanical/electrical compatibility with specific form factors
      can now be expressed as features:
        - `aruino_shield_nano`: Arduino NANO compatible headers
        - `aruino_shield_uno`: Arduino UNO compatible headers
        - `aruino_shield_mega`: Arduino MEGA compatible headers
        - `aruino_shield_isp`: ISP header is available

This provides the groundwork to implement shield support as modules
that can rely on the I/O mappings, rather than having to provide a
configuration per board.
@maribu maribu force-pushed the arduino-features branch from 3a0b49e to efb3a32 Compare June 26, 2023 15:24
Copy link
Contributor

@kfessel kfessel left a comment

Choose a reason for hiding this comment

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

good cleanup PR:

  • improves organisation
  • readability
  • completeness
    maribu ran some tests, i trust his testing (no one will have all boards)
    ->

@maribu
Copy link
Member Author

maribu commented Jun 26, 2023

bors merge

bors bot added a commit that referenced this pull request Jun 26, 2023
19759: boards,sys/arduino: major clean up r=maribu a=maribu

### Contribution description

- Rename all `arduino_pinmap.h` to `arduino_iomap.h`
    - An empty `arduino_pinmap.h` that just includes `arduino_iomap.h` is provided for backward compatibility
    - Move all info from `arduino_board.h` into the new file as trivial macros, so that they can also be used outside of sketches
    - The new name reflects the fact not just pin mappings, but also other I/O features such as PWMs are mapped
- Drop all `arduino_board.h`
    - `arduino_board.h` and `arduino_iomap.h` now provide the exact same information, just in a different format
    - a generic `arduino_board.h` is provided instead that just uses the info in `arduinio_iomap.h` and provides them in the format the code in `sys/arduino` expects it
- Add fine grained features to indicate for mappings
    - availability of mappings for analog pins, DAC pins, PWM pins, UART devices, SPI/I2C buses to the corresponding RIOT identification can now be expressed:
        - `arduino_pins`: `ARDUINO_PIN_0` etc. are available
        - `arduino_analog`: `ARDUINO_A0` etc. are available
        - `arduino_pwm`: `ARDUINO_PIN_13_PWM_DEV` etc. are available
        - `arduino_dac`: `ARDUINO_DAC0` etc. are available
        - `arduino_uart`: `ARDUINO_UART_D0D1` or similar are available
        - `arduino_spi`: `ARDUINO_SPI_ISP` or similar are available
        - `arduino_i2c`: `ARDUINO_I2C_UNO` or similar are available
    - mechanical/electrical compatibility with specific form factors can now be expressed as features:
        - `aruino_shield_nano`: Arduino NANO compatible headers
        - `aruino_shield_uno`: Arduino UNO compatible headers
        - `aruino_shield_mega`: Arduino MEGA compatible headers
        - `aruino_shield_isp`: ISP header is available

This provides the groundwork to implement shield support as modules that can rely on the I/O mappings, rather than having to provide a configuration per board.


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
@bors
Copy link
Contributor

bors bot commented Jun 26, 2023

Build failed:

@maribu
Copy link
Member Author

maribu commented Jun 26, 2023

Haven't seen that glitch in a while. I cannot say I missed it...

bors retry

@maribu
Copy link
Member Author

maribu commented Jun 26, 2023

bors retry

@bors
Copy link
Contributor

bors bot commented Jun 26, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit b209fdd into RIOT-OS:master Jun 26, 2023
@maribu maribu deleted the arduino-features branch June 27, 2023 05:20
@maribu
Copy link
Member Author

maribu commented Jun 27, 2023

🎉 thx!

bors bot added a commit that referenced this pull request Jul 20, 2023
19839: pkg/arduino_adafruit_sensor: fix dependencies r=maribu a=maribu

### Contribution description

This fixes the dependencies of the `arduino_adafruit_sensor` package, which previously relied on the `arduino` feature. This feature no longer exists, as it was split into more fine granular features. However, the module should never have used that feature directly in the first place, but rather just use the arduino module. This in turn depends on the correct features.

### Testing procedure

`tests/arduino_adafruit_sensor` should again be supported by boards that have the features required by the `arduino` module.

### Issues/PRs references

Fallout of #19759

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
bors bot added a commit that referenced this pull request Jul 20, 2023
19840: pkg/arduino_adafruit_sensor: fix dependencies [backport 2023.07] r=benpicco a=maribu

# Backport of #19839

### Contribution description

This fixes the dependencies of the `arduino_adafruit_sensor` package, which previously relied on the `arduino` feature. This feature no longer exists, as it was split into more fine granular features. However, the module should never have used that feature directly in the first place, but rather just use the arduino module. This in turn depends on the correct features.

### Testing procedure

`tests/arduino_adafruit_sensor` should again be supported by boards that have the features required by the `arduino` module.

### Issues/PRs references

Fallout of #19759

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
@benpicco benpicco added this to the Release 2023.07 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: arduino API Area: Arduino wrapper API Area: boards Area: Board ports Area: doc Area: Documentation Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration Area: sys Area: System Area: tests Area: tests and testing framework Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants