Dallas' DS1820 family temperature sensor using mbed debug logs.
Fork of DS1820 by
DS1820.h@17:325cd3a6cbbb, 2018-05-02 (annotated)
- Committer:
- Lucian Corduneanu
- Date:
- Wed May 02 14:18:08 2018 +0300
- Revision:
- 17:325cd3a6cbbb
- Parent:
- 16:0764e4de41d2
Remove OneWire dependency
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 | |
hudakz | 0:433af64321d5 | 16 | public: |
hudakz | 7:4403a206e78a | 17 | |
hudakz | 0:433af64321d5 | 18 | DS1820(PinName pin); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 19 | |
hudakz | 0:433af64321d5 | 20 | DS1820(char model, PinName pin); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 21 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 22 | bool begin(void); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 23 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 24 | bool isPresent(); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 25 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 26 | void setResolution(uint8_t res); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 27 | |
lucian@Lucians-MacBook-Pro.local | 16:0764e4de41d2 | 28 | virtual void startConversion(void); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 29 | |
lucian@Lucians-MacBook-Pro.local | 16:0764e4de41d2 | 30 | virtual uint8_t readRaw(uint16_t &temp); |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 31 | |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 32 | uint8_t read(float &temp); |
lucian@Lucians-MacBook-Pro.local | 16:0764e4de41d2 | 33 | |
lucian@Lucians-MacBook-Pro.local | 16:0764e4de41d2 | 34 | protected: |
lucian@Lucians-MacBook-Pro.local | 16:0764e4de41d2 | 35 | float toFloat(uint16_t word); |
hudakz | 0:433af64321d5 | 36 | }; |
lucian@Lucians-MacBook-Pro.local | 14:cb585e978f8d | 37 | |
hudakz | 0:433af64321d5 | 38 | #endif /* DS1820_H_ */ |