modm API documentation
modm::GpioExpanderPin< GpioExpander, expander, pin > Class Template Reference

#include <modm/architecture/interface/gpio_expander.hpp>

Inheritance diagram for modm::GpioExpanderPin< GpioExpander, expander, pin >:
modm::GpioIO modm::GpioOutput modm::GpioInput modm::Gpio modm::Gpio

Public Types

enum  Direction { In = 0, Out = 1, InOut = 2, Special = 3 }
 Declares the direction of a GPIO.
 
enum  Direction { In = 0, Out = 1, InOut = 2, Special = 3 }
 Declares the direction of a GPIO.
 

Static Public Member Functions

static void setOutput ()
 
static void setOutput (bool value)
 
static void set ()
 
static void set (bool value)
 
static void reset ()
 
static void toggle ()
 
static bool isSet ()
 
static void setInput ()
 
static bool read ()
 
static Direction getDirection ()
 
static bool isSet ()
 
static void reset ()
 set output to low level
 
static void set ()
 set output to high level
 
static void set (bool value)
 set output to high or low level
 
static void setOutput ()
 configure pin as output
 
static void setOutput (bool value)
 configure pin as output and set high or low
 
static void toggle ()
 toggle output level
 

Static Public Attributes

static constexpr Direction direction = Direction::InOut
 
static constexpr GpioExpanderioExpander = expander
 
static constexpr bool High = true
 
static constexpr bool High = true
 
static constexpr bool Low = false
 
static constexpr bool Low = false
 
static constexpr Direction direction = Direction::Out
 Declares the Pin direction.
 

Detailed Description

template<typename GpioExpander, GpioExpander & expander, typename GpioExpander::Pin pin>
class modm::GpioExpanderPin< GpioExpander, expander, pin >

Create an modm::GpioIO compatible interface from any IO-expander conforming to the modm::GpioExpander interface.

This allows the transparent usage of IO Expander pins in classes that require Gpios as template arguments.

Note
For every pin access a blocking bus transfer is performed, therefore do not expect these gpios to be fast!

Usage:

However, instead of using this class like that, prefer using the alias-template types provided by the IO-expander of your choice for better readability:

typedef modm::Pca8574<MyI2cMaster> Expander;
Expander expander;
// use predefined pin types of the local IO-expander
typedef Expander::P0< expander > Rs;
typedef Expander::P1< expander > Rw;
typedef Expander::P2< expander > E;
typedef Expander::P3< expander > Backlight;
Backlight::set();
Warning
Access to the IO-expander is blocking and can silently fail! If this is undesirable for you application, you need to write your own wrapper!
Precondition
The IO-expander needs to be initialized externally, if required.
See also
modm::GpioExpander
modm::GpioIO
Template Parameters
GpioExpanderType of class conforming to the modm::GpioExpander interface
expanderinstance of the expander
pinpin identifier of desired expander pin
Author
Sascha Schade
Niklas Hauser

Member Function Documentation

static bool modm::GpioOutput::isSet ( )
inheritedstatic

Returns the set logical output state of the pin. This may be different from the physical state!

Member Data Documentation

constexpr bool modm::Gpio::Low = false
inheritedstaticconstexpr

These constants refer to the logical state of the GPIO. The physical state is determined by the configuration and external connection.

constexpr bool modm::Gpio::Low = false
inheritedstaticconstexpr

These constants refer to the logical state of the GPIO. The physical state is determined by the configuration and external connection.


The documentation for this class was generated from the following file: