code to access the AT30TSE75x temperature and E-prom device
Dependents: AT30TSE752TST AT30TSE752TST2
AT30TSE75x.h
- Committer:
- wbeaumont
- Date:
- 2017-01-13
- Revision:
- 0:7cb648bc5c2a
- Child:
- 1:c0db18a0c56b
File content as of revision 0:7cb648bc5c2a:
#ifndef AT30TSE75x_H #define AT30TSE75x_H #include "getVersion.h" #include "stdbool.h" #include "dev_interface_def.h" #include "I2CInterface.h" #define VERSION_AT30TSE75x_HDR "0.80" /** AT30TSE75x class. * Used for interfacing with a AT30TSE75x temperature sensor and ee-prom * For version 0.1 inital * It has to be used with the https://developer.mbed.org/users/wbeaumont/code/DevInterfaces/ package * This includes the "virtual" I2CInterface class that is the interface to the I2C device * An implementation of the I2Cinterface class for the MBED can be found at * https://developer.mbed.org/users/wbeaumont/code/I2Cinterfaces/ * ee-prom set / read not tested / implemented. * version 0.8 : read of temperature 12 bits, fixed configuration * read /write ee-prom * this code is only tested with the AT30TSE752 version ( 2 KBit version) * processor for the testing : FRDM-KL25Z * * (C) Wim Beaumont Universiteit Antwerpen 2016, 2017 * */ class AT30TSE75x : public virtual getVersion { uint8_t buffer[4]; int Taddr, Eaddr; // base address for temperature and eeprom int Esize; int resolution; protected: /** pointer to the I2C interface driver. */ I2CInterface* _i2c; public: AT30TSE75x (I2CInterface* i2cinterface, int device_address_bits, int eepromsize=2); int getTaddr(){ return Taddr;}; int getEaddr(){ return Eaddr;}; float get_temperature(int *error = 0); int set_config( int Nonvolatille=0 ); int read_config( int Nonvolatille=0, int *error = 0 ); // max lenght =16 for 1 page. If word =0 int read_eeprompage(char *data, uint8_t length, uint8_t word_addr, uint8_t page); int write_eeprompage(char *data, uint8_t length, uint8_t word_addr, uint8_t page); // read a single byte from ee prom int read_eeprombyte(char &data, uint8_t word_addr, uint8_t page); int write_eeprombyte(char data, uint8_t word_addr, uint8_t page); }; #endif