CC2541 SensorTag Quick Start Guide
在属性列表中按级别显示服务,特性和属性,暂不详述。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/************************************************************************************************** * @fn HalIRTempRead * * @brief Read the sensor voltage and sensor temperature registers * * @param Voltage and temperature in raw format (2 + 2 bytes) * * @return TRUE if valid data **************************************************************************************************/ bool HalIRTempRead(uint8 *pBuf) { uint16 v; uint16 t; bool success; if (irtSensorState != TMP006_DATA_READY) { return FALSE; } HalIRTempSelect(); // Read the sensor registers success = HalSensorReadReg(TMP006_REG_ADDR_VOLTAGE, (uint8 *)&v,IRTEMP_REG_LEN ); if (success) { success = HalSensorReadReg(TMP006_REG_ADDR_TEMPERATURE, (uint8 *)&t,IRTEMP_REG_LEN ); } if (success) { // Store values pBuf[0] = HI_UINT16( v ); pBuf[1] = LO_UINT16( v ); pBuf[2] = HI_UINT16( t ); pBuf[3] = LO_UINT16( t ); } // Turn off sensor if (HalSensorWriteReg(TMP006_REG_ADDR_CONFIG, configSensorOff, IRTEMP_REG_LEN)) { irtSensorState = TMP006_OFF; } HalDcDcControl(ST_IRTEMP, false ); return success; } <span>上面代码中在SensorTag.c中直接调用了:</span> |
1
2
3
4
5
6
7
8
9
|
static void readIrTempData( void ) { uint8 tData[IRTEMPERATURE_DATA_LEN]; if (HalIRTempRead(tData)) { IRTemp_SetParameter( IRTEMPERATURE_DATA, IRTEMPERATURE_DATA_LEN, tData); } } |
而在在源文件hal_irtemp.c中有这样一段代码是注释掉的没有使用:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/* Conversion algorithm for die temperature * ================================================ * double calcTmpLocal(uint16 rawT) { //-- calculate die temperature [癈] -- m_tmpAmb = (double)((qint16)rawT)/128.0; return m_tmpAmb; } * * Conversion algorithm for target temperature * double calcTmpTarget(uint16 rawT) { //-- calculate target temperature [癈] - double Vobj2 = (double)(qint16)rawT; Vobj2 *= 0.00000015625; double Tdie2 = m_tmpAmb + 273.15; const double S0 = 6.4E-14; // Calibration factor const double a1 = 1.75E-3; const double a2 = -1.678E-5; const double b0 = -2.94E-5; const double b1 = -5.7E-7; const double b2 = 4.63E-9; const double c2 = 13.4; const double Tref = 298.15; double S = S0*(1+a1*(Tdie2 - Tref)+a2*pow((Tdie2 - Tref),2)); double Vos = b0 + b1*(Tdie2 - Tref) + b2*pow((Tdie2 - Tref),2); double fObj = (Vobj2 - Vos) + c2*pow((Vobj2 - Vos),2); double tObj = pow(pow(Tdie2,4) + (fObj/S),.25); tObj = (tObj - 273.15); return tObj; } */ |
而BLE Device Monitor软件好像没有源代码,不知道怎么处理的。各位使用iPAD什么的,里面有关于校准的选项么?