10 #ifndef DIGITALPINACCESS_HPP 11 #define DIGITALPINACCESS_HPP 16 namespace duds {
namespace hardware {
namespace interface {
66 return port() !=
nullptr;
189 #endif // #ifndef DIGITALPINACCESS_HPP unsigned int localId() const
Returns the local pin ID of the accessed pin.
static constexpr Flags Input
Input operation is supported.
bool input(unsigned int gid, DigitalPinAccessBase::PortData *pdata)
Does error checking in advance of calling inputImpl(unsigned int) to read the input of the given pin...
DigitalPort * port() const
Returns a pointer to the port that controls the pin(s) that are operated through this object...
~DigitalPinAccess()
Relinquish access on destruction.
static constexpr Flags DirInput
Configure the pin for input.
bool isInput() const
Returns true if the pin is configured as an input.
unsigned int globalId() const
Returns the global pin ID of the accessed pin.
Defines the configuration for a digital general purpose I/O pin.
constexpr bool canOutput() const
Returns true if the port is capable of output.
unsigned int localId(unsigned int globalId) const
Returns the local ID for a pin given the global ID.
DigitalPinConfig modifyConfig(unsigned int globalPinId, const DigitalPinConfig &cfg, DigitalPinAccessBase::PortData *pdata)
Modifies the configuration of a single pin with an independent configuration.
Represents an interface to a group of hardware related digital GPIO lines.
void output(bool state) const
Changes the output state of the pin.
std::vector< DigitalPinCap > capabilities(const std::vector< unsigned int > &pvec, bool global) const
void retire() noexcept
Relinquish access.
PortData portdata
Port specific information.
bool canBeOutput() const
Returns true if the pin can operate as an output.
bool havePin() const
Returns true if this object has been given a pin to access.
DigitalPinAccess(DigitalPort *port, unsigned int globalPinId)
Used by DigitalPort.
DigitalPinRejectedConfiguration::Reason proposeConfig(DigitalPinConfig &conf) const
Propose a new configuration for the accessed pin using the current configuration as the initial confi...
unsigned int gid
Global pin ID.
The base class for the digital pin access classes.
DigitalPinRejectedConfiguration::Reason proposeConfig(DigitalPinConfig &proposed, DigitalPinConfig &initial) const
Propose a new configuration for the accessed pin using a hypothetical given initial configuration...
DigitalPinConfig configuration() const
Returns the current configuration of the accessed pin.
bool canFloat() const
Returns true if the pin can provide a non-input high impedence state (or maybe allow input state...
bool canBeInput() const
Returns true if the pin can operate as an input.
DigitalPinCap capabilities() const
Returns the capabilities of the accessed pin.
bool isOutput() const
Returns true if the pin is configured as an output.
Provides access to a single pin on a DigitalPort.
A type-safe bit flag storage class.
void output(unsigned int gid, bool state, DigitalPinAccessBase::PortData *pdata)
Does error checking in advance of calling outputImpl(unsigned int, bool) to change the output of the ...
static constexpr Flags OutputHighImpedance
The pin supports a high impedance state without input.
static constexpr Flags DirOutput
Configure the pin for output.
DigitalPinRejectedConfiguration::Reason proposeConfig(unsigned int gid, DigitalPinConfig &pconf, DigitalPinConfig &iconf) const
Proposes a configuration change for a single pin.
Defines the capabilites of a digital general purpose I/O pin.
DigitalPinAccess()
Constructs an access object with nothing to access.
bool input() const
Samples the input state of the pin.
DigitalPinConfig modifyConfig(const DigitalPinConfig &conf) const
Modifies the configuration of the pin.
DigitalPinAccess & operator=(DigitalPinAccess &&old)
A move assignment.
std::vector< DigitalPinConfig > configuration(const std::vector< unsigned int > &pvec, bool global) const