| 319 | } |
| 320 | |
| 321 | static const char* sensor_get_intf_name(rt_sensor_t sensor) |
| 322 | { |
| 323 | rt_uint8_t type = sensor->config.intf.type; |
| 324 | |
| 325 | if (type | RT_SENSOR_INTF_I2C) |
| 326 | { |
| 327 | return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_INTF_I2C); |
| 328 | } |
| 329 | else if (type | RT_SENSOR_INTF_SPI) |
| 330 | { |
| 331 | return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_INTF_SPI); |
| 332 | } |
| 333 | else if (type | RT_SENSOR_INTF_UART) |
| 334 | { |
| 335 | return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_INTF_UART); |
| 336 | } |
| 337 | else if (type | RT_SENSOR_INTF_ONEWIRE) |
| 338 | { |
| 339 | return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_INTF_ONEWIRE); |
| 340 | } |
| 341 | else if (type | RT_SENSOR_INTF_CAN) |
| 342 | { |
| 343 | return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_INTF_CAN); |
| 344 | } |
| 345 | else if (type | RT_SENSOR_INTF_MODBUS) |
| 346 | { |
| 347 | return RT_SENSOR_MACRO_GET_NAME(RT_SENSOR_INTF_MODBUS); |
| 348 | } |
| 349 | else |
| 350 | { |
| 351 | return ""; |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | static rt_err_t rx_callback(rt_device_t dev, rt_size_t size) |
| 356 | { |