code to access the AT30TSE75x temperature and E-prom device
Dependents: AT30TSE752TST AT30TSE752TST2
Diff: AT30TSE75x.cpp
- Revision:
- 1:c0db18a0c56b
- Parent:
- 0:7cb648bc5c2a
- Child:
- 2:91836ad02096
diff -r 7cb648bc5c2a -r c0db18a0c56b AT30TSE75x.cpp --- a/AT30TSE75x.cpp Fri Jan 13 12:11:55 2017 +0000 +++ b/AT30TSE75x.cpp Tue Jan 17 13:43:08 2017 +0000 @@ -10,10 +10,11 @@ */ -#define VERSION_AT30TSE75x_SRC "0.80" +#define VERSION_AT30TSE75x_SRC "0.86" #define AT30TSE75X_ADD_TEMP 0x48 /*Temperature Sensor: 0b1001xxx */ #define AT30TSE75X_ADD_EEPROM 0x50 /*EEPROM: 0b1010xxx */ +#define AT30TSE75X_FIX_EEPROM 0x62 /*fix EEPROM 0b01100010 ( last 0 = W) */ #define AT30TSE752 1 #define AT30TSE754 2 #define AT30TSE758 3 @@ -173,4 +174,20 @@ int AT30TSE75x::write_eeprombyte(char data, uint8_t word_addr, uint8_t page){ char wbuf[2]; wbuf[0]=data; return write_eeprompage(wbuf,1,word_addr,page); - } \ No newline at end of file + } + +int AT30TSE75x::protect_eeprom(void) { + char wbuf[2]; wbuf[0]=0;wbuf[1]=0; // don't care + return _i2c->write(AT30TSE75X_FIX_EEPROM ,wbuf,2,false); +} + +int AT30TSE75x::unprotect_eeprom(void) { + char wbuf[2]; wbuf[0]=0;wbuf[1]=0; // don't care + return _i2c->write((0x4 | AT30TSE75X_FIX_EEPROM) ,wbuf,2,false); +} + +int AT30TSE75x::get_eeprom_protec(void){ + char wbuf[2]; + return _i2c->read(AT30TSE75X_FIX_EEPROM ,wbuf,1,false); +} + \ No newline at end of file