13 namespace duds {
namespace hardware {
namespace interface {
16 return selpins && selpins->exists((
unsigned int)chipId);
28 std::unique_ptr<DigitalPinSetAccess> &&dpsa,
29 std::uint32_t selectStates
31 if (!dpsa || !dpsa->havePins()) {
34 if (dpsa->size() > 32) {
38 std::unique_lock<std::mutex> lock(
block);
48 std::vector<DigitalPinCap> caps = dpsa->capabilities();
50 std::vector<DigitalPinConfig> conf;
51 conf.reserve(caps.size());
53 std::vector<DigitalPinCap>::const_iterator iter = caps.cbegin();
55 for (; iter != caps.cend(); ++pos, ++iter) {
57 if (!iter->canOutput()) {
67 dpsa->write(~selectStates & ((1 << dpsa->size()) - 1));
69 dpsa->modifyConfig(conf);
77 std::unique_ptr<DigitalPinSetAccess> &&dpsa,
78 std::uint32_t selectStates
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.
std::unique_ptr< DigitalPinSetAccess > selpins
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. ...
virtual bool validChip(int chipId) const noexcept
Valid IDs are those with a pin in the DigitalPinSetAccess object given to this manager.
boost::error_info< struct Info_PinId, unsigned int > PinErrorId
The pin global ID involved in the error.
std::mutex block
Used to synchonize access.
virtual void select()
Selects the chip identified by cid.
virtual void deselect()
Deselects the chip identified by cid.
std::uint32_t selstates
The select logic states for each pin.
int cid
Selected chip ID, or -1 to terminate.
A ChipSelectManager was given more pins to use than the implementation supports.
bool inUse() const
Returns true if an access object provided by this manager exists.
~ChipPinSetSelectManager()
Calls shutdown().
Indicates that a request to configure a pin to output was made of a pin that cannot output...
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 ea...
#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...
ChipPinSetSelectManager()
Default constructor.