Files
uDCCD/firmware/src/hw/safe_ain.h
Andis Zīle 4a84afcf7a feat-hal-2 (#4)
Finished working initial version

Co-authored-by: Andis Zīle <andis.jarganns@gmail.com>
Reviewed-on: #4
Co-authored-by: Andis Zīle <andis.jargans@gmail.com>
Co-committed-by: Andis Zīle <andis.jargans@gmail.com>
2024-07-31 16:15:35 +00:00

50 lines
752 B
C++

#ifndef SAFE_AIN_H_
#define SAFE_AIN_H_
/**** Includes ****/
#include <stdint.h>
#include "../utils/vcounter.h"
#include "../bsp/board.h"
namespace hw {
/**** Public definitions ****/
class SafeAin
{
public:
SafeAin(void);
~SafeAin(void);
void init(bsp::AnalogIn* ain_ch, util::VCounter* timer);
uint8_t warning;
uint8_t fault;
uint16_t last_read;
uint16_t under_treshold;
uint16_t over_treshold;
uint16_t hold_time;
uint16_t cooldown_time;
uint8_t update_ain;
uint8_t auto_reset;
void process(void);
#ifndef TESTING
protected:
#endif
bsp::AnalogIn* ain_ch;
util::VCounter* timer;
uint16_t ts_state_chnage;
};
/**** Public function declarations ****/
#ifdef TESTING
#endif
} //namespace
#endif /* SAFE_AIN_H_ */