Syrostan-MCU-C/Core/Inc/User/power.h

28 lines
873 B
C

#ifndef POWER_H
#define POWER_H
#include "user_main.h"
#define ADC_EEM_CURRENT_REF 9
#define ADC_EEM_CURRENT_VAL 8
#define EEM_ADC2CURRENT(val,ref) ((val-ref)/4096.0f*3.3f*1333.3f) //((val-ref)/4096*3.3/0.03/25*1000)
#define ADC2VOLTAGE_3V3(x) ((x/4096.0f*3.3f)*2.0f)
#define ADC2VOLTAGE_5V(x) ((x/4096.0f*3.3f)*2.0f)
#define ADC2VOLTAGE_12V(x) ((x/4096.0f*3.3f)*6.1f)
#define ADC2VOLTAGE_GND(x) ((x/4096.0f*3.3f)*1.47f)
#define ADC_3V3 5
#define ADC_3V3MP 4
#define ADC_5V_1 3
#define ADC_5V_2 7
#define ADC_12V 6
#define ADC_GND1 1
#define ADC_GND2 0
void eem_power_init();
void power_adc_calculate();
void eem_power_off();
void eem_power_on();
void eem_power_toggle();
#endif