12#include "event_groups.h"
13#include "message_buffer.h"
19#include "devicelist.h"
20#include "kalmanfilter.h"
28#include "ldataacquisition.h"
30extern EventGroupHandle_t xTaskEnableGroup;
31extern SemaphoreHandle_t xUsbMutex;
32extern MessageBufferHandle_t xUsbTxBuff;
49void vLDataAcquisition(
void *argument) {
52 KalmanFilter_init(&kf);
57 1.0, dt, 0.5 * (dt * dt),
81 arm_matrix_instance_f32 z;
82 float zData[2] = {0.0, 0.0};
83 arm_mat_init_f32(&z, 2, 1, zData);
85 TickType_t xLastWakeTime;
86 const TickType_t xFrequency = pdMS_TO_TICKS(20);
87 const TickType_t blockTime = pdMS_TO_TICKS(0);
97 TickType_t xLastWakeTime = xTaskGetTickCount();
98 vTaskDelayUntil(&xLastWakeTime, xFrequency);
100 taskENTER_CRITICAL();
105 state->altitude = 44330 * (1.0 - pow(baro->
press / baro->
groundPress, 0.1903));
108 state->mem.append(&state->mem, HEADER_LOWRES);
113 EventBits_t uxBits = xEventGroupWaitBits(xTaskEnableGroup, GROUP_TASK_ENABLE_LOWRES, pdFALSE, pdFALSE, blockTime);
114 if (uxBits & GROUP_TASK_ENABLE_LOWRES) {
116 z.pData[0] = state->altitude;
117 z.pData[1] = (state->cosine * 9.81 * accel->
accelData[ZINDEX] - 9.81);
120 state->velocity = kf.x.pData[1];
121 state->avgPress.append(&state->avgPress, baro->
press);
122 state->avgVel.append(&state->avgVel, state->velocity);
Defines the API for the Accelerometer sensor.
Defines the API for the Barometer sensor.
float * accelData
Pointer to driver defined data array.
uint8_t * rawTemp
Pointer to driver defined raw temperature data array.
uint8_t pressDataSize
Size of raw pressure data in bytes.
float press
Last read processed pressure value.
float groundPress
Stored ground pressure reading.
uint8_t tempDataSize
Size of raw temperature data in bytes.
uint8_t * rawPress
Pointer to driver defined raw pressure data array.
void(* update)(struct Baro *baro)
Pointer to update method.
DeviceHandle_t DeviceList_getDeviceHandle(DeviceKey)
Retrieve device handle from list by key.
Struct definition for UART interface.