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

Function sensor_fifo

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

Source from the content-addressed store, hash-verified

383}
384
385static void sensor_fifo(int argc, char **argv)
386{
387 static rt_thread_t tid1 = RT_NULL;
388 rt_device_t dev = RT_NULL;
389 rt_sensor_t sensor;
390
391 dev = rt_device_find(argv[1]);
392 if (dev == RT_NULL)
393 {
394 LOG_E("Can't find device:%s", argv[1]);
395 return;
396 }
397 sensor = (rt_sensor_t)dev;
398
399 if (rt_device_open(dev, RT_DEVICE_FLAG_FIFO_RX) != RT_EOK)
400 {
401 LOG_E("open device failed!");
402 return;
403 }
404
405 if (sensor_rx_sem == RT_NULL)
406 {
407 sensor_rx_sem = rt_sem_create("sen_rx_sem", 0, RT_IPC_FLAG_FIFO);
408 }
409 else
410 {
411 LOG_E("The thread is running, please reboot and try again");
412 return;
413 }
414
415 tid1 = rt_thread_create("sen_rx_thread",
416 sensor_fifo_rx_entry, sensor,
417 1024,
418 15, 5);
419
420 if (tid1 != RT_NULL)
421 rt_thread_startup(tid1);
422
423 rt_device_set_rx_indicate(dev, rx_callback);
424}
425MSH_CMD_EXPORT(sensor_fifo, Sensor fifo mode test function);
426
427static void sensor_irq_rx_entry(void *parameter)

Callers

nothing calls this directly

Calls 6

rt_device_findFunction · 0.85
rt_device_openFunction · 0.85
rt_sem_createFunction · 0.85
rt_thread_createFunction · 0.85
rt_thread_startupFunction · 0.85

Tested by

no test coverage detected