1
+ /* !
2
+ * @file model.h
3
+ *
4
+ * Hardware implementation for the ds18x20.proto message.
5
+ *
6
+ * Adafruit invests time and resources providing this open source code,
7
+ * please support Adafruit and open-source hardware by purchasing
8
+ * products from Adafruit!
9
+ *
10
+ * Copyright (c) Brent Rubell 2024 for Adafruit Industries.
11
+ *
12
+ * BSD license, all text here must be included in any redistribution.
13
+ *
14
+ */
15
+ #ifndef WS_DS18X20_HARDWARE_H
16
+ #define WS_DS18X20_HARDWARE_H
17
+ #include " Wippersnapper_V2.h"
18
+ #include < DallasTemperature.h>
19
+
20
+ struct DS18X20_Pin {
21
+ // Specific to the DS18X20 sensor object
22
+ OneWire
23
+ *oneWire; // /< Ptr reference to the OneWire bus object used by this pin
24
+ DallasTemperature
25
+ *dallasTempObj; // /< Pointer to a DallasTemperature sensor object
26
+ DeviceAddress dallasTempAddr; // /< Temperature sensor's address
27
+ // From the PB model
28
+ char onewire_pin[5 ]; // /< Pin utilized by the OneWire bus, used for addressing
29
+ float period; // /< The desired period to read the sensor, in seconds
30
+ float prv_period; // /< Last time the sensor was polled, in seconds
31
+ pb_size_t
32
+ sensor_types_count; // /< Number of sensor types to read from the sensor
33
+ wippersnapper_sensor_SensorType
34
+ sensor_types[2 ]; // /< DS sensor type(s) to read from the sensor
35
+ }; // /< DS18X20 Pin Object
36
+
37
+ /* *************************************************************************/
38
+ /* !
39
+ @brief Interface for interacting with the's DallasTemp
40
+ and OneWire APIs.
41
+ */
42
+ /* *************************************************************************/
43
+ class DS18X20Hardware {
44
+ public:
45
+ DS18X20Hardware ();
46
+ ~DS18X20Hardware ();
47
+
48
+ private:
49
+ std::vector<DS18X20_Pin> _DS18X20_Pins; // /< Vector of analogio pins
50
+ };
51
+ #endif // WS_DS18X20_HARDWARE_H
0 commit comments