37 lines
		
	
	
		
			590 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			590 B
		
	
	
	
		
			C
		
	
	
	
	
	
#ifndef INC_IMD_MONITORING_H
 | 
						|
#define INC_IMD_MONITORING_H
 | 
						|
 | 
						|
#include <stdint.h>
 | 
						|
 | 
						|
#include "stm32h7xx_hal.h"
 | 
						|
 | 
						|
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
 |