modm API documentation
modm::platform::SoftwareGpioPort< Gpios > Class Template Reference

#include <modm/platform/gpio/software_port.hpp>

Inheritance diagram for modm::platform::SoftwareGpioPort< Gpios >:
modm::GpioPort modm::platform::GpioSet< Gpios... > modm::platform::PinCfgMixin< PinConfigs... >

Public Typedefs

using PortType = std::conditional_t< (width > 8), std::conditional_t< (width > 16), uint32_t, uint16_t >, uint8_t >
 
using PortType = uint16_t
 may also be uint8_t, depending on port width
 

Public Types

enum  DataOrder : bool { DataOrder::Normal = false, DataOrder::Reversed = true }
 This enum can be used to reverse the bit order of the Data. More...
 

Static Public Member Functions

static constexpr DataOrder getDataOrder ()
 
static PortType isSet ()
 
static void write (PortType data)
 
static PortType read ()
 
static constexpr DataOrder getDataOrder ()
 returns the chosen data order
 
static PortType read ()
 The read data is always right-aligned regardless of physical mapping.
 
static void setInput ()
 
static void setOutput ()
 
static void toggle ()
 Toggle the output states of all pins.
 
static void write (PortType data)
 The write data is always right-aligned regardless of physical mapping.
 
static void configure (InputType type)
 
static void disconnect ()
 
static void reset ()
 
static void set ()
 
static void set (bool status)
 
static void setAnalogInput ()
 
static void setInput ()
 
static void setInput (InputType type)
 
static void setOutput ()
 
static void setOutput (bool status)
 
static void toggle ()
 

Static Public Attributes

static constexpr auto width = sizeof...(Gpios)
 
static constexpr uint8_t number_of_ports
 
static constexpr uint8_t width
 

Protected Typedefs

using PinCfg = PinCfgMixin< PinConfigs... >
 

Static Protected Member Functions

static constexpr int8_t shift_mask_A (uint8_t pos)
 
static constexpr int8_t shift_mask_B (uint8_t pos)
 
static constexpr volatile uint32_t * getPortReg (size_t offset)
 
static consteval uint32_t invertedMask (PortName port)
 
static consteval uint32_t mask (PortName port)
 
static consteval uint32_t nonInvertedMask (PortName port)
 
static constexpr uint32_t readPortReg (size_t offset)
 
static void set (uint8_t)
 
static void set (uint8_t, uint8_t)
 
static constexpr void setPortReg (size_t offset)
 

Static Protected Attributes

static constexpr int8_t shift_masks_A []
 
static constexpr int8_t shift_masks_B []
 

Detailed Description

template<class... Gpios>
class modm::platform::SoftwareGpioPort< Gpios >

Create an up to 32-bit port from arbitrary pins.

This class optimizes the data type for the read() and write() methods. Supplying up to 8 Gpios will use uint8_t, up to 16 Gpios uint16_t and up to 32 Gpios uint32_t.

Note
Since the bit order is explicitly given by the order of template arguments, this class only supports DataOrder::Normal. If you need reverse bit order, reverse the order of Gpios!
Template Parameters
GpiosUp to 32 GpioIO classes, ordered MSB to LSB
Author
Christopher Durand
Niklas Hauser

Member Enumeration Documentation

enum modm::GpioPort::DataOrder : bool
inheritedstrong

This enum can be used to reverse the bit order of the Data.

Enum ValuesDocumentation
Normal 

bit order of data is the same as bit order of port

Reversed 

bit order of data is the reverse bit order of port

Member Data Documentation

constexpr uint8_t modm::GpioPort::number_of_ports
inheritedstaticconstexpr

This holds the number of unique platform ports that this implementation accesses. It's always at least 1.

template<class... Gpios>
constexpr int8_t modm::platform::SoftwareGpioPort< Gpios >::shift_masks_A[]
staticprotectedconstexpr
Initial value:
{
int8_t(Gpios::port == PortName::A ? Gpios::pin : -1)...
}
template<class... Gpios>
constexpr int8_t modm::platform::SoftwareGpioPort< Gpios >::shift_masks_B[]
staticprotectedconstexpr
Initial value:
{
int8_t(Gpios::port == PortName::B ? Gpios::pin : -1)...
}
constexpr uint8_t modm::GpioPort::width
inheritedstaticconstexpr

This holds the width of the port as number of bits and can be used in drivers to assert the correct requirements


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