|
DUDS
|
Distributed Update of Data from Something
|
Selects a single chip at a time using one pin from a set. More...
#include <ChipPinSetSelectManager.hpp>
Public Member Functions | |
| ChipPinSetSelectManager () | |
| Default constructor. More... | |
| ChipPinSetSelectManager (std::unique_ptr< DigitalPinSetAccess > &&dpsa, std::uint32_t selectStates=0) | |
| Constructs a ChipPinSetSelectManager with a pin set to use for selection. More... | |
| ~ChipPinSetSelectManager () | |
| Calls shutdown(). More... | |
| void | setSelectPins (std::unique_ptr< DigitalPinSetAccess > &&dpsa, std::uint32_t selectStates=0) |
| Sets the DigitalPinSetAccess object to use for the chip select lines, and the selection states for each chip. More... | |
| virtual bool | validChip (int chipId) const noexcept |
| Valid IDs are those with a pin in the DigitalPinSetAccess object given to this manager. 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 > | selpins |
| The access object for the select pin. More... | |
| std::uint32_t | selstates |
| The select logic states for each pin. 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 a single chip at a time using one pin from a set.
It uses a DigitalPinSetAccess object to operate the select pins. By using a DigitalPinSetAccess object, the pins will be flagged as in-use by it's DigitalPort to prevent the pins from being used for some other purpose.
The pins used must support output. This class allows any output type, but will select the first output type supported in this order:
Definition at line 31 of file ChipPinSetSelectManager.hpp.
|
inline |
Default constructor.
Definition at line 47 of file ChipPinSetSelectManager.hpp.
| duds::hardware::interface::ChipPinSetSelectManager::~ChipPinSetSelectManager | ( | ) |
Calls shutdown().
Definition at line 83 of file ChipPinSetSelectManager.cpp.
Referenced by ChipPinSetSelectManager().
| duds::hardware::interface::ChipPinSetSelectManager::ChipPinSetSelectManager | ( | std::unique_ptr< DigitalPinSetAccess > && | dpsa, |
| std::uint32_t | selectStates = 0 |
||
| ) |
Constructs a ChipPinSetSelectManager with a pin set to use for selection.
| dpsa | The access object for the select pins. Up to 32 pins may be used. |
| selectStates | The pin states that selects each device. The bit position corresponds to the index in dpsa. (1 << index) |
| ChipSelectInUse | A ChipAccess object provided by this manager currently exists. |
| PinDoesNotExist | The DigitalPinAccess object does not provide access to any pin. |
| ChipSelectTooManyPins | More than 32 pins are in the access object. |
| DigitalPinCannotOutputError | At least one pin cannot output. |
Definition at line 76 of file ChipPinSetSelectManager.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 23 of file ChipPinSetSelectManager.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 19 of file ChipPinSetSelectManager.cpp.
| void duds::hardware::interface::ChipPinSetSelectManager::setSelectPins | ( | std::unique_ptr< DigitalPinSetAccess > && | dpsa, |
| std::uint32_t | selectStates = 0 |
||
| ) |
Sets the DigitalPinSetAccess object to use for the chip select lines, and the selection states for each chip.
| dpsa | The access object for the select pins. Up to 32 pins may be used. |
| selectStates | The pin states that selects each device. The bit position corresponds to the index in dpsa. (1 << index) |
| ChipSelectInUse | A ChipAccess object provided by this manager currently exists. |
| PinDoesNotExist | The DigitalPinAccess object does not provide access to any pin. |
| ChipSelectTooManyPins | More than 32 pins are in the access object. |
| DigitalPinCannotOutputError | At least one pin cannot output. |
Definition at line 27 of file ChipPinSetSelectManager.cpp.
Referenced by ChipPinSetSelectManager().
|
virtualnoexcept |
Valid IDs are those with a pin in the DigitalPinSetAccess object given to this manager.
Implements duds::hardware::interface::ChipSelectManager.
Definition at line 15 of file ChipPinSetSelectManager.cpp.
Referenced by ChipPinSetSelectManager().
|
private |
The access object for the select pin.
Definition at line 35 of file ChipPinSetSelectManager.hpp.
Referenced by deselect(), select(), and setSelectPins().
|
private |
The select logic states for each pin.
Definition at line 39 of file ChipPinSetSelectManager.hpp.
Referenced by deselect(), select(), and setSelectPins().