@@ -17,34 +17,20 @@ To enable the ``sensor_hub`` to locate the sensor component, please refer to the
1717
1818``` c
1919static imu_impl_t virtual_mpu6050_impl = {
20- .name = "virtual_mpu6050",
21- .sensor_type = IMU_ID,
2220 .init = virtual_imu_init,
2321 .deinit = virtual_imu_deinit,
2422 .test = virtual_imu_test,
2523 .acquire_acce = virtual_imu_acquire_acce,
2624 .acquire_gyro = virtual_imu_acquire_gyro,
27- .sleep = virtual_imu_null_function,
28- .wakeup = virtual_imu_null_function,
2925};
3026
31- void *virtual_mpu6050_detect (sensor_info_t * sensor_info)
32- {
33- sensor_info->snesor_type = IMU_ID;
34- sensor_info->name = virtual_mpu6050_impl.name;
35- return (void* )&virtual_mpu6050_impl;
36- }
37-
38- ESP_SENSOR_DETECT_FN(virtual_mpu6050_detect)
39- {
40- return virtual_mpu6050_detect(sensor_info);
41- }
27+ SENSOR_HUB_DETECT_FN (IMU_ID, virtual_mpu6050, &virtual_mpu6050_impl);
4228```
4329
44303. Modify the CMakeLists of the sensor driver to link the sensor registration function.
4531
4632```cmake
47- target_link_libraries(${COMPONENT_LIB} INTERFACE "-u virtual_mpu6050_detect ")
33+ target_link_libraries(${COMPONENT_LIB} INTERFACE "-u virtual_imu_init ")
4834```
4935
5036The ` test_apps ` of ` sensor_hub ` provide examples of virtual sensor registration, which you can refer to when registering your own sensor.
0 commit comments