Dallas' DS1820 family temperature sensor using mbed debug logs.
Fork of DS1820 by
DS1820.h@15:8b82d53770df, 2018-04-28 (annotated)
- Committer:
- lucian@Lucians-MacBook-Pro.local
- Date:
- Sat Apr 28 19:26:09 2018 +0300
- Revision:
- 15:8b82d53770df
- Parent:
- 14:cb585e978f8d
- Child:
- 16:0764e4de41d2
IEM-396 Disable debug logs
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 0:433af64321d5 | 1 | #ifndef DS1820_H_ |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 2 | #define DS1820_H_ |
hudakz | 0:433af64321d5 | 3 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 4 | #include <OneWire.h> |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 5 | #include "mbed_debug.h" |
hudakz | 0:433af64321d5 | 6 | |
lucian@Lucians-MacBook-Pro.local | 15:8b82d53770df | 7 | #define DEBUG 0 |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 8 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 9 | class DS1820 { |
hudakz | 0:433af64321d5 | 10 | OneWire oneWire; |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 11 | bool present; |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 12 | bool model_s; |
hudakz | 0:433af64321d5 | 13 | uint8_t data[12]; |
hudakz | 0:433af64321d5 | 14 | uint8_t addr[8]; |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 15 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 16 | float toFloat(uint16_t word); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 17 | |
hudakz | 0:433af64321d5 | 18 | public: |
hudakz | 7:4403a206e78a | 19 | |
hudakz | 0:433af64321d5 | 20 | DS1820(PinName pin); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 21 | |
hudakz | 0:433af64321d5 | 22 | DS1820(char model, PinName pin); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 23 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 24 | bool begin(void); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 25 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 26 | bool isPresent(); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 27 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 28 | void setResolution(uint8_t res); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 29 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 30 | void startConversion(void); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 31 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 32 | uint8_t read_uint16(uint16_t &temp); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 33 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 34 | uint8_t read(float &temp); |
hudakz | 0:433af64321d5 | 35 | }; |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 36 | |
hudakz | 0:433af64321d5 | 37 | #endif /* DS1820_H_ */ |