DUDS
Distributed Update of Data from Something
ChipPinSelectManager.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) 2017 Jeff Jackowski
9  */
12 
13 namespace duds { namespace hardware { namespace interface {
14 
35  std::unique_ptr<DigitalPinAccess> selpin;
36 public:
40  enum SelectState {
53  };
54 protected:
55  virtual void select();
56  virtual void deselect();
61 public:
65  ChipPinSelectManager() : selstate(SelectLow) { };
81  std::unique_ptr<DigitalPinAccess> &&dpa,
82  SelectState selectState = SelectLow
83  );
88  virtual bool validChip(int chipId) const noexcept;
99  void setSelectPin(
100  std::unique_ptr<DigitalPinAccess> &&dpa,
101  SelectState selectState = SelectLow
102  );
103 };
104 
105 } } }
106 
Indicates the chip is selected when the pin is driven low, or doesn&#39;t drive the line if the output ty...
SelectState
The list of possible pin states that can be used to select a chip.
std::unique_ptr< DigitalPinAccess > selpin
The access object for the select pin.
virtual bool validChip(int chipId) const noexcept
The only valid chip ID for this manager is 1, and it is only valid once a DigitalPinAccess object has...
SelectState selstate
True when the chip is selected with a high logic level.
void setSelectPin(std::unique_ptr< DigitalPinAccess > &&dpa, SelectState selectState=SelectLow)
Sets the DigitalPinAccess object to use for the chip select line.
Selects a single chip using a single pin.
virtual void deselect()
Deselects the chip identified by cid.
virtual void select()
Selects the chip identified by cid.
The base class for all chip selection managers, the classes that handle the output state to select a ...
Indicates the chip is selected when the pin is driven high, or doesn&#39;t drive the line if the output t...