interface for the temperature sensor chip adt7320, with sw SPI interface

Dependents:   SPItest sscm

adt7320.h

Committer:
wbeaumont
Date:
2014-10-14
Revision:
2:2b886cea4fcb
Parent:
1:1b9f706b8abc
Child:
3:49638acbc5d4

File content as of revision 2:2b886cea4fcb:

#ifndef ADT7320_H
#define ADT7320_H

/* 

 adt7320 interface 

*/
#include "solid_sctrl_def.h" 
#include "getVersion.h"
#include "SWSPI.h"

#define ADT7320_HDR_VER "1.14" 

class adt7320 : public getVersion{

void set_spi_mode(u8 nrbyte);

private:
    SWSPI* spi;
    DigitalOut* cs;
    
    u8   format_cmd( u8 reg, bool rw);
    u8   getR08( u8 addr);
    void setR08( u8 addr, u8 datain);
    u16  getR16( u8 addr);
    void  setR16( u8 addr, u16 datain);
        
public:

    adt7320(SWSPI *spiinterface ,DigitalOut* chipselect );
    float getTemperature(){return -280;};    // to be implenented 
    u8  getId();
    u16 get_TcritSP();
    void set_TcritSP(u16 tcrit);
    u16 get_T(); //  get the temperature register
    u16 get_hdr_ver();// returns the hdr version nr 
    u16 get_src_ver();// returns the src version nr 
    void init1();
    void init2();
    void serial_line_rst();
   
};




#endif