Example : I2C

I2C components of OSS-EC

In this section, we will use the OSS-EC I2C component ( TI HDC1080 ) as an example.

  • Block diagram of I2C components and OSS-EC software ( fig.1 )
  • Application state transition of I2C components ( fig.2)
  • API ( fig.3 )
  • Architecture of PCMP ( fig.4 )

Blue label characters are data related to components.
Red label characters are data related to application.
Green label characters are data related to the circuit.

res.sts == iPowerOn_Reset_Fin is Normal Fin of Power ON Reset.
res.sts == iSW_Reset_Fin is Normal Fin of Software Reset.
res.sts == iMeasurement_Fin is Normal Fin of Measurement.
cmd.cnf == iREG_conf_measu is configuration of non-heater measurement.
cmd.cnf == iREG_conf_heat is configuration of heater measurement.
HDC1080.temp < iTemp_low is low temperature.
HDC1080.temp > iTemp_low is high temperature.
res.ic_reg[iRes_pos_conf] && iBTST == 0 is high battery voltage.
res.ic_reg[iRes_pos_conf] && iBTST == 1 is low battery voltage.
HDC1080.diag == iError occurs when any of the following conditions are met.
1) res.sp_dia == iError Count iError_times times in a row. // SP layer error ?
2) res.cp_dia == iError Count iError_times times in a row. // CP layer error ?
3) res.mp_dia == iError Count iError_times times in a row. // MP layer error ?

Note : If Diag==iError still occurs after several times of Software Reset, please set a State such as Sleep.

Structure nameTypeStructure membersData meaning
HDC1080floattempTemperature [degree Celsius]
floathumiHumidity [%RH]
unsigned shortdiagDiagnostic result
unsigned shortmanu_idManufacturer ID
unsigned shortdevi_idDevide ID
unsigned long longseri_idSerial ID
cmdunsigned shorticIC model number of OSS-EC
unsigned shortcmdCommand of OSS-EC
reg_type*cnf[iReg_cnf_num]Configration register value of command
resunsigned shortstsPCMP status
unsigned shortsp_diaSP diagnostic result
unsigned shortcp_diaCP diagnostic result
unsigned shortmp_diaMP diagnostic result
floatphy_val[iPhy_type_numSensor physical value
phy_val[0] temperature [degree Celsius]
phy_val[1] humidity [%RH]
reg_type*ic_reg[iReg_num]register value
res.ic_reg[iRes_pos_temp] temperature
res.ic_reg[iRes_pos_humi] humidity
res.ic_reg[iRes_pos_conf] configuration
res.ic_reg[iRes_pos_seri1] Serial ID first
res.ic_reg[iRes_pos_seri2] Serial ID mid
res.ic_reg[iRes_pos_seri3] Serial ID last
res.ic_reg[iRes_pos_manu] Manufacturer ID
res.ic_reg[iRes_pos_devi] Device ID

reg_type : unsigned short : HDC1080 register length 16bit