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.
Dependencies: eye_r_eye-htpa32x32-v_1_8-ticker mbed
Fork of eye_r_eye-htpa32x32-v_1_8-ticker by
Diff: heimann32x32.cpp
- Revision:
- 2:270ef0ab1a2e
- Parent:
- 1:7fd5cc2052cf
--- a/heimann32x32.cpp Tue Mar 13 23:54:51 2018 +0000 +++ b/heimann32x32.cpp Thu Mar 15 13:16:22 2018 +0000 @@ -1,16 +1,15 @@ #include "mbed.h" #include "heimann32x32.h" - #include "heimann32x32_table.cpp" HTPA32x32::HTPA32x32(I2C * _i2c, I2C * _i2ce, uint8_t addr1, uint8_t addr2) { i2c = _i2c; - i2c->frequency(100000); + i2c->frequency(400000); //i2c->frequency(1000000); i2ce = _i2ce; - i2ce->frequency(100000); + i2ce->frequency(400000); i2c_addr_htpa = addr1; i2c_addr_eeprom = addr2; @@ -40,7 +39,7 @@ data_write[1] = m & TRIM1_ADC_MASK; i2c->write((int) i2c_addr_htpa, data_write, 2, 1); - + wait_ms(5); return mbit; } @@ -59,9 +58,12 @@ bias = m; data_write[1] = m & TRIM_BIAS_MASK; i2c->write(i2c_addr_htpa, data_write, 2, 1); + wait_ms(5); data_write[0] = HTP_TRIM3_BIAS2; i2c->write(i2c_addr_htpa, data_write, 2, 1); + wait_ms(5); + return bias; } @@ -80,6 +82,7 @@ data_write[1] = m & TRIM_FREQ_MASK; i2c->write(i2c_addr_htpa, data_write, 2, 1); + wait_ms(5); return clk; } @@ -98,6 +101,7 @@ pu = m<<4 | m; data_write[1] = pu; i2c->write(i2c_addr_htpa, data_write, 2, 1); + wait_ms(5); } return pu; @@ -118,10 +122,12 @@ bpa = m & TRIM_BPA_MASK; data_write[1] = bpa; i2c->write(i2c_addr_htpa, data_write, 2, 1); + wait_ms(5); data_write[0] = HTP_TRIM6_BPA2; i2c->write(i2c_addr_htpa, data_write, 2, 1); - + wait_ms(5); + return bpa; } @@ -178,6 +184,9 @@ void HTPA32x32::init( void ) { + char data_write[2] = { HTP_CONFIG, CONFIG_WAKEUP }; + i2c->write(i2c_addr_htpa, data_write, 2, 1); + uint8_t raw[5] = {0}; read_eeprom(HTP_EEPROM_CALIB_HI, HTP_EEPROM_CALIB_LO, (char *) raw, 5); mbit = raw[0]; @@ -201,7 +210,7 @@ return; } -uint8_t HTPA32x32::end ( ) +uint8_t HTPA32x32::eoc ( ) { uint8_t rval = HTP_STATUS; i2c->write(i2c_addr_htpa, (char *) &rval, 1, 1);