#ifndef _ADC_H #define _ADC_H #include "sys.h" #include ////////////////////////////////////////////////////////////////////////////////// //This program is for educational purposes only, without the author's permission, may not be used for any other purpose //ALIENTEK STM32F407 Development Board //ADC driver code //Hot Atomic @ALIENTEK //Forum: www.openedv.com //Date created: 2015/9/1 //Version: V1.0 //All rights reserved pirated reserved. //Copyright(C) Guangzhou wing electronic technology limited company 2014-2024 //All rights reserved ////////////////////////////////////////////////////////////////////////////////// #define TEMP_PORT GPIOA #define TEMP1_PIN GPIO_Pin_5 #define TEMP2_PIN GPIO_Pin_4 #define TEMP3_PIN GPIO_Pin_3 #define TEMP4_PIN GPIO_Pin_2 #define TEMP5_PIN GPIO_Pin_1 #define TEMP6_PIN GPIO_Pin_0 #define TEMP7_PIN GPIO_Pin_7 #define TEMP8_PIN GPIO_Pin_6 #define ADC1_CH_MAX 11 #define ADC1_DMA_BUFFER_MAX 256 #define CURRENT_PORT GPIOC #define DSG_CURR_PIN GPIO_Pin_4 #define CHG_CURR_PIN GPIO_Pin_5 #define ADC2_CH_MAX 2 #define ADC2_DMA_BUFFER_MAX (2048 + 1024) /* * Internal Reference Voltage, according to ST this is 1.21V typical * with -40 deg C < T < +105 deg C its Min: 1.18V, Typ 1.21V, Max: 1.24V */ #define VREFINT 1210 /* * prints the last measured Temperature from measureContinuous * According to ST: * 2.5 mV/deg C * 25 deg C === 0.76V * Thus: * temp [deg C] = (temp[V]-0.76 [V])/0.0025 [V/deg C] + 25 [deg C] */ #define ADC_VBASE 3300 // 3.3V #define V25 760.0 #define AVG_SLOPE 2.5 void Temp_Port_Init(void); //Initialize void VI_Port_Init(void); u16 AvgAdc1DmaValue(u16 ch); u16 GetAdc1DmaBufferValue(u16 ch, u16 no); void DisplayAdc1DmaBufferValue(void); u16 AvgAdc2DmaValue(u16 ch); u16 GetAdc2DmaBufferValue(u16 ch, u16 no); void DisplayAdc2DmaBufferValue(u8 ch); u16 GetDmaBufferFlag(void); void ResetDmaBufferFlag(void); #endif