13 namespace duds {
namespace hardware {
namespace interface {
16 return selpin && (chipId >= 0) && (chipId <= 1);
28 std::unique_ptr<DigitalPinAccess> &&dpa,
35 std::unique_lock<std::mutex> lock(
block);
47 if (!cap.canOutput()) {
53 dpa->output(initSel > 0);
76 std::unique_ptr<DigitalPinAccess> &&dpa,
int initSel
std::unique_ptr< DigitalPinAccess > selpin
The access object for the select pin.
boost::error_info< struct Info_ChipId, int > ChipSelectIdError
The chip select ID relavent to the error.
static constexpr Flags OutputDriveLow
The output is or can be an open collector or open drain type.
Defines the configuration for a digital general purpose I/O pin.
move_impl move(unsigned int c, unsigned int r)
Display stream manipulator that moves the display cursor to the given location.
virtual bool validChip(int chipId) const noexcept
The only valid chip IDs for this manager are 0 and 1, and they are only valid once a DigitalPinAccess...
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.
static constexpr Flags OutputPushPull
Configure the pin to drive output both high and low.
std::mutex block
Used to synchonize access.
Flags capabilities
The capabilities of a digital pin.
static constexpr Flags OutputDriveLow
Configure the pin to be able to drive the output low.
~ChipBinarySelectManager()
Calls shutdown().
static constexpr Flags OutputDriveHigh
Configure the pin to be able to drive the output high.
int cid
Selected chip ID, or -1 to terminate.
void setSelectPin(std::unique_ptr< DigitalPinAccess > &&dpa, int initSel=0)
Sets the DigitalPinAccess object to use for the chip select line.
virtual void deselect()
Deselects the chip identified by cid.
ChipBinarySelectManager()
Default constructor.
bool inUse() const
Returns true if an access object provided by this manager exists.
static constexpr Flags OutputPushPull
The output can drive the line either low or high.
Indicates that a request to configure a pin to output was made of a pin that cannot output...
static constexpr Flags DirOutput
Configure the pin for output.
Defines the capabilites of a digital general purpose I/O pin.
virtual void select()
Selects the chip identified by cid.
#define DUDS_THROW_EXCEPTION(x)
Works like BOOST_THROW_EXCEPTION, but includes a stack trace if DUDS_ERRORS_VERBOSE is defined...
void shutdown()
Waits on a ChipAccess object if one is in use, then begins forcing any threads waiting on access to w...
An attempt was made to change the set of valid chips or exactly how a particluar chip might be select...