10 #ifndef DIGITALPIN_HPP 11 #define DIGITALPIN_HPP 16 namespace duds {
namespace hardware {
namespace interface {
41 DigitalPin(
const std::shared_ptr<DigitalPort> &
port,
unsigned int pin);
46 std::unique_ptr<DigitalPinAccess>
access()
const {
47 return port()->access(gid);
57 port()->access(&gid, 1, acc);
69 return port()->localId(gid);
80 operator unsigned int ()
const {
87 return port()->capabilities(gid);
102 return port()->configuration(gid);
116 return port()->proposeConfig(gid, conf);
134 return port()->proposeConfig(gid, proposed, initial);
166 #endif // #ifndef DIGITALPIN_HPP
Represents a single pin on a DigitalPort.
static constexpr Flags Input
Input operation is supported.
static constexpr Flags OutputDriveLow
The output is or can be an open collector or open drain type.
DigitalPinConfig configuration() const
Returns the current configuration of the represented pin.
Defines the configuration for a digital general purpose I/O pin.
unsigned int globalId() const
Returns the global pin ID of the represented pin.
static constexpr Flags OutputDriveHigh
The output is or can be an open emitter type.
DigitalPin()=default
Constructs a DigitalPin object without a port or pin.
DigitalPinRejectedConfiguration::Reason proposeConfig(DigitalPinConfig &proposed, DigitalPinConfig &initial) const
Propose a new configuration for the represented pin using a hypothetical given initial configuration...
const std::shared_ptr< DigitalPort > & port() const
Returns the port that grants access to the pin(s) referenced by this object.
bool canBeOutput() const
Returns true if the pin can operate as an output.
std::unique_ptr< DigitalPinAccess > access() const
Obtains an access object to the pin.
DigitalPinCap capabilities() const
Returns the capabilities of the represented pin.
bool havePin() const
Returns true if this object has been given a pin to represent.
void access(DigitalPinAccess *acc) const
Obtains an access object to the pin.
DigitalPinRejectedConfiguration::Reason proposeConfig(DigitalPinConfig &conf) const
Propose a new configuration for the represented pin using the current configuration as the initial co...
Provides access to a single pin on a DigitalPort.
bool canBeInput() const
Returns true if the pin can operate as an input.
A type-safe bit flag storage class.
static constexpr Flags OutputPushPull
The output can drive the line either low or high.
unsigned int localId() const
Returns the local pin ID of the represented pin.
bool canFloat() const
Returns true if the pin can provide a non-input high impedence state (or maybe allow input state...
static constexpr Flags OutputHighImpedance
The pin supports a high impedance state without input.
unsigned int gid
Global pin ID.
Defines the capabilites of a digital general purpose I/O pin.
A base class for classes that represent one or more pins on a single DigitalPort, but do not provide ...