MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sensor_get_intf_name

Function sensor_get_intf_name

components/drivers/sensor/v2/sensor_cmd.c:321–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319}
320
321static 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
355static rt_err_t rx_callback(rt_device_t dev, rt_size_t size)
356{

Callers 1

sensorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected