Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: DeepCover Embedded Security in IoT MaximInterface MAXREFDES155#
Diff: Devices/DS18B20.hpp
- Revision:
- 5:a8c83a2e6fa4
- Parent:
- 0:f77ad7f72d04
- Child:
- 6:471901a04573
diff -r caf56f265a13 -r a8c83a2e6fa4 Devices/DS18B20.hpp
--- a/Devices/DS18B20.hpp Fri Jan 19 10:25:02 2018 -0600
+++ b/Devices/DS18B20.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 {
@@ -58,14 +59,15 @@
static const uint_least8_t twelveBitResolution = 0x7F;
/// Holds the contents of the device scratchpad.
- typedef array<uint_least8_t, 8> Scratchpad;
+ typedef array_span<uint_least8_t, 8> Scratchpad;
- DS18B20(const Sleep & sleep, OneWireMaster & master,
- const SelectRom & selectRom)
+ DS18B20(Sleep & sleep, OneWireMaster & master, const SelectRom & selectRom)
: selectRom(selectRom), master(&master), sleep(&sleep), resolution(0) {}
- 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;
}
@@ -88,7 +90,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
@@ -123,7 +125,7 @@
};
/// Reads the current temperature as an integer value with decimal.
-/// @param[out] temperature Temperature in degrees Celsius multiplied by 2.
+/// @param[out] temperature Temperature in degrees Celsius multiplied by 16.
MaximInterface_EXPORT error_code readTemperature(DS18B20 & ds18b20,
int & temperature);