|
DUDS
|
Distributed Update of Data from Something
|
An object to wrap together a ChipSelectManager and chip ID to simplify code that needs to repeatedly select the same chip. More...
#include <ChipSelect.hpp>
Public Member Functions | |
| ChipSelect () noexcept | |
| Initializes the object to a non-configured state. More... | |
| ChipSelect (const std::shared_ptr< ChipSelectManager > &csm, int chipId) | |
| Makes a ChipSelect to select chipId from csm. More... | |
| ChipSelect (std::shared_ptr< ChipSelectManager > &&csm, int chipId) | |
| Makes a ChipSelect to select chipId from csm. More... | |
| std::unique_ptr< ChipAccess > | access () |
| Obtains a ChipAccess object. More... | |
| void | access (ChipAccess &acc) |
| Modifies a ChipAccess object to use the manager and chip specified within this object. More... | |
| int | chipId () const |
| Returns the chip ID of the chip this object will select. More... | |
| bool | configured () const |
| Returns true if this object was configured with a chip to select. More... | |
| bool | haveManager () const |
| Returns true if this object has an associated manager. More... | |
| const std::shared_ptr< ChipSelectManager > & | manager () const |
| Returns the associated manager object. More... | |
| void | modify (const std::shared_ptr< ChipSelectManager > &csm, int chipId) |
| Changes the manager and chip to select. More... | |
| void | modify (std::shared_ptr< ChipSelectManager > &&csm, int chipId) |
| Changes the manager and chip to select. More... | |
| operator bool () const | |
| This object evaluates to true if this object appears to be in a usable state. More... | |
| void | reset () noexcept |
| Returns the object to the default constructed state of not having a manager or a valid chip ID. More... | |
| std::unique_ptr< ChipAccess > | select () |
| Obtains an access object and selects the chip. More... | |
| void | select (ChipAccess &acc) |
| Modifies a ChipAccess object to use the manager and chip specified within this object, and selects the chip. More... | |
Private Attributes | |
| int | cid |
| The chip to select. More... | |
| std::shared_ptr< ChipSelectManager > | mgr |
| The manager that will handle the selection. More... | |
An object to wrap together a ChipSelectManager and chip ID to simplify code that needs to repeatedly select the same chip.
Definition at line 24 of file ChipSelect.hpp.
|
noexcept |
Initializes the object to a non-configured state.
Definition at line 16 of file ChipSelect.cpp.
| duds::hardware::interface::ChipSelect::ChipSelect | ( | const std::shared_ptr< ChipSelectManager > & | csm, |
| int | chipId | ||
| ) |
Makes a ChipSelect to select chipId from csm.
| csm | A shared_ptr to the manager. It should be empty to be non-configured. |
| chipId | A non-negative chip ID, or negative to be non-configured. |
| ChipSelectInvalidChip | The manager reports that the given chip ID is invalid. |
Definition at line 18 of file ChipSelect.cpp.
| duds::hardware::interface::ChipSelect::ChipSelect | ( | std::shared_ptr< ChipSelectManager > && | csm, |
| int | chipId | ||
| ) |
Makes a ChipSelect to select chipId from csm.
| csm | A shared_ptr to the manager. It will be moved into this object. |
| chipId | A non-negative chip ID, or negative to be non-configured. |
| ChipSelectInvalidChip | The manager reports that the given chip ID is invalid. csm will be unchanged. |
Definition at line 25 of file ChipSelect.cpp.
| std::unique_ptr< ChipAccess > duds::hardware::interface::ChipSelect::access | ( | ) |
Obtains a ChipAccess object.
| ChipSelectBadManager | The ChipSelectManager, manager, is not set. This is normal when the default constructor is used. |
Definition at line 32 of file ChipSelect.cpp.
Referenced by duds::hardware::interface::DigitalPinMasterSyncSerial::open(), duds::hardware::devices::displays::ST7920::preparePins(), and duds::hardware::devices::displays::HD44780::preparePins().
| void duds::hardware::interface::ChipSelect::access | ( | ChipAccess & | acc | ) |
Modifies a ChipAccess object to use the manager and chip specified within this object.
| acc | The access object that will allow chip selection. |
| ChipSelectBadManager | The ChipSelectManager, manager, is not set. This is normal when the default constructor is used. |
Definition at line 40 of file ChipSelect.cpp.
|
inline |
Returns the chip ID of the chip this object will select.
Definition at line 125 of file ChipSelect.hpp.
Referenced by modify(), and duds::hardware::interface::DigitalPinMasterSyncSerial::setChipSelect().
|
inline |
Returns true if this object was configured with a chip to select.
Definition at line 112 of file ChipSelect.hpp.
Referenced by operator bool(), and duds::hardware::interface::DigitalPinMasterSyncSerial::setChipSelect().
|
inline |
Returns true if this object has an associated manager.
Definition at line 100 of file ChipSelect.hpp.
Referenced by duds::hardware::interface::DigitalPinMasterSyncSerial::setChipSelect().
|
inline |
Returns the associated manager object.
Definition at line 106 of file ChipSelect.hpp.
| void duds::hardware::interface::ChipSelect::modify | ( | const std::shared_ptr< ChipSelectManager > & | csm, |
| int | chipId | ||
| ) |
Changes the manager and chip to select.
| csm | A shared_ptr to the manager. It should be empty to be non-configured. |
| chipId | A non-negative chip ID, or negative to be non-configured. |
| ChipSelectInvalidChip | The manager reports that the given chip ID is invalid. |
Definition at line 64 of file ChipSelect.cpp.
Referenced by duds::hardware::interface::PinConfiguration::attachPort(), chipId(), and ChipSelect().
| void duds::hardware::interface::ChipSelect::modify | ( | std::shared_ptr< ChipSelectManager > && | csm, |
| int | chipId | ||
| ) |
Changes the manager and chip to select.
| csm | A shared_ptr to the manager. It will be moved into this object. |
| chipId | A non-negative chip ID, or negative to be non-configured. |
| ChipSelectInvalidChip | The manager reports that the given chip ID is invalid. csm will be unchanged. |
Definition at line 78 of file ChipSelect.cpp.
|
inline |
This object evaluates to true if this object appears to be in a usable state.
Definition at line 119 of file ChipSelect.hpp.
|
noexcept |
Returns the object to the default constructed state of not having a manager or a valid chip ID.
Definition at line 92 of file ChipSelect.cpp.
Referenced by chipId(), duds::hardware::interface::PinConfiguration::getPinSetAndSelect(), and modify().
| std::unique_ptr< ChipAccess > duds::hardware::interface::ChipSelect::select | ( | ) |
Obtains an access object and selects the chip.
| ChipSelectBadManager | The ChipSelectManager, manager, is not set. This is normal when the default constructor is used. |
Definition at line 48 of file ChipSelect.cpp.
| void duds::hardware::interface::ChipSelect::select | ( | ChipAccess & | acc | ) |
Modifies a ChipAccess object to use the manager and chip specified within this object, and selects the chip.
| acc | The access object that will allow chip selection. |
| ChipSelectBadManager | The ChipSelectManager, manager, is not set. This is normal when the default constructor is used. |
Definition at line 56 of file ChipSelect.cpp.
|
private |
|
private |
The manager that will handle the selection.
Definition at line 28 of file ChipSelect.hpp.
Referenced by access(), haveManager(), manager(), modify(), reset(), and select().