Skip to content

K64F: Fix pin names and migrate to Arduino Uno form factor #14837

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 2 commits into from
Jun 30, 2021

Conversation

LDong-Arm
Copy link
Contributor

@LDong-Arm LDong-Arm commented Jun 28, 2021

Summary of changes

Fix pin names of K64F with the following from the latest guidelines:

  • LEDs and buttons are defined as macros, digital and analog pins as enums.
  • No duplicated pin names with the same value.
  • The Arduino form factor is deprecated in favour of Arduino Uno.

Note: The pins SPI_xxx are for SD card only, but the names are kept for backward compatibility (i.e. no breaking change until the next Mbed OS major version). The general purpose Arduino Uno SPI pins (ARDUINO_UNO_SPI_xxx) are different and also available.

Impact of changes

Migration actions required

This change is non-breaking because PinNameAliases.h maps generic pin names (e.g. A0) <--> Arduino Uno pin names (e.g. ARDUINO_UNO_A0) unless otherwise defined. Nonetheless, projects can take advantage of Arduino Uno pin names when available.

Documentation

None.


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[x] Tests / results supplied as part of this PR
  • pinvalidate.py tests and Greentea tests (*-pin_names*-) pass.
  • SD card tests (*-COMPONENT_SD-*) pass with an SD card inserted, to validate SD card SPI pin maps.
  • BlueNRG-MS, which uses Arduino Uno pins by default, now compiles for K64F (e.g. with mbed-os-example-ble, previously failed to compile).

Reviewers

@ARMmbed/mbed-os-hal @ARMmbed/mbed-os-core @ARMmbed/team-nxp


In the Standard Pin Names porting guide, pinvalidate.py is run
without prefixing the "python" command. But to make it possible,
a shebang needs to exist.
Fix pin names of K64F with the following from the latest guidelines:
* LEDs and buttons are defined as macros, digital and analog pins as
enums.
* No duplicated pin names with the same value.
* The Arduino form factor is deprecated in favour of Arduino Uno.

Note: The pins `SPI_xxx` are for SD card only, but the names are kept
for backward compatibility (i.e. no breaking change until the next
Mbed OS major version). The general purpose Arduino Uno SPI pins
(`ARDUINO_UNO_SPI_xxx`) are different and also available.
@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Jun 28, 2021
@ciarmcom ciarmcom requested a review from a team June 28, 2021 17:30
@ciarmcom
Copy link
Member

@LDong-Arm, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

// (ARDUINO_UNO_SPI_xxx) for general purpose uses.
// By default, Mbed OS maps those alias to Arduino Uno pins, but
// for backward compatibility we map them to the SD card SPI.
#define SPI_MOSI PTE3
Copy link
Contributor

Choose a reason for hiding this comment

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

This is also part of the migration, couldn't it stay in PinName enum and just add a comment or?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The SPI pins need to be #defined:

// Legacy SPI aliases
#ifndef SPI_CS
#define SPI_CS ARDUINO_UNO_SPI_CS
#endif

If they were enums, the macro checks would not work.

@LDong-Arm LDong-Arm requested a review from a team June 29, 2021 08:50
@mergify mergify bot added needs: CI and removed needs: review labels Jun 29, 2021
@mbed-ci
Copy link

mbed-ci commented Jun 29, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@Patater Patater merged commit 043d173 into ARMmbed:master Jun 30, 2021
@mergify mergify bot removed the ready for merge label Jun 30, 2021
@mbedmain mbedmain added release-version: 6.13.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants