Extended MaximInterface
Dependents: mbed_DS28EC20_GPIO
Diff: Devices/DS1920.hpp
- Revision:
- 6:a8c83a2e6fa4
- Parent:
- 0:f77ad7f72d04
- Child:
- 7:471901a04573
--- a/Devices/DS1920.hpp Fri Jan 19 10:25:02 2018 -0600 +++ b/Devices/DS1920.hpp Wed Jan 23 13:11:04 2019 -0600 @@ -35,6 +35,7 @@ #include <MaximInterface/Links/SelectRom.hpp> #include <MaximInterface/Links/Sleep.hpp> +#include <MaximInterface/Utilities/array_span.hpp> #include <MaximInterface/Utilities/Export.h> namespace MaximInterface { @@ -54,14 +55,15 @@ enum ErrorValue { CrcError = 1, DataError }; /// Holds the contents of the device scratchpad. - typedef array<uint_least8_t, 8> Scratchpad; + typedef array_span<uint_least8_t, 8> Scratchpad; - DS1920(const Sleep & sleep, OneWireMaster & master, - const SelectRom & selectRom) + DS1920(Sleep & sleep, OneWireMaster & master, const SelectRom & selectRom) : selectRom(selectRom), master(&master), sleep(&sleep) {} - void setSleep(const Sleep & sleep) { this->sleep = &sleep; } + void setSleep(Sleep & sleep) { this->sleep = &sleep; } + void setMaster(OneWireMaster & master) { this->master = &master; } + void setSelectRom(const SelectRom & selectRom) { this->selectRom = selectRom; } @@ -79,7 +81,7 @@ /// Read Scratchpad Command /// @param[out] scratchpad Contents of scratchpad. - MaximInterface_EXPORT error_code readScratchpad(Scratchpad & scratchpad); + MaximInterface_EXPORT error_code readScratchpad(Scratchpad::span scratchpad); /// Copy Scratchpad Command /// @details This command copies from the scratchpad into the @@ -105,7 +107,7 @@ }; /// Reads the current temperature as an integer value. -/// @param[out] temperature Temperature in degrees Celsius multiplied by 16. +/// @param[out] temperature Temperature in degrees Celsius multiplied by 2. MaximInterface_EXPORT error_code readTemperature(DS1920 & ds1920, int & temperature);