|
DUDS
|
Distributed Update of Data from Something
|
Defines the capabilites of a digital general purpose I/O pin. More...
#include <DigitalPinCap.hpp>
Public Types | |
| typedef duds::general::BitFlags< struct DigitalPinFlags, std::uint16_t > | Flags |
| A container of flags that control the operation of a digital pin. More... | |
Public Member Functions | |
| DigitalPinCap ()=default | |
| Construct uninitialized. More... | |
| constexpr | DigitalPinCap (const Flags cap, std::uint16_t cur=0) |
| Construct fully initiallized. More... | |
| constexpr bool | canOutput () const |
| Returns true if the port is capable of output. More... | |
| DigitalPinRejectedConfiguration::Reason | compatible (const DigitalPinConfig &cfg) const |
| Returns a set of flags that indicate certain incompatible conditions in the given pin configuration irrespective of any other pin. More... | |
| constexpr bool | exists () const |
| Returns true if the pin exists and is usable by this process. More... | |
| DigitalPinConfig::Flags | firstOutputDriveConfigFlags () const |
| Returns the output configuration flags that corresponds to the result of firstOutputDriveFlag(). More... | |
| Flags | firstOutputDriveFlag () const |
| Checks the flags in OutputDriveMask, starting with OutputPushPull, and returns the first match found in capabilities. More... | |
Public Attributes | |
| Flags | capabilities |
| The capabilities of a digital pin. More... | |
| std::uint16_t | maxOutputCurrent |
| The maximum output current in milliamps (?) the pin can manage, or zero if unspecified or not applicable. More... | |
Static Public Attributes | |
| static constexpr Flags | ControllablePulldown = Flags::Bit(6) |
| The use of the pin's pull-down resistor can be controlled by software. More... | |
| static constexpr Flags | ControllablePullup = Flags::Bit(8) |
| The use of the pin's pull-up resistor can be controlled by software. More... | |
| static constexpr Flags | EventEdgeChange = Flags::Bit(11) |
| The pin supports setting an event flag on an edge change. More... | |
| static constexpr Flags | EventEdgeFalling = Flags::Bit(9) |
| The pin supports setting an event flag on the falling edge. More... | |
| static constexpr Flags | EventEdgeRising = Flags::Bit(10) |
| The pin supports setting an event flag on the rising edge. More... | |
| static constexpr Flags | EventLevelHigh = Flags::Bit(13) |
| The pin supports setting an event flag on a high level. More... | |
| static constexpr Flags | EventLevelLow = Flags::Bit(12) |
| The pin supports setting an event flag on a low level. More... | |
| static constexpr Flags | HasPulldown = Flags::Bit(5) |
| The pin has a pull-down resistor. More... | |
| static constexpr Flags | HasPullup = Flags::Bit(7) |
| The pin has a pull-up resistor. More... | |
| static constexpr Flags | Input = Flags::Bit(0) |
| Input operation is supported. More... | |
| static constexpr Flags | InterruptOnEvent = Flags::Bit(14) |
| The pin supports triggering an interrupt when an event occurs. More... | |
| static constexpr Flags | OutputDriveHigh = Flags::Bit(3) |
| The output is or can be an open emitter type. More... | |
| static constexpr Flags | OutputDriveLow = Flags::Bit(2) |
| The output is or can be an open collector or open drain type. More... | |
| static constexpr Flags | OutputDriveMask |
| A mask of all output flags that involve driving the line. More... | |
| static constexpr Flags | OutputHighImpedance = Flags::Bit(4) |
| The pin supports a high impedance state without input. More... | |
| static constexpr Flags | OutputPushPull = Flags::Bit(1) |
| The output can drive the line either low or high. More... | |
Defines the capabilites of a digital general purpose I/O pin.
The reported capabilities do not consider emulating any behaviors because emulation can lead to bad behavior under certain conditions. For instance, configuring a pin as an input to get open collector or high impedance behavior allows the possibility that the input will change its state rapidly wich can cause the input buffer to draw enough current to damage itself. This may not be a problem depending upon the circuit. The application software must have correct information about the capabilities so that if it is a problem it can report an error.
DigitalPort implementations may emulate behaviors not directly supported by the hardware.
Definition at line 31 of file DigitalPinCap.hpp.
| typedef duds::general::BitFlags<struct DigitalPinFlags, std::uint16_t> duds::hardware::interface::DigitalPinCap::Flags |
A container of flags that control the operation of a digital pin.
The flags are intended to cover a wide range of hardware, so not all options may be available on specific hardware.
Definition at line 38 of file DigitalPinCap.hpp.
|
default |
Construct uninitialized.
|
inline |
Construct fully initiallized.
| cap | The capability flags. |
| cur | The maximum output current. |
Definition at line 141 of file DigitalPinCap.hpp.
|
inline |
Returns true if the port is capable of output.
This does not imply a specific high impedence state.
Definition at line 161 of file DigitalPinCap.hpp.
Referenced by duds::hardware::interface::DigitalPinAccess::canBeOutput().
| DigitalPinRejectedConfiguration::Reason duds::hardware::interface::DigitalPinCap::compatible | ( | const DigitalPinConfig & | cfg | ) | const |
Returns a set of flags that indicate certain incompatible conditions in the given pin configuration irrespective of any other pin.
The only condition currently checked is whether or not the configuration is supported by the hardware.
| cfg | The configuration to check. |
| DigitalPinConfigurationError | The configuration disagrees with itself from either having mutually exclusive flags set, or a minimum greater than a maximum. This is a programming mistake that has nothing to do with the pin capabilities. |
Definition at line 56 of file DigitalPinCap.cpp.
Referenced by canOutput(), duds::hardware::interface::DigitalPinConfig::compatible(), and duds::hardware::interface::DigitalPortDependentPins::proposeConfigImpl().
|
inline |
Returns true if the pin exists and is usable by this process.
If false, the pin may or may not actually exist, but the difference will be immaterial to this process. The result does not mean that the pin is not currently in use.
Definition at line 151 of file DigitalPinCap.hpp.
Referenced by duds::hardware::interface::DigitalPort::PinEntry::operator bool().
| DigitalPinConfig::Flags duds::hardware::interface::DigitalPinCap::firstOutputDriveConfigFlags | ( | ) | const |
Returns the output configuration flags that corresponds to the result of firstOutputDriveFlag().
If no driving output is available, the result is DigitalPinConfig::OutputNoChange. Otherwise, the flag DigitalPinConfig::DirOutput is included along with the flags to specify driving low and/or high.
Definition at line 44 of file DigitalPinCap.cpp.
Referenced by canOutput().
| DigitalPinCap::Flags duds::hardware::interface::DigitalPinCap::firstOutputDriveFlag | ( | ) | const |
Checks the flags in OutputDriveMask, starting with OutputPushPull, and returns the first match found in capabilities.
If no match is found, returns Flags::Zero().
Definition at line 31 of file DigitalPinCap.cpp.
Referenced by canOutput().
| Flags duds::hardware::interface::DigitalPinCap::capabilities |
The capabilities of a digital pin.
Definition at line 126 of file DigitalPinCap.hpp.
Referenced by compatible(), firstOutputDriveConfigFlags(), firstOutputDriveFlag(), duds::hardware::interface::linux::SysFsPort::FsPin::open(), duds::hardware::interface::operator!=(), duds::hardware::interface::operator&(), duds::hardware::interface::operator<<(), duds::hardware::interface::operator==(), duds::hardware::interface::operator^(), duds::hardware::interface::operator|(), duds::hardware::interface::ChipBinarySelectManager::setSelectPin(), and duds::hardware::interface::ChipPinSelectManager::setSelectPin().
|
static |
The use of the pin's pull-down resistor can be controlled by software.
Definition at line 80 of file DigitalPinCap.hpp.
|
static |
The use of the pin's pull-up resistor can be controlled by software.
Definition at line 89 of file DigitalPinCap.hpp.
|
static |
The pin supports setting an event flag on an edge change.
Definition at line 101 of file DigitalPinCap.hpp.
|
static |
The pin supports setting an event flag on the falling edge.
Definition at line 93 of file DigitalPinCap.hpp.
|
static |
The pin supports setting an event flag on the rising edge.
Definition at line 97 of file DigitalPinCap.hpp.
|
static |
The pin supports setting an event flag on a high level.
Definition at line 109 of file DigitalPinCap.hpp.
|
static |
The pin supports setting an event flag on a low level.
Definition at line 105 of file DigitalPinCap.hpp.
|
static |
The pin has a pull-down resistor.
Definition at line 75 of file DigitalPinCap.hpp.
|
static |
The pin has a pull-up resistor.
Definition at line 84 of file DigitalPinCap.hpp.
|
static |
Input operation is supported.
Definition at line 42 of file DigitalPinCap.hpp.
Referenced by duds::hardware::interface::DigitalPin::canBeInput(), duds::hardware::interface::DigitalPinAccess::canBeInput(), duds::hardware::interface::DigitalPinSet::canBeInput(), duds::hardware::interface::DigitalPinSetAccess::canBeInput(), compatible(), duds::hardware::interface::test::VirtualPort::initPin(), duds::hardware::interface::linux::GpioDevPort::initPin(), and duds::hardware::interface::linux::SysFsPort::FsPin::open().
|
static |
The pin supports triggering an interrupt when an event occurs.
If set, at least one of the event flags must also be set:
Definition at line 122 of file DigitalPinCap.hpp.
| std::uint16_t duds::hardware::interface::DigitalPinCap::maxOutputCurrent |
The maximum output current in milliamps (?) the pin can manage, or zero if unspecified or not applicable.
Definition at line 131 of file DigitalPinCap.hpp.
Referenced by compatible(), and duds::hardware::interface::operator<<().
|
static |
The output is or can be an open emitter type.
This type drives the line high, but not low.
Definition at line 62 of file DigitalPinCap.hpp.
Referenced by duds::hardware::interface::DigitalPin::canBeOutput(), duds::hardware::interface::DigitalPinSetAccess::canBeOutput(), compatible(), and firstOutputDriveConfigFlags().
|
static |
The output is or can be an open collector or open drain type.
This type drives the line low, but not high.
Definition at line 57 of file DigitalPinCap.hpp.
Referenced by duds::hardware::interface::DigitalPin::canBeOutput(), duds::hardware::interface::DigitalPinSetAccess::canBeOutput(), compatible(), firstOutputDriveConfigFlags(), and duds::hardware::interface::ChipBinarySelectManager::setSelectPin().
|
static |
A mask of all output flags that involve driving the line.
Definition at line 66 of file DigitalPinCap.hpp.
Referenced by duds::hardware::interface::DigitalPinSet::canBeOutput().
|
static |
The pin supports a high impedance state without input.
Definition at line 71 of file DigitalPinCap.hpp.
Referenced by duds::hardware::interface::DigitalPin::canFloat(), duds::hardware::interface::DigitalPinAccess::canFloat(), duds::hardware::interface::DigitalPinSet::canFloat(), duds::hardware::interface::DigitalPinSetAccess::canFloat(), and firstOutputDriveFlag().
|
static |
The output can drive the line either low or high.
This is distinct from the combination of the OutputDriveLow and OutputDriveHigh flags since many outputs are a push-pull type and not an open collector, drain, or emitter.
Definition at line 49 of file DigitalPinCap.hpp.
Referenced by duds::hardware::interface::DigitalPin::canBeOutput(), duds::hardware::interface::DigitalPinSetAccess::canBeOutput(), compatible(), firstOutputDriveConfigFlags(), firstOutputDriveFlag(), duds::hardware::interface::test::VirtualPort::initPin(), duds::hardware::interface::linux::GpioDevPort::initPin(), duds::hardware::interface::linux::SysFsPort::FsPin::open(), and duds::hardware::interface::ChipBinarySelectManager::setSelectPin().