OB1203 basic mbed driver
Diff: OB1203.cpp
- Revision:
- 21:ae0672135b9e
- Parent:
- 20:8d69cd11b8fa
--- a/OB1203.cpp Fri Mar 08 23:58:41 2019 +0000 +++ b/OB1203.cpp Mon Jul 29 17:26:22 2019 +0000 @@ -175,6 +175,7 @@ char writeData[2]; writeData[0] = ppg_ps_gain | ppg_LED_settling | ppg_ALC_track; writeData[1] = ppg_pow_save | led_flip | sig_out | diff | alc; + pc.printf("0x2F to write : %02X\r\n",writeData[1]); writeBlock(OB1203_ADDR,REG_PPG_PS_GAIN,writeData,2); } @@ -302,6 +303,7 @@ setIntConfig(); setPSthresh(); setPScurrent(); + setPPG_PSgain_cfg(); setLSthresh(); ls_en = LS_ON; ppg_ps_en = PPG_PS_ON; @@ -474,6 +476,32 @@ } +void OB1203::print_part_xy(void) +{ + char data_buf[2]; + readBlock(OB1203_ADDR,REG_USER_CFG_0,data_buf,2); + pc.printf("x = %d, y = %d\r\n",data_buf[0],data_buf[1]); +} + + +void OB1203::enter_test_mode(void) +{ + char write_buf[1]; + write_buf[0] = 0xB5; + writeBlock(OB1203_ADDR,REG_TEST_CTRL_0,write_buf,1); + write_buf[0] = 0xDF; + writeBlock(OB1203_ADDR,REG_TEST_CTRL_1,write_buf,1); +} + + +void OB1203::exit_test_mode(void) +{ + char write_buf[1]; + write_buf[0] = 0x00; + writeBlock(OB1203_ADDR,REG_TEST_CTRL_0,write_buf,1); +} + + void OB1203::do_agc(uint32_t data, bool ch) { const uint32_t tol1 = TOL1;