parent
83bd8614ab
commit
fb8e9ea93a
|
@ -205,7 +205,7 @@ static const char* sensor_get_accuracy_mode_name(rt_sensor_info_t info)
|
||||||
case RT_SENSOR_MODE_ACCURACY_NOTRUST:
|
case RT_SENSOR_MODE_ACCURACY_NOTRUST:
|
||||||
return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_MODE_ACCURACY_NOTRUST);
|
return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_MODE_ACCURACY_NOTRUST);
|
||||||
default:
|
default:
|
||||||
LOG_E("accuracy mode illegal!");
|
rt_kprintf("accuracy mode illegal!\n");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ static const char* sensor_get_power_mode_name(rt_sensor_info_t info)
|
||||||
case RT_SENSOR_MODE_POWER_DOWN:
|
case RT_SENSOR_MODE_POWER_DOWN:
|
||||||
return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_MODE_POWER_DOWN);
|
return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_MODE_POWER_DOWN);
|
||||||
default:
|
default:
|
||||||
LOG_E("power mode illegal!");
|
rt_kprintf("power mode illegal!\n");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ static const char* sensor_get_fetch_mode_name(rt_sensor_info_t info)
|
||||||
case RT_SENSOR_MODE_FETCH_FIFO:
|
case RT_SENSOR_MODE_FETCH_FIFO:
|
||||||
return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_MODE_FETCH_FIFO);
|
return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_MODE_FETCH_FIFO);
|
||||||
default:
|
default:
|
||||||
LOG_E("fetch data mode illegal!");
|
rt_kprintf("fetch data mode illegal!\n");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,66 +254,66 @@ static void sensor_show_data(rt_size_t num, rt_sensor_t sensor, struct rt_sensor
|
||||||
switch (sensor->info.type)
|
switch (sensor->info.type)
|
||||||
{
|
{
|
||||||
case RT_SENSOR_TYPE_ACCE:
|
case RT_SENSOR_TYPE_ACCE:
|
||||||
LOG_I("num:%d, x:%f, y:%f, z:%f %s, timestamp:%u", num, sensor_data->data.acce.x, sensor_data->data.acce.y, sensor_data->data.acce.z, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, x:%f, y:%f, z:%f %s, timestamp:%u\n", num, sensor_data->data.acce.x, sensor_data->data.acce.y, sensor_data->data.acce.z, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_GYRO:
|
case RT_SENSOR_TYPE_GYRO:
|
||||||
LOG_I("num:%d, x:%f, y:%f, z:%f %s, timestamp:%u", num, sensor_data->data.gyro.x, sensor_data->data.gyro.y, sensor_data->data.gyro.z, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, x:%f, y:%f, z:%f %s, timestamp:%u\n", num, sensor_data->data.gyro.x, sensor_data->data.gyro.y, sensor_data->data.gyro.z, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_MAG:
|
case RT_SENSOR_TYPE_MAG:
|
||||||
LOG_I("num:%d, x:%f, y:%f, z:%f %s, timestamp:%u", num, sensor_data->data.mag.x, sensor_data->data.mag.y, sensor_data->data.mag.z, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, x:%f, y:%f, z:%f %s, timestamp:%u\n", num, sensor_data->data.mag.x, sensor_data->data.mag.y, sensor_data->data.mag.z, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_GNSS:
|
case RT_SENSOR_TYPE_GNSS:
|
||||||
LOG_I("num:%d, lon:%f, lat:%f %s, timestamp:%u", num, sensor_data->data.coord.longitude, sensor_data->data.coord.latitude, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, lon:%f, lat:%f %s, timestamp:%u\n", num, sensor_data->data.coord.longitude, sensor_data->data.coord.latitude, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_TEMP:
|
case RT_SENSOR_TYPE_TEMP:
|
||||||
LOG_I("num:%d, temp:%f%s, timestamp:%u", num, sensor_data->data.temp, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, temp:%f%s, timestamp:%u\n", num, sensor_data->data.temp, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_HUMI:
|
case RT_SENSOR_TYPE_HUMI:
|
||||||
LOG_I("num:%d, humi:%f%s, timestamp:%u", num, sensor_data->data.humi, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, humi:%f%s, timestamp:%u\n", num, sensor_data->data.humi, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_BARO:
|
case RT_SENSOR_TYPE_BARO:
|
||||||
LOG_I("num:%d, press:%f%s, timestamp:%u", num, sensor_data->data.baro, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, press:%f%s, timestamp:%u\n", num, sensor_data->data.baro, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_LIGHT:
|
case RT_SENSOR_TYPE_LIGHT:
|
||||||
LOG_I("num:%d, light:%f%s, timestamp:%u", num, sensor_data->data.light, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, light:%f%s, timestamp:%u\n", num, sensor_data->data.light, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_PROXIMITY:
|
case RT_SENSOR_TYPE_PROXIMITY:
|
||||||
case RT_SENSOR_TYPE_TOF:
|
case RT_SENSOR_TYPE_TOF:
|
||||||
LOG_I("num:%d, distance:%f%s, timestamp:%u", num, sensor_data->data.proximity, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, distance:%f%s, timestamp:%u\n", num, sensor_data->data.proximity, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_HR:
|
case RT_SENSOR_TYPE_HR:
|
||||||
LOG_I("num:%d, heart rate:%f%s, timestamp:%u", num, sensor_data->data.hr, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, heart rate:%f%s, timestamp:%u\n", num, sensor_data->data.hr, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_TVOC:
|
case RT_SENSOR_TYPE_TVOC:
|
||||||
LOG_I("num:%d, tvoc:%f%s, timestamp:%u", num, sensor_data->data.tvoc, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, tvoc:%f%s, timestamp:%u\n", num, sensor_data->data.tvoc, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_NOISE:
|
case RT_SENSOR_TYPE_NOISE:
|
||||||
LOG_I("num:%d, noise:%f%s, timestamp:%u", num, sensor_data->data.noise, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, noise:%f%s, timestamp:%u\n", num, sensor_data->data.noise, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_STEP:
|
case RT_SENSOR_TYPE_STEP:
|
||||||
LOG_I("num:%d, step:%f%s, timestamp:%u", num, sensor_data->data.step, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, step:%f%s, timestamp:%u\n", num, sensor_data->data.step, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_FORCE:
|
case RT_SENSOR_TYPE_FORCE:
|
||||||
LOG_I("num:%d, force:%f%s, timestamp:%u", num, sensor_data->data.force, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, force:%f%s, timestamp:%u\n", num, sensor_data->data.force, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_DUST:
|
case RT_SENSOR_TYPE_DUST:
|
||||||
LOG_I("num:%d, dust:%f%s, timestamp:%u", num, sensor_data->data.dust, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, dust:%f%s, timestamp:%u\n", num, sensor_data->data.dust, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_ECO2:
|
case RT_SENSOR_TYPE_ECO2:
|
||||||
LOG_I("num:%d, eco2:%f%s, timestamp:%u", num, sensor_data->data.eco2, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, eco2:%f%s, timestamp:%u\n", num, sensor_data->data.eco2, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_IAQ:
|
case RT_SENSOR_TYPE_IAQ:
|
||||||
LOG_I("num:%d, IAQ:%f%s, timestamp:%u", num, sensor_data->data.iaq, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, IAQ:%f%s, timestamp:%u\n", num, sensor_data->data.iaq, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_ETOH:
|
case RT_SENSOR_TYPE_ETOH:
|
||||||
LOG_I("num:%d, EtOH:%f%s, timestamp:%u", num, sensor_data->data.etoh, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, EtOH:%f%s, timestamp:%u\n", num, sensor_data->data.etoh, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_BP:
|
case RT_SENSOR_TYPE_BP:
|
||||||
LOG_I("num:%d, bp.sbp:%f, bp.dbp:%f %s, timestamp:%u", num, sensor_data->data.bp.sbp, sensor_data->data.bp.dbp, unit_name, sensor_data->timestamp);
|
rt_kprintf("num:%d, bp.sbp:%f, bp.dbp:%f %s, timestamp:%u\n", num, sensor_data->data.bp.sbp, sensor_data->data.bp.dbp, unit_name, sensor_data->timestamp);
|
||||||
break;
|
break;
|
||||||
case RT_SENSOR_TYPE_NONE:
|
case RT_SENSOR_TYPE_NONE:
|
||||||
default:
|
default:
|
||||||
LOG_E("Unknown type of sensor!");
|
rt_kprintf("Unknown type of sensor!\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -687,7 +687,7 @@ static void sensor(int argc, char **argv)
|
||||||
}
|
}
|
||||||
if (rt_device_control(new_dev, RT_SENSOR_CTRL_GET_ID, ®) == RT_EOK)
|
if (rt_device_control(new_dev, RT_SENSOR_CTRL_GET_ID, ®) == RT_EOK)
|
||||||
{
|
{
|
||||||
LOG_I("Sensor Chip ID: %#x", reg);
|
rt_kprintf("Sensor Chip ID: %#x\n", reg);
|
||||||
}
|
}
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue