CarFlipDetection/Inc/CarFlipDetection.h

42 lines
963 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// Created by xemon on 22.11.22.
//
#ifndef UVEOS_ON_NATION_CARFLIPDETECTION_H
#define UVEOS_ON_NATION_CARFLIPDETECTION_H
#include "vector.h"
#include "stdbool.h"
typedef struct {
///пока этот флаг в нуле, событие с авари
bool enabled;
vector3 gravity;
struct {
float angleCos;
uint32_t antiFlightMs;
} thresholds;
} tCarFlipDetectionSettings;
typedef struct {
//watch value
struct {
float angleCos;
vector3 value;
uint32_t durationMs;
} current;
tCarFlipDetectionSettings *settings;
//detection result
bool flipDetected;
} tCarFlipDetection;
void CarFlipDetection_InitSettings(tCarFlipDetectionSettings *settings);
void CarFlipDetection_Init(tCarFlipDetection *env, tCarFlipDetectionSettings *settings);
void CarFlipDetection_ApplyCurrentAccel(tCarFlipDetection *env, vector3 currentValue);
#endif //UVEOS_ON_NATION_CARFLIPDETECTION_H