#include "hx3695_spo2_agc.h"\r
#include "hx3695_factory_test.h"\r
#include "power_display_service.h"\r
+#include "efuse.h"\r
+#include "mag_service.h"\r
+\r
\r
#pragma pack(1)\r
typedef struct factorytest_cmd_header_t\r
if(ble_hrs_flag == 1)\r
{\r
ble_hrs_flag = 0;\r
+ osTimerStop(g_ble_hrs_timer);\r
osTimerDelete(g_ble_hrs_timer);\r
ppg_send_cmd_to_driver("hrs",0);\r
return;\r
if(ble_spo2_flag == 1)\r
{\r
ble_spo2_flag = 0;\r
+ osTimerStop(g_ble_spo2_timer);\r
osTimerDelete(g_ble_spo2_timer);\r
ppg_send_cmd_to_driver("spo2",0);\r
return;\r
if(graycard_flag == 10)\r
{\r
graycard_flag = 0;\r
+ osTimerStop(g_ble_graycard_timer);\r
osTimerDelete(g_ble_graycard_timer);\r
return;\r
}\r
if(leaklight_flag == 10)\r
{\r
leaklight_flag = 0;\r
+ osTimerStop(g_ble_leaklight_timer);\r
osTimerDelete(g_ble_leaklight_timer);\r
return;\r
}\r
if (testitem == 0x02)\r
{\r
//获取蓝牙地址\r
- uint8_t btaddr[128]={0};\r
- uint32_t btaddrlen = 0;\r
- uapi_get_btaddr(&btaddr[1],&btaddrlen);\r
- PRINT("len : %d \r\n",btaddrlen);\r
+ uint8_t btaddr[64]={0};\r
+ uint32_t len = 64;\r
+ uint8_t send_data[7] = {0};\r
+ uint8_t i = 1;\r
+ char *buf;\r
+\r
+ uapi_get_btaddr((uint8_t*)btaddr,&len);\r
+\r
+ PRINT("btaddr : %s \r\n",btaddr);\r
+ buf= strtok((char *)btaddr,":");\r
+\r
+ while(buf != NULL)\r
+ {\r
+ send_data[i++] = strtoul(buf,NULL,16);\r
+ buf = strtok(NULL,":");\r
+ }\r
+\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
BLE_TEST_CMD_SOFT_TEST_SUB_MODE_BLE,\r
0x02,\r
- btaddr,\r
+ send_data,\r
7);\r
}\r
//获取蓝牙信号强度(未完成)\r
\r
cycle_time_ms = 200;\r
duty = 20;\r
-\r
+ osTimerStop(g_ble_vibrator_timer);\r
osTimerDelete(g_ble_vibrator_timer);\r
\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
{\r
//关闭周期性马达\r
uint8_t send_data = 0x00;\r
-\r
+ osTimerStop(g_ble_vibrator_timer);\r
osTimerDelete(g_ble_vibrator_timer);\r
\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
char send_data[64] = {0};\r
get_system_time(&send_data[1]);\r
uint16_t datalen = strlen(&send_data[1]);\r
+ for(int i = 0; i < datalen + 1 ; i++)\r
+ PRINT("timebuf : %s \r\n",send_data[i]);\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
BLE_TEST_CMD_SOFT_TEST_SUB_MODE_RTC,\r
0x02,\r
{\r
uint8_t i;\r
//获取soc_id\r
- uint8_t soc_id[21] = {0}; // 20 is soc id length\r
- uapi_soc_read_id(&soc_id[1], 21);\r
+ uint8_t soc_id[20] = {0}; // 20 is soc id length\r
+ uapi_soc_read_id(soc_id, 20);\r
\r
- for(i = 0; i < 21; i++)\r
+ for(i = 0; i < 20; i++)\r
PRINT("soc_id[%d] : %2X \r\n",i,soc_id[i]);\r
\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
BLE_TEST_CMD_SOFT_TEST_SUB_MODE_CUSTOM_CMD,\r
0x11,\r
soc_id,\r
- 21);\r
+ 20);\r
}\r
\r
break;\r
tp_id[1] = id >> 8;\r
tp_id[2] = id;\r
\r
+ PRINT("data : %X %X \r\n",tp_id[1],tp_id[2]);\r
+\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
BLE_TEST_CMD_SOFT_TEST_SUB_MODE_TP,\r
0x01,\r
//获取原始数据\r
int16_t x,y;\r
get_tp_info(&x,&y);\r
- uint16_t databuf[3] = {0};\r
+ uint8_t databuf[5] = {0};\r
+\r
+ databuf[1] = (uint8_t)((x & 0XFF00) >> 8);\r
+ databuf[2] = (uint8_t)(x & 0X00FF);\r
\r
- databuf[0] = 0;\r
- databuf[1] = x & 0XFF;\r
- databuf[2] = y & 0XFF;\r
+ databuf[3] = (uint8_t)((y & 0XFF00) >> 8);\r
+ databuf[4] = (uint8_t)(y & 0X00FF);\r
\r
- PRINT("%2X %2X \r\n",databuf[1],databuf[2]);\r
+ PRINT("%2X %2X %2X %2X\r\n",databuf[1],databuf[2],databuf[3],databuf[4]);\r
\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
BLE_TEST_CMD_SOFT_TEST_SUB_MODE_TP,\r
0x05,\r
databuf,\r
- 3);\r
+ 5);\r
}\r
\r
break;\r
} else if(testitem == 0x04)\r
{\r
//单次获得acc\r
- PRINT("333\r\n");\r
uint8_t databuf[6];\r
get_gsensor_single(databuf);\r
\r
} else if(testitem == 0x05)\r
{\r
//连续获得acc\r
- PRINT("444\r\n");\r
g_ble_acc_timer = osTimerNew((osTimerFunc_t)ble_acc_check_timer_callback, osTimerPeriodic, NULL, NULL);\r
osTimerStart(g_ble_acc_timer,1000);\r
\r
uint8_t send_data = 0x00;\r
\r
osTimerStop(g_ble_acc_timer);\r
-\r
+ osTimerDelete(g_ble_acc_timer);\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
BLE_TEST_CMD_SOFT_TEST_SUB_MODE_ACC,\r
0x06,\r
\r
} else if(testitem == 0x02)\r
{\r
- PRINT("555\r\n");\r
//地磁sensor测试\r
float fAzimuth,fPitch,fRoll;\r
mmc5603_getdata(&fAzimuth,&fPitch,&fRoll);\r
databuf[4] = (uint8_t)(((uint32_t)fRoll & 0xFF00) >> 8);\r
databuf[5] = (uint8_t)((uint32_t)fRoll & 0x00FF);\r
\r
- PRINT("fAzimuth : %f , fPitch : %f , fRoll : %f \r\n",fAzimuth,fPitch,fRoll);\r
PRINT("%2X %2X %2X %2X %2X %2X\r\n",databuf[0],databuf[1],databuf[2],databuf[3],databuf[4],databuf[5]);\r
\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
//获取充电状态\r
bool state;\r
state = uapi_get_charger_plug_status();\r
+ uint8_t send_data[2] = {0};\r
+ send_data[1] = state;\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
BLE_TEST_CMD_SOFT_TEST_SUB_MODE_PM,\r
0x02,\r
- &state,\r
- sizeof(state));\r
+ send_data,\r
+ 2);\r
\r
} else if(testitem == 0x03)\r
{\r
{\r
//获得flash_id\r
uint32_t id;\r
- uint8_t flash_id[4] = {0};\r
+ uint8_t flash_id[3] = {0};\r
\r
flash_getid(&id);\r
\r
- flash_id[0] = id >> 24;\r
- flash_id[1] = id >> 16;\r
- flash_id[2] = id >> 8;\r
- flash_id[3] = id >> 0;\r
+ flash_id[0] = id >> 16;\r
+ flash_id[1] = id >> 8;\r
+ flash_id[2] = id >> 0;\r
\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
BLE_TEST_CMD_SOFT_TEST_SUB_MODE_EXTFLASH,\r
0x01,\r
flash_id,\r
- 4);\r
+ 3);\r
\r
} else if(testitem == 0x02)\r
{\r
PRINT("get ic information error2");
} else
{
- PRINT("TOUCH CHIP ID = 0x%02x%02x", chip_id[0], chip_id[1]);
+ PRINT("TOUCH CHIP ID = 0x%02x%02x \r\n", chip_id[0], chip_id[1]);
sprintf(id,"0x%02x%02x", chip_id[0], chip_id[1]);
}
}
}
#include "MMC5603.h"
+#include "mmc5603_hal.h"
#include "mag_service.h"
void mmc5603_getid(unsigned char *id)
{
void mmc5603_getdata(float *fAzimuth,float *fPitch,float *fRoll)
{
+ mmc5603_check();
*fAzimuth = mag_service_get_fAzimuth();
*fPitch = mag_service_get_fPitch();
*fRoll = mag_service_get_fRoll();
+ PRINT("Azimuth : %f, fPitch : %f , fRoll : %f \r\n",*fAzimuth,*fPitch,*fRoll);
}
flash_info_t norflash_id;
uapi_flash_get_info(0, &norflash_id);
*id = norflash_id.flash_id;
+ PRINT("flash_id : %X \r\n",*id);
}
void flash_erase(void)
void get_gsensor_single(uint8_t *databuf)
{
- gsenson_t *t;
- get_gsonsen_xyz(t);
+ gsenson_t t;
+ get_gsonsen_xyz(&t);
- databuf[0] = (uint8_t)((t->x & 0xFF00) >> 8);
- databuf[1] = (uint8_t)(t->x & 0x00FF);
+ databuf[0] = (uint8_t)((t.x & 0xFF00) >> 8);
+ databuf[1] = (uint8_t)(t.x & 0x00FF);
- databuf[2] = (uint8_t)((t->y & 0xFF00) >> 8);
- databuf[3] = (uint8_t)(t->y & 0x00FF);
+ databuf[2] = (uint8_t)((t.y & 0xFF00) >> 8);
+ databuf[3] = (uint8_t)(t.y & 0x00FF);
- databuf[4] = (uint8_t)((t->z & 0xFF00) >> 8);
- databuf[5] = (uint8_t)(t->z & 0x00FF);
+ databuf[4] = (uint8_t)((t.z & 0xFF00) >> 8);
+ databuf[5] = (uint8_t)(t.z & 0x00FF);
+ PRINT("x : %d, y : %d, z : %d \r\n",t.x,t.y,t.z);
PRINT("GSENSOR: %2X %2X %2X %2X %2X %2X\r\n",databuf[0],databuf[1],databuf[2],databuf[3],databuf[4],databuf[5]);
}