Extended MaximInterface
Dependents: mbed_DS28EC20_GPIO
Diff: Devices/DS2413.hpp
- Revision:
- 8:211d1b8f730c
- Parent:
- 7:471901a04573
--- a/Devices/DS2413.hpp Tue Jul 24 08:33:31 2018 +0000 +++ b/Devices/DS2413.hpp Wed Apr 03 12:33:10 2019 +0000 @@ -36,10 +36,11 @@ #include <stdint.h> #include <MaximInterface/Links/SelectRom.hpp> #include <MaximInterface/Utilities/Export.h> +#include <MaximInterface/Utilities/FlagSet.hpp> namespace MaximInterface { -/// DS2413 1-Wire Dual Channel Addressable Switch +/// @brief DS2413 1-Wire Dual Channel Addressable Switch /// @details The DS2413 is a dual-channel programmable I/O 1-Wire® /// chip. The PIO outputs are configured as open-drain and provide up /// to 20mA continuous sink capability and off-state operating voltage @@ -53,17 +54,19 @@ public: enum ErrorValue { CommunicationError = 1 }; - struct Status { - bool pioAInputState; - bool pioAOutputState; - bool pioBInputState; - bool pioBOutputState; + enum StatusFlags { + PioAInputState = 0x1, + PioAOutputState = 0x2, + PioBInputState = 0x4, + PioBOutputState = 0x8 }; + typedef FlagSet<StatusFlags, 4> Status; DS2413(OneWireMaster & master, const SelectRom & selectRom) : selectRom(selectRom), master(&master) {} void setMaster(OneWireMaster & master) { this->master = &master; } + void setSelectRom(const SelectRom & selectRom) { this->selectRom = selectRom; } @@ -85,13 +88,13 @@ OneWireMaster * master; }; -/// @{ -/// Write the output logic state for only a single PIO pin. +/// Write the output logic state for only PIOA. MaximInterface_EXPORT error_code writePioAOutputState(DS2413 & ds2413, bool pioAState); + +/// Write the output logic state for only PIOB. MaximInterface_EXPORT error_code writePioBOutputState(DS2413 & ds2413, bool pioBState); -/// @} inline error_code make_error_code(DS2413::ErrorValue e) { return error_code(e, DS2413::errorCategory());