mbed-ce / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
79 stars 15 forks source link

LPC1768: Support static pinmaps #276

Closed multiplemonomials closed 4 months ago

multiplemonomials commented 5 months ago

Summary of changes

This PR updates LPC1768 to support static pinmaps. This means that pins can be mapped at compile time instead of at runtime, like:

    constexpr auto spiPinmap = get_spi_pinmap(PIN_SPI_MOSI, PIN_SPI_MISO, PIN_SPI_SCLK);
    spi = new SPI(spiPinmap);

To be honest, a lot of the reason I made this PR is I wanted to learn about the static pinmap system, since I had not used it before. And I figured, may as well do something useful while I'm learning it! Plus, this way LPC1768 users can save some ROM space and execution time by taking advantage of the static pinmap support.

Impact of changes

Migration actions required

Documentation


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)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[X] Tests / results supplied as part of this PR

I ran the CI shield ADC, I2C, PWM, and SPI tests. The first three all passed, and the SPI test has no new failures at least.


Reviewers