13 namespace duds {
namespace hardware {
namespace interface {
namespace test {
19 for (std::uint32_t pidx = 0; pidx < numpins; ++pidx) {
25 const std::vector<unsigned int> &ids,
28 std::vector<unsigned int>::const_iterator iter = ids.begin();
29 for (
unsigned int pid = 0; iter != ids.end(); ++iter, ++pid) {
36 const std::string &name
41 std::vector<unsigned int> gpios;
43 gpios.reserve(port.
pins.size());
44 for (
auto const &pin : port.
gidIndex()) {
48 gpios.insert(gpios.end(), pin.gid - next, -1);
51 gpios.push_back(pin.pid);
54 std::shared_ptr<VirtualPort> sp = std::make_shared<VirtualPort>(
73 pins[pid].markNonexistent();
77 pins[pid].cap.capabilities =
85 pins[pid].cap.maxOutputCurrent = 0;
126 const std::vector<unsigned int> &pvec,
131 std::vector<bool> outv;
132 outv.reserve(pvec.size());
134 for (
const unsigned int &gid : pvec) {
152 const std::vector<unsigned int> &pvec,
153 const std::vector<bool> &state,
157 std::vector<unsigned int>::const_iterator piter = pvec.begin();
158 std::vector<bool>::const_iterator siter = state.begin();
159 for (; piter != pvec.end(); ++piter, ++siter) {
const PinConfiguration::Pins::index< index_gid >::type & gidIndex() const
Convenience function that provides the pin global ID index for the port's pins.
static constexpr Flags Input
Input operation is supported.
static constexpr Flags DirMask
A bit mask for all direction flags.
unsigned int offset() const
Returns the offset for the port's pins.
unsigned int idOffset
The pin ID offset for the port; used to translate between global and port pin IDs.
static constexpr Flags DirInput
Configure the pin for input.
Defines the configuration for a digital general purpose I/O pin.
Holds configuration data for a single digital port.
unsigned int localId(unsigned int globalId) const
Returns the local ID for a pin given the global ID.
Pins pins
The pins described by the configuration file.
A type for holding arbitrary port-specific data within a DigitalPinAccess or DigitalPinSetAccess obje...
virtual void outputImpl(unsigned int lid, bool state, DigitalPinAccessBase::PortData *pdata)
Changes the output state of the given pin.
virtual bool simultaneousOperations() const
Simultaneous operations are supported; returns true.
virtual bool inputImpl(unsigned int gid, DigitalPinAccessBase::PortData *pdata)
Reads input from the given pin.
void attachPort(const std::shared_ptr< DigitalPort > &dp, const std::string &name="default")
Attaches the given DigitalPort to the named port in the configuration.
VirtualPort(unsigned int numpins, unsigned int firstid=0)
Make a VirtualPort object.
void shutdown()
Waits for access to all pins so that any user of access objects may finish with their operation...
Parses configuration data for DigitalPort, DigitalPin, DigitalPinSet, ChipSelectManager, and ChipSelect objects.
static std::shared_ptr< VirtualPort > makeConfiguredPort(PinConfiguration &pc, const std::string &name="default")
Make a VirtualPort object according to the given configuration, and attach to the configuration...
const Port & port(const std::string &name="default") const
Finds the configuration data for the named DigitalPort.
unsigned int size() const
The maximum number of pins on the port.
void initPin(std::uint32_t offset, unsigned int pid)
Initializes a PinEntry object.
static constexpr Flags OutputPushPull
The output can drive the line either low or high.
static constexpr Flags DirOutput
Configure the pin for output.
Flags options
The control options requested for a digital pin.
static constexpr Flags OutputState
The set output state for the pin.
A partial DigitalPort implementation for ports where the configuration of each pin is independent of ...
PinVector pins
Data on each pin handled by the port.
virtual void configurePort(unsigned int localPinId, const DigitalPinConfig &cfg, DigitalPinAccessBase::PortData *pdata)
Changes the hardware configuration for a single pin.
static constexpr Flags InputState
The last known input state from the pin.