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.
Fork of DS1820 by
DS1820.h@4:adf4e7972d73, 2015-03-20 (annotated)
- Committer:
- hudakz
- Date:
- Fri Mar 20 10:07:22 2015 +0000
- Revision:
- 4:adf4e7972d73
- Parent:
- 0:433af64321d5
- Child:
- 7:4403a206e78a
Function to set temperature-to-digital conversion resolution added.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 0:433af64321d5 | 1 | #ifndef DS1820_H_ |
hudakz | 0:433af64321d5 | 2 | #define DS1820_H_ |
hudakz | 0:433af64321d5 | 3 | |
hudakz | 0:433af64321d5 | 4 | #include <OneWire.h> |
hudakz | 0:433af64321d5 | 5 | |
hudakz | 0:433af64321d5 | 6 | class DS1820 |
hudakz | 0:433af64321d5 | 7 | { |
hudakz | 0:433af64321d5 | 8 | OneWire oneWire; |
hudakz | 0:433af64321d5 | 9 | uint8_t present; |
hudakz | 0:433af64321d5 | 10 | uint8_t type_s; |
hudakz | 0:433af64321d5 | 11 | uint8_t data[12]; |
hudakz | 0:433af64321d5 | 12 | uint8_t addr[8]; |
hudakz | 0:433af64321d5 | 13 | float toFloat(uint16_t word); |
hudakz | 0:433af64321d5 | 14 | public: |
hudakz | 0:433af64321d5 | 15 | DS1820(PinName pin); |
hudakz | 0:433af64321d5 | 16 | DS1820(char model, PinName pin); |
hudakz | 0:433af64321d5 | 17 | bool begin(void); |
hudakz | 4:adf4e7972d73 | 18 | void setResolution(uint8_t res); |
hudakz | 0:433af64321d5 | 19 | void startConversion(void); |
hudakz | 0:433af64321d5 | 20 | float read(void); |
hudakz | 0:433af64321d5 | 21 | |
hudakz | 0:433af64321d5 | 22 | }; |
hudakz | 0:433af64321d5 | 23 | #endif /* DS1820_H_ */ |