|
DUDS
|
Distributed Update of Data from Something
|
Selects one of several chips using several pins for parallel output of a number. More...
#include <ChipMultiplexerSelectManager.hpp>
Public Member Functions | |
| ChipMultiplexerSelectManager ()=default | |
| Default constructor. More... | |
| ChipMultiplexerSelectManager (std::unique_ptr< DigitalPinSetAccess > &&acc) | |
| Constructs the manager and sets the access object used to output the number of the chip to select. More... | |
| std::unique_ptr< DigitalPinSetAccess > | releaseAccess () |
| Returns the access object that was used by this chip select manager. More... | |
| void | setAccess (std::unique_ptr< DigitalPinSetAccess > &&acc) |
| Sets the access object used to output the number of the chip to select. More... | |
| virtual bool | validChip (int chipId) const noexcept |
| Valid chip IDs are greater than zero and can be represented in the same number of bits as there are pins provided to the multiplexer. More... | |
Public Member Functions inherited from duds::hardware::interface::ChipSelectManager | |
| ChipSelectManager () | |
| virtual | ~ChipSelectManager ()=0 |
| Derived non-abstract classes must call shutdown() in thier destructor. More... | |
| std::unique_ptr< ChipAccess > | access (int chipId) |
| Acquires access to the requested chip and issues a ChipAccess object. More... | |
| void | access (ChipAccess &acc, int chipId) |
| Acquires access to the requested chip and modifies an existing ChipAccess object to provide that access. More... | |
| bool | inUse () const |
| Returns true if an access object provided by this manager exists. More... | |
| std::unique_ptr< ChipAccess > | select (int chipId) |
| Selects the requested chip and issues a ChipAccess object. More... | |
| void | select (ChipAccess &acc, int chipId) |
| Selects the requested chip and modifies a ChipAccess object to further control chip selection. More... | |
Protected Member Functions | |
| virtual void | deselect () |
| Deselects the chip identified by cid. More... | |
| virtual void | select () |
| Selects the chip identified by cid. More... | |
Protected Member Functions inherited from duds::hardware::interface::ChipSelectManager | |
| void | baseAccess (std::unique_lock< std::mutex > &lock, int chipId) |
| Obtains the resources for providing an access object, but does not make an access object. More... | |
| void | changeChip (int chipId) |
| Changes the chip in use while continuing to use an existing access object. More... | |
| void | shutdown () |
| Waits on a ChipAccess object if one is in use, then begins forcing any threads waiting on access to wake up and throw exceptions. More... | |
Private Attributes | |
| std::unique_ptr< DigitalPinSetAccess > | outacc |
| Access used for parallel output. More... | |
Additional Inherited Members | |
Protected Attributes inherited from duds::hardware::interface::ChipSelectManager | |
| std::mutex | block |
| Used to synchonize access. More... | |
| int | cid |
| Selected chip ID, or -1 to terminate. More... | |
Selects one of several chips using several pins for parallel output of a number.
This implementation requires a multiplexer, but uses the fewest number of pins for two chips or more.
Definition at line 26 of file ChipMultiplexerSelectManager.hpp.
|
default |
Default constructor.
| duds::hardware::interface::ChipMultiplexerSelectManager::ChipMultiplexerSelectManager | ( | std::unique_ptr< DigitalPinSetAccess > && | acc | ) |
Constructs the manager and sets the access object used to output the number of the chip to select.
| acc | The access object to use. It must provide access to at least one pin. |
| PinDoesNotExist | Either the access object does not have any pins, or acc is empty. If thrown, no changes to this chip select manager will be made. |
| DigitalPinCannotOutputError | One of the provided pins is incapable of output. |
Definition at line 14 of file ChipMultiplexerSelectManager.cpp.
|
protectedvirtual |
Deselects the chip identified by cid.
If the chip is already deselected, it must remain deselected.
Implements duds::hardware::interface::ChipSelectManager.
Definition at line 86 of file ChipMultiplexerSelectManager.cpp.
| std::unique_ptr< DigitalPinSetAccess > duds::hardware::interface::ChipMultiplexerSelectManager::releaseAccess | ( | ) |
Returns the access object that was used by this chip select manager.
| ChipSelectInUse | A ChipAccess object provided by this manager currently exists. |
Definition at line 71 of file ChipMultiplexerSelectManager.cpp.
|
protectedvirtual |
Selects the chip identified by cid.
If the chip is already selected, it must remain selected.
Implements duds::hardware::interface::ChipSelectManager.
Definition at line 82 of file ChipMultiplexerSelectManager.cpp.
| void duds::hardware::interface::ChipMultiplexerSelectManager::setAccess | ( | std::unique_ptr< DigitalPinSetAccess > && | acc | ) |
Sets the access object used to output the number of the chip to select.
| acc | The access object to use. It must provide access to at least one pin. |
| ChipSelectInUse | A ChipAccess object provided by this manager currently exists. |
| PinDoesNotExist | Either the access object does not have any pins, or acc is empty. If thrown, no changes to this chip select manager will be made. |
| DigitalPinCannotOutputError | One of the provided pins is incapable of output. |
Definition at line 27 of file ChipMultiplexerSelectManager.cpp.
Referenced by ChipMultiplexerSelectManager().
|
virtualnoexcept |
Valid chip IDs are greater than zero and can be represented in the same number of bits as there are pins provided to the multiplexer.
Implements duds::hardware::interface::ChipSelectManager.
Definition at line 20 of file ChipMultiplexerSelectManager.cpp.
|
private |
Access used for parallel output.
Definition at line 30 of file ChipMultiplexerSelectManager.hpp.
Referenced by deselect(), releaseAccess(), select(), setAccess(), and validChip().