123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- /*
- * adc_buffers.h
- *
- * Created on: Sep 5, 2024
- * Author: jakubski
- */
- #ifndef INC_ADC_BUFFERS_H_
- #define INC_ADC_BUFFERS_H_
- #include "stdint.h"
- #include "stm32h7xx_hal.h"
- #define EXT_VREF_mV 3000
- #define U_CHANNEL_CONST 7.59
- #define I_CHANNEL_CONST 7.5758
- #define deltaADC 3.0/65535
- enum _ADC1_DataInfo {
- UL1 = 0,
- UL2,
- UL3,
- IL1Ref,
- IL2Ref,
- IL3Ref,
- FanFB,
- // IIL1,
- // IIL2,
- // IIL3,
- ADC1LastData,
- };
- typedef enum _ADC1_DataInfo ADC1_DataInfo;
- struct _ADC1_Data {
- uint32_t adcDataBuffer[ADC1LastData];
- uint32_t dummy[(__SCB_DCACHE_LINE_SIZE / sizeof (uint32_t)) - ADC1LastData];
- };
- enum _ADC2_DataInfo { IL1 = 0, IL2, IL3, ADC2LastData };
- typedef enum _ADC2_DataInfo ADC2_DataInfo;
- struct _ADC2_Data {
- uint32_t adcDataBuffer[ADC2LastData];
- uint32_t dummy[(__SCB_DCACHE_LINE_SIZE / sizeof (uint32_t)) - ADC2LastData];
- };
- enum _ADC3_DataInfo { pvTemp1 = 0, pvTemp2, motorXSense, motorYSense, VrefInt, ADC3LastData };
- typedef enum _ADC3_DataInfo ADC3_DataInfo;
- struct _ADC3_Data {
- uint16_t adcDataBuffer[ADC3LastData];
- uint16_t dummy[(__SCB_DCACHE_LINE_SIZE / sizeof (uint16_t)) - ADC3LastData];
- };
- typedef struct _ADC1_Data ADC1_Data;
- typedef struct _ADC2_Data ADC2_Data;
- typedef struct _ADC3_Data ADC3_Data;
- extern ADC1_Data adc1Data;
- extern ADC2_Data adc2Data;
- extern ADC3_Data adc3Data;
- #define DEFAULT_U_GAIN 1.0
- #define DEFAULT_U_OFFSET 0.0
- #define DEFAULT_I_GAIN 1.0
- #define DEFAULT_I_OFFSET 0.0
- struct _EletricalMeasCorrectionData
- {
- float gain;
- float offset;
- };
- typedef struct _EletricalMeasCorrectionData EletricalMeasCorrectionData;
- extern EletricalMeasCorrectionData U_MeasCorrectionData[3];
- extern EletricalMeasCorrectionData I_MeasCorrectionData[3];
- #endif /* INC_ADC_BUFFERS_H_ */
|