13 namespace duds {
namespace hardware {
namespace interface {
16 return selpin && (chipId == 1);
28 std::unique_ptr<DigitalPinAccess> &&dpa,
31 if (!dpa || !dpa->havePin()) {
35 std::unique_lock<std::mutex> lock(
block);
47 if (!cap.canOutput()) {
53 dpa->output(!selectState);
63 std::unique_ptr<DigitalPinAccess> &&dpa,
boost::error_info< struct Info_ChipId, int > ChipSelectIdError
The chip select ID relavent to the error.
Defines the configuration for a digital general purpose I/O pin.
SelectState
The list of possible pin states that can be used to select a chip.
std::unique_ptr< DigitalPinAccess > selpin
The access object for the select pin.
move_impl move(unsigned int c, unsigned int r)
Display stream manipulator that moves the display cursor to the given location.
A pin required for the operation does not exist or is unavailable to the process. ...
boost::error_info< struct Info_PinId, unsigned int > PinErrorId
The pin global ID involved in the error.
std::mutex block
Used to synchonize access.
Flags capabilities
The capabilities of a digital pin.
virtual bool validChip(int chipId) const noexcept
The only valid chip ID for this manager is 1, and it is only valid once a DigitalPinAccess object has...
~ChipPinSelectManager()
Calls shutdown().
SelectState selstate
True when the chip is selected with a high logic level.
bool inUse() const
Returns true if an access object provided by this manager exists.
void setSelectPin(std::unique_ptr< DigitalPinAccess > &&dpa, SelectState selectState=SelectLow)
Sets the DigitalPinAccess object to use for the chip select line.
ChipPinSelectManager()
Default constructor.
Defines the capabilites of a digital general purpose I/O pin.
#define DUDS_THROW_EXCEPTION(x)
Works like BOOST_THROW_EXCEPTION, but includes a stack trace if DUDS_ERRORS_VERBOSE is defined...
virtual void deselect()
Deselects the chip identified by cid.
void shutdown()
Waits on a ChipAccess object if one is in use, then begins forcing any threads waiting on access to w...
virtual void select()
Selects the chip identified by cid.
An attempt was made to change the set of valid chips or exactly how a particluar chip might be select...