modm API documentation
|
Typedefs | |
using | modm::platform::GpioUnused = GpioStatic< detail::DataUnused > |
using | modm::platform::GpioB0 = GpioStatic< detail::DataB0 > |
using | modm::platform::GpioOutputB0 = GpioB0 |
using | modm::platform::GpioInputB0 = GpioB0 |
using | modm::platform::GpioB1 = GpioStatic< detail::DataB1 > |
using | modm::platform::GpioOutputB1 = GpioB1 |
using | modm::platform::GpioInputB1 = GpioB1 |
using | modm::platform::GpioB2 = GpioStatic< detail::DataB2 > |
using | modm::platform::GpioOutputB2 = GpioB2 |
using | modm::platform::GpioInputB2 = GpioB2 |
using | modm::platform::GpioB3 = GpioStatic< detail::DataB3 > |
using | modm::platform::GpioOutputB3 = GpioB3 |
using | modm::platform::GpioInputB3 = GpioB3 |
using | modm::platform::GpioB4 = GpioStatic< detail::DataB4 > |
using | modm::platform::GpioOutputB4 = GpioB4 |
using | modm::platform::GpioInputB4 = GpioB4 |
using | modm::platform::GpioB5 = GpioStatic< detail::DataB5 > |
using | modm::platform::GpioOutputB5 = GpioB5 |
using | modm::platform::GpioInputB5 = GpioB5 |
lbuild module: modm:platform:gpio
This module provides register access to GPIO and connect their signals to the respective peripherals in a compile-time verified way.
Each GPIO is represented as its own class with only static methods, which implement the modm::GpioIO
interface and provide additional platform-specific methods.
You can also use an unordered set of GPIOs, which is useful when configuring a large number of pins, since the register accesses will be bundled and thus less code is generated.
To write and read a set of GPIOs, you need to use an ordered implementation, which defines the pins from MSB to LSB, left-to-right. You can also check the number of ports in case your use-case requires atomic reads/writes.
For efficient access you can use a strictly-ordered implementation with a start pin and width. Note that you can reverse the data order with a negative width.
Finally, you can use an empty GPIO implementation in cases where the API requires a GPIO, but you don't need one, for example, a bit-banged SPI without MISO pin:
To make it easier to connect pins with peripherals, this module implements a compile-time map of (pin, signal, peripheral). Note that you must provide both peripherals and signals to be unambiguous.
However, it is recommended to wrap this functionality into a separate function Driver::connect<Signals...>(config)
, so that additional driver specific pin configuration can be done:
Note that you may pass a variable number of signals to this connect function, leaving out signals you don't need and adding signals that are not required.
You can also configure the external interrupts, however, you must provide the interrupt yourself.
When using multiple Pin-Change interrupts you need to first check the corresponding flag to determine which pin triggered the collective interrupt.