dsel 8 added , current monitoring restructructing agtempt 1
This commit is contained in:
		@ -10,13 +10,13 @@
 | 
			
		||||
 | 
			
		||||
volatile union adc1_channels {
 | 
			
		||||
  struct {
 | 
			
		||||
    uint16_t isense9;
 | 
			
		||||
    uint16_t isense8;
 | 
			
		||||
    uint16_t isense2;
 | 
			
		||||
    uint16_t isense12;
 | 
			
		||||
    uint16_t isense11;
 | 
			
		||||
    uint16_t isense6;
 | 
			
		||||
    uint16_t isense13;
 | 
			
		||||
    uint16_t isense5;
 | 
			
		||||
    uint16_t isense3;
 | 
			
		||||
    uint16_t dietemp;
 | 
			
		||||
    uint16_t vbat;
 | 
			
		||||
    uint16_t vrefint;
 | 
			
		||||
    uint16_t isense7;
 | 
			
		||||
  } adcbank1;
 | 
			
		||||
 | 
			
		||||
  uint16_t adcbuffer[7]; // array 7*16 bit
 | 
			
		||||
@ -25,16 +25,14 @@ volatile union adc1_channels {
 | 
			
		||||
// ADC's anpassen adc1 - 9, adc2 ist halt 5 , buffer anpassen und namen auch ( isense usw)
 | 
			
		||||
volatile union adc2_channels {
 | 
			
		||||
  struct {
 | 
			
		||||
    uint16_t isense11;
 | 
			
		||||
    uint16_t isense10;
 | 
			
		||||
    uint16_t isense5;
 | 
			
		||||
    uint16_t isense4;
 | 
			
		||||
    uint16_t isense2;
 | 
			
		||||
    uint16_t isense1;
 | 
			
		||||
    uint16_t isense7;
 | 
			
		||||
    uint16_t isense6;
 | 
			
		||||
  } adcbank1;
 | 
			
		||||
    uint16_t isense10;
 | 
			
		||||
    uint16_t isense4;
 | 
			
		||||
 | 
			
		||||
  uint16_t adcbuffer[7];
 | 
			
		||||
  } adcbank2;
 | 
			
		||||
 | 
			
		||||
  uint16_t adcbuffer[4];
 | 
			
		||||
 | 
			
		||||
} adc_channels2;
 | 
			
		||||
 | 
			
		||||
@ -48,11 +46,11 @@ ADC_HandleTypeDef* adc2;
 | 
			
		||||
 | 
			
		||||
void currentMonitor_init(ADC_HandleTypeDef* hadc1, ADC_HandleTypeDef* hadc2, // init ist initilisierung 
 | 
			
		||||
                         TIM_HandleTypeDef* trigtim) {
 | 
			
		||||
  HAL_GPIO_WritePin(DSEL_3_GPIO_Port, DSEL_3_Pin, adcbank1); //DSELs zu adc's neu zuordnen 
 | 
			
		||||
  HAL_GPIO_WritePin(DSEL_3_GPIO_Port, DSEL_3_Pin, adcbank2); //DSELs zu adc's neu zuordnen 
 | 
			
		||||
  HAL_GPIO_WritePin(DSEL_4_GPIO_Port, DSEL_4_Pin, adcbank2);
 | 
			
		||||
  HAL_GPIO_WritePin(DSEL_5_GPIO_Port, DSEL_5_Pin, adcbank2);
 | 
			
		||||
  HAL_GPIO_WritePin(DSEL_6_GPIO_Port, DSEL_6_Pin, adcbank2);
 | 
			
		||||
 | 
			
		||||
  HAL_GPIO_WritePin(DSEL_5_GPIO_Port, DSEL_5_Pin, adcbank1);
 | 
			
		||||
  HAL_GPIO_WritePin(DSEL_7_GPIO_Port, DSEL_7_Pin, adcbank1);
 | 
			
		||||
  HAL_GPIO_WritePin(DSEL_8_GPIO_Port, DSEL_8_Pin, adcbank2);
 | 
			
		||||
  adc1 = hadc1;
 | 
			
		||||
  adc2 = hadc2;
 | 
			
		||||
  HAL_TIM_Base_Start(trigtim);
 | 
			
		||||
 | 
			
		||||
@ -53,7 +53,7 @@ TIM_HandleTypeDef htim2;
 | 
			
		||||
TIM_HandleTypeDef htim3;
 | 
			
		||||
 | 
			
		||||
UART_HandleTypeDef huart1;
 | 
			
		||||
//Test
 | 
			
		||||
 | 
			
		||||
/* USER CODE BEGIN PV */
 | 
			
		||||
 | 
			
		||||
/* USER CODE END PV */
 | 
			
		||||
 | 
			
		||||
@ -118,7 +118,7 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
 | 
			
		||||
    GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
			
		||||
    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 | 
			
		||||
 | 
			
		||||
    GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3;
 | 
			
		||||
    GPIO_InitStruct.Pin = DSEL_8_Pin|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3;
 | 
			
		||||
    GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
 | 
			
		||||
    GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
			
		||||
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 | 
			
		||||
@ -195,7 +195,7 @@ void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
 | 
			
		||||
    */
 | 
			
		||||
    HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
 | 
			
		||||
 | 
			
		||||
    HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
 | 
			
		||||
    HAL_GPIO_DeInit(GPIOA, DSEL_8_Pin|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
 | 
			
		||||
 | 
			
		||||
  /* USER CODE BEGIN ADC1_MspDeInit 1 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user