10 #ifndef CHIPACCESS_HPP 11 #define CHIPACCESS_HPP 15 namespace duds {
namespace hardware {
namespace interface {
34 std::shared_ptr<ChipSelectManager>
manager;
39 ChipAccess(
const std::shared_ptr<ChipSelectManager> &m) : manager(m) { }
56 manager->retire(
this);
89 manager->changeChip(chipId);
96 #endif // #ifndef CHIPACCESS_HPP
void changeChip(int chipId)
Changes the chip in use while not giving up access to the chip selector.
ChipAccess()
Makes a ChipAccess object that has no access.
An object used to provide chip select control to a single user at a time.
void deselect()
Deselects the chip.
std::unique_ptr< ChipAccess > access(int chipId)
Acquires access to the requested chip and issues a ChipAccess object.
~ChipAccess()
Relinquishes access.
void retire()
Relinquish access.
ChipAccess(const std::shared_ptr< ChipSelectManager > &m)
Constructs a ChipAccess object for use with the given manager.
void select()
Selects the chip.
std::shared_ptr< ChipSelectManager > manager
The manager to which this object is attached.