From b82bb594b7143e04ce39b84be12e001e57f17527 Mon Sep 17 00:00:00 2001 From: Robert Gustafsson Date: Wed, 4 Oct 2017 20:19:16 +0200 Subject: Add function to release sensor values --- broccoli/src/midbropasad.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'broccoli/src') diff --git a/broccoli/src/midbropasad.c b/broccoli/src/midbropasad.c index 756e558..d3c6829 100644 --- a/broccoli/src/midbropasad.c +++ b/broccoli/src/midbropasad.c @@ -6,6 +6,24 @@ #include #endif +Fifo_q * q; + + int * +request_sensor_data(int number) +{ + int i; + int * arrayOfValues; + Sensor_t * sensor; + arrayOfValues = (int *) malloc(number*sizeof(int)); + for(i=0; ivalue; + free(sensor); + } + printf("Release %d sensor data values\n", number); + return arrayOfValues; +} + void start_data_capture(Fifo_q * q) { @@ -23,10 +41,10 @@ main(int argc, char **argv) { Fifo_q * q = init_queue(50); start_data_capture(q); + sleep(10); while(true){ - printf("Main thread\n"); - sleep(10); print_queue(q); + free(request_sensor_data(5)); } free(q); return 0; -- cgit v1.2.3