12 namespace duds {
namespace hardware {
namespace interface {
15 std::unique_ptr<DigitalPinSetAccess> &&acc
22 return (chipId > 0) && (chipId < (1 <<
outacc->size()));
28 std::unique_ptr<DigitalPinSetAccess> &&acc
30 if (!acc || !acc->havePins()) {
34 std::unique_lock<std::mutex> lock(
block);
44 std::vector<DigitalPinCap> caps = acc->capabilities();
46 std::vector<DigitalPinConfig> conf;
47 conf.reserve(caps.size());
49 std::vector<DigitalPinCap>::const_iterator iter = caps.cbegin();
51 for (; iter != caps.cend(); ++pos, ++iter) {
53 if (!iter->canOutput()) {
64 acc->modifyConfig(conf);
70 std::unique_ptr<DigitalPinSetAccess>
73 std::unique_lock<std::mutex> lock(
block);
87 outacc->write((std::int32_t)0);
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.
virtual void select()
Selects the chip identified by cid.
void setAccess(std::unique_ptr< DigitalPinSetAccess > &&acc)
Sets the access object used to output the number of the chip to select.
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.
std::unique_ptr< DigitalPinSetAccess > outacc
Access used for parallel output.
virtual void deselect()
Deselects the chip identified by cid.
std::unique_ptr< DigitalPinSetAccess > releaseAccess()
Returns the access object that was used by this chip select manager.
int cid
Selected chip ID, or -1 to terminate.
ChipMultiplexerSelectManager()=default
Default constructor.
virtual bool validChip(int chipId) const noexcept
Valid chip IDs are greater than zero and can be represented in the same number of bits as there are p...
bool inUse() const
Returns true if an access object provided by this manager exists.
Indicates that a request to configure a pin to output was made of a pin that cannot output...
#define DUDS_THROW_EXCEPTION(x)
Works like BOOST_THROW_EXCEPTION, but includes a stack trace if DUDS_ERRORS_VERBOSE is defined...
An attempt was made to change the set of valid chips or exactly how a particluar chip might be select...