|
DUDS
|
Distributed Update of Data from Something
|
Represents a set of pins on a single DigitalPort. More...
#include <DigitalPinSet.hpp>
Public Member Functions | |
| DigitalPinSet ()=default | |
| Constructs DigitalPinSet object with nothing to represent. More... | |
| DigitalPinSet (const std::shared_ptr< DigitalPort > &port, const std::vector< unsigned int > &pvec) | |
| Constructs a DigitalPinSet object with the given port and pins. More... | |
| DigitalPinSet (const std::shared_ptr< DigitalPort > &port, std::vector< unsigned int > &&pvec) | |
| Constructs a DigitalPinSet object with the given port and pins. More... | |
| std::unique_ptr< DigitalPinSetAccess > | access () const |
| Obtains an access object for all the pins in this set. More... | |
| void | access (DigitalPinSetAccess &acc) const |
| Obtains an access object for all the pins in this set. More... | |
| bool | canBeInput (unsigned int pos) const |
| Returns true if the pin can operate as an input. More... | |
| bool | canBeOutput (unsigned int pos) const |
| Returns true if the pin can operate as an output. More... | |
| bool | canFloat (unsigned int pos) const |
| Returns true if the pin can provide a non-input high impedence state (or maybe allow input state?). More... | |
| DigitalPinCap | capabilities (unsigned int pos) const |
| Returns the capabilities of the specified pin. More... | |
| std::vector< DigitalPinCap > | capabilities () const |
| Returns the capabilities of all the pins in this set. More... | |
| DigitalPinConfig | configuration (unsigned int pos) const |
| Returns the current configuration of the specified pin. More... | |
| std::vector< DigitalPinConfig > | configuration () const |
| Returns the current configuration all pins in this set. More... | |
| bool | exists (unsigned int pos) const |
| Returns true if the given position is for an existent pin rather than a gap or a position past the end. More... | |
| unsigned int | globalId (unsigned int pos) const |
| Returns the global pin ID of the pin at the given position inside this set of pins. More... | |
| const std::vector< unsigned int > & | globalIds () const |
| Provides access to the internal vector of global pin IDs. More... | |
| bool | havePins () const |
| Returns true if this object has been given any pins to represent. More... | |
| bool | independentConfig () const |
| Returns true if all pins on the port always have an independent configuration from all other pins. More... | |
| unsigned int | localId (unsigned int pos) const |
| Returns the local pin ID of the pin at the given position inside this set of pins. More... | |
| std::vector< unsigned int > | localIds () const |
| Returns a vector of port-local pin IDs for the pins represented by this object. More... | |
| DigitalPinRejectedConfiguration::Reason | proposeConfig (unsigned int pos, DigitalPinConfig &conf) const |
| Propose a new configuration for the given pin using the current configuration as the initial configuration. More... | |
| DigitalPinRejectedConfiguration::Reason | proposeConfig (unsigned int pos, DigitalPinConfig &proposed, DigitalPinConfig &initial) const |
| Propose a new configuration for the given pin using a hypothetical given initial configuration. More... | |
| bool | proposeConfig (std::vector< DigitalPinConfig > &propConf, std::vector< DigitalPinConfig > &initConf, std::function< void(DigitalPinRejectedConfiguration::Reason)> insertReason=std::function< void(DigitalPinRejectedConfiguration::Reason)>()) |
| Propose a new configuration for the entire pin set using a hypothetical given initial configuration. More... | |
| bool | simultaneousOperations () const |
| True if the port supports operating on multiple pins simultaneously. More... | |
| unsigned int | size () const |
| Returns the number of pins in this object. More... | |
Public Member Functions inherited from duds::hardware::interface::DigitalPinBase | |
| const std::shared_ptr< DigitalPort > & | port () const |
| Returns the port that grants access to the pin(s) referenced by this object. More... | |
| void | reset () |
| Resets the shared pointer to the DigitalPort so that this object no longer represents a pin. More... | |
Private Attributes | |
| std::vector< unsigned int > | pinvec |
| The port global pin IDs this object will represent. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from duds::hardware::interface::DigitalPinBase | |
| DigitalPinBase ()=default | |
| Cannot be constructed using this base class, but allows the construction of a useless object without a DigitalPort. More... | |
| DigitalPinBase (const std::shared_ptr< DigitalPort > &port) | |
| Initializes the port. More... | |
| ~DigitalPinBase ()=default | |
| Cannot be destructed using this base class to avoid the need for a virtual destructor. More... | |
Represents a set of pins on a single DigitalPort.
Definition at line 22 of file DigitalPinSet.hpp.
|
default |
Constructs DigitalPinSet object with nothing to represent.
| duds::hardware::interface::DigitalPinSet::DigitalPinSet | ( | const std::shared_ptr< DigitalPort > & | port, |
| const std::vector< unsigned int > & | pvec | ||
| ) |
Constructs a DigitalPinSet object with the given port and pins.
| port | A shared pointer to the DigitalPort object that handles the pins. |
| pvec | A vector with the global pin IDs for all the pins to represent. A value of -1 represents a gap, the lack of a pin at the corresponding position. The only value that may be repeated is -1. |
| PinDoesNotExist | A given pin does not exist in the given port. |
| DigitalPortDoesNotExistError |
Definition at line 14 of file DigitalPinSet.cpp.
| duds::hardware::interface::DigitalPinSet::DigitalPinSet | ( | const std::shared_ptr< DigitalPort > & | port, |
| std::vector< unsigned int > && | pvec | ||
| ) |
Constructs a DigitalPinSet object with the given port and pins.
| port | A shared pointer to the DigitalPort object that handles the pins. |
| pvec | A vector with the global pin IDs for all the pins to represent. A value of -1 represents a gap, the lack of a pin at the corresponding position. The only value that may be repeated is -1. The value is moved to an internal vector. If an exception is thrown, the value is moved back. |
| PinDoesNotExist | A given pin does not exist in the given port. |
| DigitalPortDoesNotExistError |
Definition at line 34 of file DigitalPinSet.cpp.
|
inline |
Obtains an access object for all the pins in this set.
Definition at line 70 of file DigitalPinSet.hpp.
Referenced by duds::hardware::devices::displays::HD44780::preparePins(), and duds::hardware::devices::displays::ST7920::preparePins().
|
inline |
Obtains an access object for all the pins in this set.
| acc | The access object that will be given control over the pins. If it already grants access to pins, it will relinquish that access first. |
Definition at line 79 of file DigitalPinSet.hpp.
|
inline |
Returns true if the pin can operate as an input.
| pos | The position of the pin in this set. |
Definition at line 271 of file DigitalPinSet.hpp.
|
inline |
Returns true if the pin can operate as an output.
| pos | The position of the pin in this set. |
Definition at line 278 of file DigitalPinSet.hpp.
|
inline |
Returns true if the pin can provide a non-input high impedence state (or maybe allow input state?).
| pos | The position of the pin in this set. |
Definition at line 286 of file DigitalPinSet.hpp.
|
inline |
Returns the capabilities of the specified pin.
| pos | The position of the pin in this set. |
Definition at line 139 of file DigitalPinSet.hpp.
Referenced by duds::hardware::interface::DigitalPinMasterSyncSerial::checkPins().
|
inline |
Returns the capabilities of all the pins in this set.
Any gaps in the set (ID is -1) will have a value of DigitalPinCap::Nonexistent.
Definition at line 147 of file DigitalPinSet.hpp.
Referenced by canBeInput(), canBeOutput(), and canFloat().
|
inline |
Returns the current configuration of the specified pin.
| pos | The position of the pin in this set. |
Definition at line 163 of file DigitalPinSet.hpp.
|
inline |
Returns the current configuration all pins in this set.
Any gaps in the set (ID is -1) will have a configuration of DigitalPinConfig::OperationNoChange.
Definition at line 180 of file DigitalPinSet.hpp.
|
inline |
Returns true if the given position is for an existent pin rather than a gap or a position past the end.
| pos | The position to check. |
Definition at line 107 of file DigitalPinSet.hpp.
|
inline |
Returns the global pin ID of the pin at the given position inside this set of pins.
| pos | The position of the pin in this set. |
Definition at line 131 of file DigitalPinSet.hpp.
Referenced by duds::hardware::interface::DigitalPinMasterSyncSerial::checkPins().
|
inline |
Provides access to the internal vector of global pin IDs.
Definition at line 86 of file DigitalPinSet.hpp.
|
inline |
Returns true if this object has been given any pins to represent.
Definition at line 99 of file DigitalPinSet.hpp.
Referenced by duds::hardware::devices::displays::HD44780::preparePins(), duds::hardware::devices::displays::ST7920::preparePins(), duds::hardware::devices::displays::HD44780::~HD44780(), and duds::hardware::devices::displays::ST7920::~ST7920().
|
inline |
Returns true if all pins on the port always have an independent configuration from all other pins.
Definition at line 264 of file DigitalPinSet.hpp.
|
inline |
Returns the local pin ID of the pin at the given position inside this set of pins.
| pos | The position of the pin in this set. |
Definition at line 122 of file DigitalPinSet.hpp.
|
inline |
Returns a vector of port-local pin IDs for the pins represented by this object.
Definition at line 93 of file DigitalPinSet.hpp.
|
inline |
Propose a new configuration for the given 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. |
| pos | The position of the pin in this set. |
Definition at line 193 of file DigitalPinSet.hpp.
|
inline |
Propose a new configuration for the given 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. |
| pos | The position of the pin in this set. |
Definition at line 212 of file DigitalPinSet.hpp.
|
inline |
Propose a new configuration for the entire pin set using a hypothetical given initial configuration.
The configuration is not changed; this only checks for a valid supported change.
| propConf | The proposed configuration. |
| initConf | The initial configuration. It should be a valid configuration for the pins and port, but it doesn't need to be the current configuration. |
| insertReason | A function that, if specified, will be called for each pin, in the order specified by this set, with the rejection reason for that pin. The reason will be DigitalPinRejectedConfiguration::NotRejected if the pin's proposed configuration is good. The function is optional. |
Definition at line 236 of file DigitalPinSet.hpp.
|
inline |
True if the port supports operating on multiple pins simultaneously.
If false, the pins may be modified on over a period of time in an implementation defined order.
Definition at line 257 of file DigitalPinSet.hpp.
|
inline |
Returns the number of pins in this object.
The count includes pins set as -1; gaps in the pins to access.
Definition at line 114 of file DigitalPinSet.hpp.
Referenced by duds::hardware::interface::DigitalPinMasterSyncSerial::checkPins().
|
private |
The port global pin IDs this object will represent.
Definition at line 26 of file DigitalPinSet.hpp.
Referenced by DigitalPinSet(), and globalIds().