Skip to content

These module docs are in beta and may be incomplete.

modm:architecture:gpio: GPIO Interface

These classes are used to create architecture independent definitions for hardware pins which then can be used as template parameters for miscellaneous device drivers.

Example of a platform-independent blinking light:

#include <modm/platform/platform.hpp>

using Led = GpioOutputB0;

int main()
{
    Led::setOutput();
    Led::set();

    while (1)
    {
        Led::toggle();
        modm::delayMilliseconds(500);
    }
}

You can use the common definitions to express your intention for setting a pin.

Led::set(modm::Gpio::High); // Turns Led on
Led::set(modm::Gpio::Low); // Turns Led off

Initialize your GPIOs

Call Gpio::setInput() or Gpio::setOutput() before the first use, otherwise the GPIO state may be undefined!

Content

// Class
class modm::GpioExpander;
class modm::GpioExpanderPin< typename GpioExpander, GpioExpander & expander, typename GpioExpander::Pin pin >;
class modm::GpioExpanderPort< typename GpioExpander, GpioExpander & expander, typename GpioExpander::Pin StartPin, uint8_t Width, GpioPort::DataOrder DataOrder=GpioPort::DataOrder::Normal >;
class modm::GpioIO;
class modm::GpioInput;
class modm::GpioOutput;
class modm::GpioPort;

// Struct
struct modm::Gpio;

Dependencies

modm:architecture:gpio modm_architecture_gpio modm: architecture: gpio modm_architecture modm: architecture modm_architecture_gpio->modm_architecture modm_architecture_gpio_expander modm: architecture: gpio.expander modm_architecture_gpio_expander->modm_architecture_gpio modm_architecture_i2c modm: architecture: i2c modm_architecture_i2c->modm_architecture_gpio modm_driver_ad7280a modm: driver: ad7280a modm_driver_ad7280a->modm_architecture_gpio modm_driver_ad7928 modm: driver: ad7928 modm_driver_ad7928->modm_architecture_gpio modm_driver_ds1302 modm: driver: ds1302 modm_driver_ds1302->modm_architecture_gpio modm_driver_ft245 modm: driver: ft245 modm_driver_ft245->modm_architecture_gpio modm_driver_hd44780 modm: driver: hd44780 modm_driver_hd44780->modm_architecture_gpio modm_driver_ltc2984 modm: driver: ltc2984 modm_driver_ltc2984->modm_architecture_gpio modm_driver_max6966 modm: driver: max6966 modm_driver_max6966->modm_architecture_gpio modm_driver_memory_bus modm: driver: memory_bus modm_driver_memory_bus->modm_architecture_gpio modm_platform_gpio modm: platform: gpio modm_platform_gpio->modm_architecture_gpio modm_platform_gpio_common modm: platform: gpio.common modm_platform_gpio_common->modm_architecture_gpio modm_platform_i2c_bitbang modm: platform: i2c.bitbang modm_platform_i2c_bitbang->modm_architecture_gpio