DUDS
Distributed Update of Data from Something
ChipPinSetSelectManager.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of the DUDS project. It is subject to the BSD-style
3  * license terms in the LICENSE file found in the top-level directory of this
4  * distribution and at https://github.com/jjackowski/duds/blob/master/LICENSE.
5  * No part of DUDS, including this file, may be copied, modified, propagated,
6  * or distributed except according to the terms contained in the LICENSE file.
7  *
8  * Copyright (C) 2018 Jeff Jackowski
9  */
12 
13 namespace duds { namespace hardware { namespace interface {
14 
35  std::unique_ptr<DigitalPinSetAccess> selpins;
39  std::uint32_t selstates;
40 protected:
41  virtual void select();
42  virtual void deselect();
43 public:
47  ChipPinSetSelectManager() : selstates(0) { };
68  std::unique_ptr<DigitalPinSetAccess> &&dpsa,
69  std::uint32_t selectStates = 0
70  );
75  virtual bool validChip(int chipId) const noexcept;
92  void setSelectPins(
93  std::unique_ptr<DigitalPinSetAccess> &&dpsa,
94  std::uint32_t selectStates = 0
95  );
96 };
97 
98 } } }
99 
Selects a single chip at a time using one pin from a set.
std::unique_ptr< DigitalPinSetAccess > selpins
The access object for the select pin.
virtual bool validChip(int chipId) const noexcept
Valid IDs are those with a pin in the DigitalPinSetAccess object given to this manager.
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.
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...
The base class for all chip selection managers, the classes that handle the output state to select a ...