interface for the temperature sensor chip adt7320, with sw SPI interface
adt7320.h@4:ee71e7bca786, 2015-10-23 (annotated)
- Committer:
- wbeaumont
- Date:
- Fri Oct 23 11:23:08 2015 +0000
- Revision:
- 4:ee71e7bca786
- Parent:
- 3:49638acbc5d4
production version archiving
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wbeaumont | 0:e252ae2774e8 | 1 | #ifndef ADT7320_H |
wbeaumont | 0:e252ae2774e8 | 2 | #define ADT7320_H |
wbeaumont | 0:e252ae2774e8 | 3 | |
wbeaumont | 0:e252ae2774e8 | 4 | /* |
wbeaumont | 3:49638acbc5d4 | 5 | * class to read the adt7320 temperature sensor via SPI |
wbeaumont | 3:49638acbc5d4 | 6 | * |
wbeaumont | 3:49638acbc5d4 | 7 | * v1.20 implemented float temperature readout |
wbeaumont | 3:49638acbc5d4 | 8 | * |
wbeaumont | 4:ee71e7bca786 | 9 | * (C) Wim Beaumont Univeristeit Antwerpen 2014 , 2015 |
wbeaumont | 3:49638acbc5d4 | 10 | */ |
wbeaumont | 0:e252ae2774e8 | 11 | |
wbeaumont | 0:e252ae2774e8 | 12 | #include "solid_sctrl_def.h" |
wbeaumont | 1:1b9f706b8abc | 13 | #include "getVersion.h" |
wbeaumont | 0:e252ae2774e8 | 14 | #include "SWSPI.h" |
wbeaumont | 0:e252ae2774e8 | 15 | |
wbeaumont | 3:49638acbc5d4 | 16 | #define ADT7320_HDR_VER "1.20" |
wbeaumont | 1:1b9f706b8abc | 17 | |
wbeaumont | 1:1b9f706b8abc | 18 | class adt7320 : public getVersion{ |
wbeaumont | 0:e252ae2774e8 | 19 | |
wbeaumont | 0:e252ae2774e8 | 20 | void set_spi_mode(u8 nrbyte); |
wbeaumont | 1:1b9f706b8abc | 21 | |
wbeaumont | 1:1b9f706b8abc | 22 | private: |
wbeaumont | 1:1b9f706b8abc | 23 | SWSPI* spi; |
wbeaumont | 1:1b9f706b8abc | 24 | DigitalOut* cs; |
wbeaumont | 0:e252ae2774e8 | 25 | |
wbeaumont | 1:1b9f706b8abc | 26 | u8 format_cmd( u8 reg, bool rw); |
wbeaumont | 1:1b9f706b8abc | 27 | u8 getR08( u8 addr); |
wbeaumont | 1:1b9f706b8abc | 28 | void setR08( u8 addr, u8 datain); |
wbeaumont | 1:1b9f706b8abc | 29 | u16 getR16( u8 addr); |
wbeaumont | 1:1b9f706b8abc | 30 | void setR16( u8 addr, u16 datain); |
wbeaumont | 3:49638acbc5d4 | 31 | u8 Tmode ; |
wbeaumont | 1:1b9f706b8abc | 32 | |
wbeaumont | 0:e252ae2774e8 | 33 | public: |
wbeaumont | 0:e252ae2774e8 | 34 | |
wbeaumont | 0:e252ae2774e8 | 35 | adt7320(SWSPI *spiinterface ,DigitalOut* chipselect ); |
wbeaumont | 3:49638acbc5d4 | 36 | float getTemperature(); |
wbeaumont | 0:e252ae2774e8 | 37 | u8 getId(); |
wbeaumont | 0:e252ae2774e8 | 38 | u16 get_TcritSP(); |
wbeaumont | 1:1b9f706b8abc | 39 | void set_TcritSP(u16 tcrit); |
wbeaumont | 0:e252ae2774e8 | 40 | u16 get_T(); // get the temperature register |
wbeaumont | 1:1b9f706b8abc | 41 | u16 get_hdr_ver();// returns the hdr version nr |
wbeaumont | 1:1b9f706b8abc | 42 | u16 get_src_ver();// returns the src version nr |
wbeaumont | 1:1b9f706b8abc | 43 | void init1(); |
wbeaumont | 1:1b9f706b8abc | 44 | void init2(); |
wbeaumont | 2:2b886cea4fcb | 45 | void serial_line_rst(); |
wbeaumont | 1:1b9f706b8abc | 46 | |
wbeaumont | 0:e252ae2774e8 | 47 | }; |
wbeaumont | 0:e252ae2774e8 | 48 | |
wbeaumont | 0:e252ae2774e8 | 49 | |
wbeaumont | 0:e252ae2774e8 | 50 | |
wbeaumont | 0:e252ae2774e8 | 51 | |
wbeaumont | 0:e252ae2774e8 | 52 | #endif |