|
DUDS
|
Distributed Update of Data from Something
|
A partial DigitalPort implementation for ports where the configuration of one pin may affect the configuration of one or more other pins on the same port. More...
#include <DigitalPortDependentPins.hpp>
Public Member Functions | |
| virtual bool | independentConfig () const |
| Some pins have a configuration that is dependent on other pins, so this function always returns false. More... | |
| virtual bool | independentConfig (unsigned int gid, const DigitalPinConfig &newcfg, const DigitalPinConfig &initcfg) const =0 |
| Returns true if the given configuration for the given pin does not affect any other pins in the port. More... | |
Public Member Functions inherited from duds::hardware::interface::DigitalPort | |
| virtual | ~DigitalPort () |
| Derived classes should call shutdown() early in their destructors. More... | |
| void | access (const unsigned int *pins, const unsigned int len, std::unique_ptr< DigitalPinAccess > *acc) |
| Obtain access objects to use a set of pins. More... | |
| template<std::size_t Len> | |
| void | access (const unsigned int pins[Len], std::unique_ptr< DigitalPinAccess > acc[Len]) |
| std::unique_ptr< DigitalPinAccess > | access (const unsigned int pin) |
| void | access (const unsigned int *pins, const unsigned int len, DigitalPinAccess *acc) |
| Obtain access objects to use a set of pins. More... | |
| void | access (const std::vector< unsigned int > &pins, DigitalPinAccess *acc) |
| template<std::size_t alen, std::size_t plen> | |
| void | access (const unsigned int pins[plen], DigitalPinAccess acc[alen]) |
| This is a nice idea that may fail at compile time. More... | |
| void | access (const unsigned int *pins, const unsigned int len, DigitalPinSetAccess &acc) |
| Obtain access objects to use a set of pins. More... | |
| void | access (const unsigned int *begin, const unsigned int *end, DigitalPinSetAccess &acc) |
| void | access (const std::vector< unsigned int > &pins, DigitalPinSetAccess &acc) |
| std::unique_ptr< DigitalPinSetAccess > | access (const std::vector< unsigned int > &pins) |
| template<class InputIter > | |
| void | access (const InputIter &begin, const InputIter &end, DigitalPinSetAccess &acc) |
| DigitalPinCap | capabilities (unsigned int globalPinId) const |
| Returns the capabilities of a pin. More... | |
| std::vector< DigitalPinCap > | capabilities () const |
| Returns the capabilities of all pins in the port. More... | |
| std::vector< DigitalPinCap > | capabilities (const std::vector< unsigned int > &pvec) const |
| Returns the capabilities of all the pins requested by global ID. More... | |
| std::vector< DigitalPinCap > | capabilitiesLocalIds (const std::vector< unsigned int > &pvec) const |
| Returns the capabilities of all the pins requested by local ID. More... | |
| DigitalPinConfig | configuration (unsigned int globalPinId) const |
| Returns the current configuration of a pin. More... | |
| std::vector< DigitalPinConfig > | configuration () const |
| Returns the configuration of all pins in the port. More... | |
| std::vector< DigitalPinConfig > | configuration (const std::vector< unsigned int > &pvec) const |
| Returns the configuration of all the pins requested by global ID. More... | |
| std::vector< DigitalPinConfig > | configurationLocalIds (const std::vector< unsigned int > &pvec) const |
| Returns the configuration of all the pins requested by local ID. More... | |
| bool | exists (unsigned int gid) const |
| Returns true if the pin exists in this port. More... | |
| unsigned int | globalId (unsigned int localId) const |
| Returns the global ID for a pin given the local ID. More... | |
| std::vector< unsigned int > | globalIds (const std::vector< unsigned int > &localIds) const |
| Converts the provided local pin IDs to global pin IDs. More... | |
| unsigned int | localId (unsigned int globalId) const |
| Returns the local ID for a pin given the global ID. More... | |
| std::vector< unsigned int > | localIds (const std::vector< unsigned int > &globalIds) const |
| Converts the provided global pin IDs to local pin IDs. More... | |
| unsigned int | offset () const |
| Returns the offset for the port's pins. More... | |
| void | poll () |
| void | pollInput () |
| void | pollSignal () |
| DigitalPinRejectedConfiguration::Reason | proposeConfig (unsigned int gid, DigitalPinConfig &pconf, DigitalPinConfig &iconf) const |
| Proposes a configuration change for a single pin. More... | |
| DigitalPinRejectedConfiguration::Reason | proposeConfig (unsigned int gid, DigitalPinConfig &pconf) const |
| Proposes a configuration change for a single pin from the port's current configuration. More... | |
| bool | proposeConfig (const std::vector< unsigned int > &globalPinIds, std::vector< DigitalPinConfig > &propConf, std::vector< DigitalPinConfig > &initConf, std::function< void(DigitalPinRejectedConfiguration::Reason)> insertReason=std::function< void(DigitalPinRejectedConfiguration::Reason)>()) const |
| bool | proposeConfig (const std::vector< unsigned int > &pins, std::vector< DigitalPinConfig > &propConf, std::function< void(DigitalPinRejectedConfiguration::Reason)> insertReason=std::function< void(DigitalPinRejectedConfiguration::Reason)>()) const |
| bool | proposeConfigLocalIds (const std::vector< unsigned int > &localPinIds, std::vector< DigitalPinConfig > &propConf, std::vector< DigitalPinConfig > &initConf, std::function< void(DigitalPinRejectedConfiguration::Reason)> insertReason=std::function< void(DigitalPinRejectedConfiguration::Reason)>()) const |
| bool | proposeConfigLocalIds (const std::vector< unsigned int > &pins, std::vector< DigitalPinConfig > &propConf, std::function< void(DigitalPinRejectedConfiguration::Reason)> insertReason=std::function< void(DigitalPinRejectedConfiguration::Reason)>()) const |
| bool | proposeFullConfig (std::vector< DigitalPinConfig > &propConf, std::vector< DigitalPinConfig > &initConf, std::function< void(DigitalPinRejectedConfiguration::Reason)> insertReason=std::function< void(DigitalPinRejectedConfiguration::Reason)>()) const |
| virtual bool | simultaneousOperations () const =0 |
| True if the implementation supports operating on multiple pins simultaneously. More... | |
| unsigned int | size () const |
| The maximum number of pins on the port. More... | |
Protected Member Functions | |
| DigitalPortDependentPins (unsigned int numpins, unsigned int firstid) | |
| virtual DigitalPinRejectedConfiguration::Reason | inspectProposal (unsigned int localPinId, std::vector< DigitalPinConfig > &proposed, std::vector< DigitalPinConfig > &initial) const =0 |
| Inspects a proposed change to the pin configuration to assure it meets all requirements and constraints of the proposal and the current configuration. More... | |
| virtual DigitalPinRejectedConfiguration::Reason | proposeConfigImpl (unsigned int gid, DigitalPinConfig &pconf, DigitalPinConfig &iconf) const |
| Considers the proposed configuration for one pin, but may consider changes to other pins if the change is not independent. More... | |
| virtual bool | proposeConfigImpl (const std::vector< unsigned int > &pins, std::vector< DigitalPinConfig > &propConf, std::vector< DigitalPinConfig > &initConf, std::function< void(DigitalPinRejectedConfiguration::Reason)> insertReason=std::function< void(DigitalPinRejectedConfiguration::Reason)>()) const |
| Considers the proposed configuration one pin at a time in the order specified in pins. More... | |
| virtual bool | proposeFullConfigImpl (std::vector< DigitalPinConfig > &propConf, std::vector< DigitalPinConfig > &initConf, std::function< void(DigitalPinRejectedConfiguration::Reason)> insertReason=std::function< void(DigitalPinRejectedConfiguration::Reason)>()) const |
| Considers the proposed configuration one pin at a time for all pins in the port. More... | |
Protected Member Functions inherited from duds::hardware::interface::DigitalPort | |
| DigitalPort (unsigned int numpins, unsigned int firstid) | |
| Initializes internal data. More... | |
| std::vector< DigitalPinCap > | capabilities (const std::vector< unsigned int > &pvec, bool global) const |
| const DigitalPinConfig & | configRef (unsigned int localPinId) const |
| Returns a reference to a pin's configuration on behalf of an access object. More... | |
| std::vector< DigitalPinConfig > | configuration (const std::vector< unsigned int > &pvec, bool global) const |
| std::vector< DigitalPinConfig > | configurationImpl () const |
| Returns the configuration of all pins in the port. More... | |
| virtual void | configurePort (unsigned int localPinId, const DigitalPinConfig &cfg, DigitalPinAccessBase::PortData *pdata)=0 |
| Changes the hardware configuration for a single pin. More... | |
| virtual void | configurePort (const std::vector< DigitalPinConfig > &cfgs, DigitalPinAccessBase::PortData *pdata)=0 |
| Changes the hardware configuration for the whole port. More... | |
| 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. More... | |
| std::vector< bool > | input (const std::vector< unsigned int > &pvec, DigitalPinAccessBase::PortData *pdata) |
| Does error checking in advance of calling inputImpl(const std::vector<unsigned int> &) to read the input of a set of pins. More... | |
| virtual bool | inputImpl (unsigned int gid, DigitalPinAccessBase::PortData *pdata)=0 |
| Reads input from the given pin. More... | |
| virtual std::vector< bool > | inputImpl (const std::vector< unsigned int > &pvec, DigitalPinAccessBase::PortData *pdata) |
| Reads input from the requested pins. More... | |
| virtual void | madeAccess (DigitalPinAccess &acc) |
| Called after a new access object is made to allow a port implementation to take further action. More... | |
| virtual void | madeAccess (DigitalPinSetAccess &acc) |
| Called after a new access object is made to allow a port implementation to take further action. More... | |
| DigitalPinConfig | modifyConfig (unsigned int globalPinId, const DigitalPinConfig &cfg, DigitalPinAccessBase::PortData *pdata) |
| Modifies the configuration of a single pin with an independent configuration. More... | |
| void | modifyConfig (std::vector< DigitalPinConfig > &cfgs, DigitalPinAccessBase::PortData *pdata) |
| Modifies the configuration of multiple pins. More... | |
| void | modifyConfig (const std::vector< unsigned int > &pvec, std::vector< DigitalPinConfig > &cfgs, DigitalPinAccessBase::PortData *pdata) |
| void | modifyFullConfig (std::vector< DigitalPinConfig > &propConf, std::vector< DigitalPinConfig > &initConf, DigitalPinAccessBase::PortData *pdata) |
| Does the work of the modifyConfig() functions in the case that the whole port configuration must be considered for possible changes. More... | |
| 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 given pin. More... | |
| void | output (const std::vector< unsigned int > &pvec, const std::vector< bool > &state, DigitalPinAccessBase::PortData *pdata) |
| Does error checking in advance of calling outputImpl(const std::vector<unsigned int> &,const std::vector<bool> &) to change the output of a set of pins. More... | |
| virtual void | outputImpl (unsigned int lid, bool state, DigitalPinAccessBase::PortData *pdata)=0 |
| Changes the output state of the given pin. More... | |
| virtual void | outputImpl (const std::vector< unsigned int > &pvec, const std::vector< bool > &state, DigitalPinAccessBase::PortData *pdata) |
| Changes the outputs of several pins. More... | |
| virtual void | retiredAccess (const DigitalPinAccess &acc) noexcept |
| Called just before an access object is retired to allow a port implementation to take further action. More... | |
| virtual void | retiredAccess (const DigitalPinSetAccess &acc) noexcept |
| Called just before an access object is retired to allow a port implementation to take further action. More... | |
| void | shutdown () |
| Waits for access to all pins so that any user of access objects may finish with their operation, then destroys all pin data and awakens threads waiting on access, but they will not receive access. More... | |
Additional Inherited Members | |
Protected Types inherited from duds::hardware::interface::DigitalPort | |
| typedef std::vector< PinEntry > | PinVector |
Static Protected Member Functions inherited from duds::hardware::interface::DigitalPort | |
| static DigitalPinAccessBase::PortData & | portData (const DigitalPinAccessBase &acc) |
| Returns a reference to the port specific data in the given DigitalPinAccessBase object. More... | |
| template<typename T > | |
| static void | portDataPtr (const DigitalPinAccessBase &acc, T **ptr) |
| Provides a pointer to type T stored in the port specific data of the given DigitalPinAccessBase object. More... | |
Protected Attributes inherited from duds::hardware::interface::DigitalPort | |
| PinVector | pins |
| Data on each pin handled by the port. More... | |
A partial DigitalPort implementation for ports where the configuration of one pin may affect the configuration of one or more other pins on the same port.
This is intended for use with hardware like the 74595 series; they can manage high impedence on their outputs, but for all or none of the pins.
independentConfig(unsigned int, const DigitalPinConfig &) must be defined by implementors since some configurations for some pins may not require changes to any other pin.
Definition at line 31 of file DigitalPortDependentPins.hpp.
|
inlineprotected |
Definition at line 33 of file DigitalPortDependentPins.hpp.
|
virtual |
Some pins have a configuration that is dependent on other pins, so this function always returns false.
Implements duds::hardware::interface::DigitalPort.
Definition at line 14 of file DigitalPortDependentPins.cpp.
Referenced by DigitalPortDependentPins(), proposeConfigImpl(), and proposeFullConfigImpl().
|
pure virtual |
Returns true if the given configuration for the given pin does not affect any other pins in the port.
When true, the functions to change pin configurations will use simpler and faster code. When false, more complex logic will be used to assure the dependent configurations will still meet their requirements.
| gid | The global pin ID. |
| newcfg | The proposed configuration to check. |
| initcfg | The initial configuration for the pin. |
| PinDoesNotExist | The specified pin does not exist within this port. |
Implements duds::hardware::interface::DigitalPort.
|
protectedpure virtual |
Inspects a proposed change to the pin configuration to assure it meets all requirements and constraints of the proposal and the current configuration.
This function is called once for each pin who's configuration has been requested to change and for which independentConfig() indicates will require changing other pin configurations to succeed. If all pin configurations are completely independent (all possible configurations for any pin one affects only that pin), this function does not need to be implemented.
By the time this function is called, the configuration has been checked against the pin's DigitalPinCap and succeeded. However, this function must assure that changes to other dependent pin configurations are also within the hardware capabilities.
| localPinId | The local pin ID; matches the index in the pins and proposed vectors. It is the pin who's configuration is under consideration. |
| proposed | A vector containing the resulting configuration with the proposal(s) applied. This function must modify the value based on the requested change to pin id. If a modification fails to meet the requirements, then the errant change should not be recorded in this vector. |
| initial | A vector containing the initial configuration for the port. It may be different than the current port configuration. The change from the initial configuration held here to the proposed configuration is what the function must consider. |
Referenced by DigitalPortDependentPins(), proposeConfigImpl(), and proposeFullConfigImpl().
|
protectedvirtual |
Considers the proposed configuration for one pin, but may consider changes to other pins if the change is not independent.
Port implementations do not have to redefine this function, but may if advantageous.
Implements duds::hardware::interface::DigitalPort.
Definition at line 218 of file DigitalPortDependentPins.cpp.
Referenced by DigitalPortDependentPins().
|
protectedvirtual |
Considers the proposed configuration one pin at a time in the order specified in pins.
Port implementations do not have to redefine this function, but may if advantageous.
Implements duds::hardware::interface::DigitalPort.
Definition at line 19 of file DigitalPortDependentPins.cpp.
|
protectedvirtual |
Considers the proposed configuration one pin at a time for all pins in the port.
It is faster and less complex than working over a subset of pins in an arbitrary order. Port implementations do not have to redefine this function, but may if advantageous.
Implements duds::hardware::interface::DigitalPort.
Definition at line 148 of file DigitalPortDependentPins.cpp.
Referenced by DigitalPortDependentPins().