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

Function sensor_fifo_rx_entry

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

Source from the content-addressed store, hash-verified

359}
360
361static void sensor_fifo_rx_entry(void *parameter)
362{
363 rt_sensor_t sensor = (rt_sensor_t)parameter;
364 struct rt_sensor_data *data = RT_NULL;
365 rt_size_t res, i;
366
367 data = (struct rt_sensor_data *)rt_calloc(sensor->info.fifo_max, sizeof(struct rt_sensor_data));
368 if (data == RT_NULL)
369 {
370 LOG_E("Memory allocation failed!");
371 }
372
373 while (1)
374 {
375 rt_sem_take(sensor_rx_sem, RT_WAITING_FOREVER);
376
377 res = rt_device_read((rt_device_t)sensor, 0, data, sensor->info.fifo_max);
378 for (i = 0; i < res; i++)
379 {
380 sensor_show_data(i, sensor, &data[i]);
381 }
382 }
383}
384
385static void sensor_fifo(int argc, char **argv)
386{

Callers

nothing calls this directly

Calls 4

rt_callocFunction · 0.85
rt_sem_takeFunction · 0.85
rt_device_readFunction · 0.85
sensor_show_dataFunction · 0.70

Tested by

no test coverage detected