|
DUDS
|
Distributed Update of Data from Something
|
Provides access to a single pin on a DigitalPort. More...
#include <DigitalPinAccess.hpp>
Public Member Functions | |
| DigitalPinAccess () | |
| Constructs an access object with nothing to access. More... | |
| ~DigitalPinAccess () | |
| Relinquish access on destruction. More... | |
| bool | canBeInput () const |
| Returns true if the pin can operate as an input. More... | |
| bool | canBeOutput () const |
| Returns true if the pin can operate as an output. More... | |
| bool | canFloat () const |
| Returns true if the pin can provide a non-input high impedence state (or maybe allow input state?). More... | |
| DigitalPinCap | capabilities () const |
| Returns the capabilities of the accessed pin. More... | |
| DigitalPinConfig | configuration () const |
| Returns the current configuration of the accessed pin. More... | |
| unsigned int | globalId () const |
| Returns the global pin ID of the accessed pin. More... | |
| bool | havePin () const |
| Returns true if this object has been given a pin to access. More... | |
| bool | input () const |
| Samples the input state of the pin. More... | |
| bool | isInput () const |
| Returns true if the pin is configured as an input. More... | |
| bool | isOutput () const |
| Returns true if the pin is configured as an output. More... | |
| unsigned int | localId () const |
| Returns the local pin ID of the accessed pin. More... | |
| DigitalPinConfig | modifyConfig (const DigitalPinConfig &conf) const |
| Modifies the configuration of the pin. More... | |
| DigitalPinAccess & | operator= (DigitalPinAccess &&old) |
| A move assignment. More... | |
| void | output (bool state) const |
| Changes the output state of the pin. More... | |
| DigitalPinRejectedConfiguration::Reason | proposeConfig (DigitalPinConfig &conf) const |
| Propose a new configuration for the accessed pin using the current configuration as the initial configuration. More... | |
| DigitalPinRejectedConfiguration::Reason | proposeConfig (DigitalPinConfig &proposed, DigitalPinConfig &initial) const |
| Propose a new configuration for the accessed pin using a hypothetical given initial configuration. More... | |
| void | retire () noexcept |
| Relinquish access. More... | |
Public Member Functions inherited from duds::hardware::interface::DigitalPinAccessBase | |
| DigitalPort * | port () const |
| Returns a pointer to the port that controls the pin(s) that are operated through this object. More... | |
Private Member Functions | |
| DigitalPinAccess (DigitalPort *port, unsigned int globalPinId) | |
| Used by DigitalPort. More... | |
Private Attributes | |
| friend | DigitalPort |
| unsigned int | gid |
| Global pin ID. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from duds::hardware::interface::DigitalPinAccessBase | |
| DigitalPinAccessBase () | |
| Cannot be constructed using this base class, but allows the construction of a useless access object without a DigitalPort. More... | |
| DigitalPinAccessBase (DigitalPort *port) | |
| Initializes the port pointer. More... | |
| ~DigitalPinAccessBase ()=default | |
| Cannot be destructed using this base class to avoid the need for a virtual destructor. More... | |
| DigitalPinAccessBase & | operator= (DigitalPinAccessBase &&old) noexcept |
| Allows moving access objects. More... | |
| void | reset () |
| Loses the pointer to the DigitalPort rendering the access object useless. More... | |
Protected Attributes inherited from duds::hardware::interface::DigitalPinAccessBase | |
| PortData | portdata |
| Port specific information. More... | |
Provides access to a single pin on a DigitalPort.
Definition at line 22 of file DigitalPinAccess.hpp.
|
inlineprivate |
Used by DigitalPort.
| port | The port making this object. |
| globalPinId | The global pin ID of the pin to represent. |
Definition at line 32 of file DigitalPinAccess.hpp.
|
inline |
Constructs an access object with nothing to access.
Definition at line 40 of file DigitalPinAccess.hpp.
|
inline |
Relinquish access on destruction.
Definition at line 55 of file DigitalPinAccess.hpp.
|
inline |
Returns true if the pin can operate as an input.
Definition at line 169 of file DigitalPinAccess.hpp.
|
inline |
Returns true if the pin can operate as an output.
Definition at line 175 of file DigitalPinAccess.hpp.
|
inline |
Returns true if the pin can provide a non-input high impedence state (or maybe allow input state?).
Definition at line 182 of file DigitalPinAccess.hpp.
|
inline |
Returns the capabilities of the accessed pin.
Definition at line 83 of file DigitalPinAccess.hpp.
Referenced by canBeInput(), canBeOutput(), and canFloat().
|
inline |
Returns the current configuration of the accessed pin.
Definition at line 89 of file DigitalPinAccess.hpp.
Referenced by isInput(), and isOutput().
|
inline |
Returns the global pin ID of the accessed pin.
Definition at line 77 of file DigitalPinAccess.hpp.
|
inline |
Returns true if this object has been given a pin to access.
Definition at line 65 of file DigitalPinAccess.hpp.
Referenced by retire().
|
inline |
Samples the input state of the pin.
| PinWrongDirection | This pin is not configured as an input. |
Definition at line 139 of file DigitalPinAccess.hpp.
|
inline |
Returns true if the pin is configured as an input.
Definition at line 157 of file DigitalPinAccess.hpp.
|
inline |
Returns true if the pin is configured as an output.
Definition at line 163 of file DigitalPinAccess.hpp.
|
inline |
Returns the local pin ID of the accessed pin.
Definition at line 71 of file DigitalPinAccess.hpp.
Referenced by duds::hardware::interface::linux::GpioDevPort::madeAccess(), and duds::hardware::interface::DigitalPort::updateAccess().
|
inline |
Modifies the configuration of the pin.
If the port implementation is a derivative of DigitalPortDependentPins, the change may affect multiple pins, and the configuration of other pins may prevent the requested change.
| conf | The requested new configuration. |
Definition at line 132 of file DigitalPinAccess.hpp.
| DigitalPinAccess & duds::hardware::interface::DigitalPinAccess::operator= | ( | DigitalPinAccess && | old | ) |
A move assignment.
This requires a call to DigitalPort::updateAccess(), which needs to synchronize on its internal data. As a result, move assignments are not speedy. However, they assure pin access is transfered without being lost.
Definition at line 14 of file DigitalPinAccess.cpp.
Referenced by DigitalPinAccess().
|
inline |
Changes the output state of the pin.
If the pin is not currently configured to output, the configuration will not change, but the new output state will be used when the pin becomes an output in the future.
| state | The new output state. |
Definition at line 148 of file DigitalPinAccess.hpp.
|
inline |
Propose a new configuration for the accessed pin using the current configuration as the initial configuration.
The pin's configuration is not changed; this only checks for a valid supported change.
| conf | The proposed configuration. |
Definition at line 101 of file DigitalPinAccess.hpp.
|
inline |
Propose a new configuration for the accessed pin using a hypothetical given initial configuration.
The pin's configuration is not changed; this only checks for a valid supported change.
| proposed | The proposed configuration. |
| initial | The initial configuration. It should be a valid configuration for the pin and port, but it doesn't need to be the current configuration. |
Definition at line 118 of file DigitalPinAccess.hpp.
|
noexcept |
Relinquish access.
Definition at line 29 of file DigitalPinAccess.cpp.
Referenced by operator=(), and ~DigitalPinAccess().
|
private |
Definition at line 34 of file DigitalPinAccess.hpp.
|
private |
Global pin ID.
Definition at line 26 of file DigitalPinAccess.hpp.
Referenced by globalId(), and operator=().