Files

31 lines
753 B
C

#ifndef VELOMETER_SS49E_H
#define VELOMETER_SS49E_H
#include <stdbool.h>
#include <stdint.h>
enum SS49E_WorkingPhase {
SS49E_WORKING_PHASE_NORMAL,
SS49E_WORKING_PHASE_CALIBRATING,
};
enum MagnetPolarityType {
MAGNET_POLTYPE_BIPOLAR,
MAGNET_POLTYPE_UNIPOLAR_POSITIVE,
MAGNET_POLTYPE_UNIPOLAR_NEGATIVE,
};
typedef void (*ss49e_tick_callback_t)();
typedef struct {
enum SS49E_WorkingPhase workingPhase;
enum MagnetPolarityType magnetPolType;
ss49e_tick_callback_t tickCallback;
float threshold01, threshold10;
bool currentLevel;
} SS49E_State;
void ss49e_init(SS49E_State *self, enum MagnetPolarityType magnetPolarityType, ss49e_tick_callback_t tickCallback);
void ss49e_process_sample(SS49E_State *self, uint16_t sample);
#endif