37 lines
647 B
C
37 lines
647 B
C
#ifndef FAULTS_H_
|
|
#define FAULTS_H_
|
|
|
|
/*
|
|
*/
|
|
|
|
/**** Includes ****/
|
|
#include <stdint.h>
|
|
|
|
/**** Public definitions ****/
|
|
typedef enum {
|
|
FAULT_LVL_OK,
|
|
FAULT_LVL_WARNING,
|
|
FAULT_LVL_FAULT
|
|
} fault_lvl_t;
|
|
|
|
typedef struct {
|
|
fault_lvl_t severity;
|
|
uint16_t w_time;
|
|
uint16_t f_time;
|
|
} fault_t;
|
|
|
|
typedef struct {
|
|
uint16_t delay;
|
|
uint16_t wtof;
|
|
} fault_cfg_t;
|
|
|
|
/**** Public function declarations ****/
|
|
uint8_t fault_process(fault_t* fault, uint8_t w_trig, uint8_t f_trig, fault_cfg_t* cfg);
|
|
uint8_t fault_is_active(fault_t* fault);
|
|
uint8_t fault_is_warning(fault_t* fault);
|
|
void fault_reset(fault_t* fault);
|
|
|
|
#ifdef TESTING
|
|
#endif
|
|
|
|
#endif /* FAULTS_H_ */ |