ams-master-23/Core/Inc/imd_monitoring.h

37 lines
590 B
C
Raw Normal View History

2023-07-02 19:40:31 +02:00
#ifndef INC_IMD_MONITORING_H
#define INC_IMD_MONITORING_H
#include <stdint.h>
2024-04-23 17:37:17 +02:00
#include "stm32h7xx_hal.h"
2023-07-02 19:40:31 +02:00
typedef enum {
IMD_STATE_UNKNOWN,
IMD_STATE_SHORTCIRCUIT_SUPPLY,
IMD_STATE_SHORTCIRCUIT_GND,
IMD_STATE_NORMAL,
IMD_STATE_UNDERVOLTAGE,
IMD_STATE_SST,
IMD_STATE_DEV_ERROR,
IMD_STATE_GND_FAULT,
} IMDState;
typedef struct {
int ok;
IMDState state;
uint32_t r_iso;
uint32_t freq;
uint32_t duty_cycle;
uint32_t last_high;
} IMDData;
extern IMDData imd_data;
void imd_init(TIM_HandleTypeDef *htim);
void imd_update(void);
#endif // INC_IMD_MONITORING_H