| 1 | /** | 
|---|
| 2 |   ****************************************************************************** | 
|---|
| 3 |   * File Name          : gpio.c | 
|---|
| 4 |   * Description        : This file provides code for the configuration | 
|---|
| 5 |   *                      of all used GPIO pins. | 
|---|
| 6 |   ****************************************************************************** | 
|---|
| 7 |   * @attention | 
|---|
| 8 |   * | 
|---|
| 9 |   * <h2><center>© Copyright (c) 2019 STMicroelectronics. | 
|---|
| 10 |   * All rights reserved.</center></h2> | 
|---|
| 11 |   * | 
|---|
| 12 |   * This software component is licensed by ST under BSD 3-Clause license, | 
|---|
| 13 |   * the "License"; You may not use this file except in compliance with the | 
|---|
| 14 |   * License. You may obtain a copy of the License at: | 
|---|
| 15 |   *                        opensource.org/licenses/BSD-3-Clause | 
|---|
| 16 |   * | 
|---|
| 17 |   ****************************************************************************** | 
|---|
| 18 |   */ | 
|---|
| 19 |  | 
|---|
| 20 | /* Includes ------------------------------------------------------------------*/ | 
|---|
| 21 | #include "gpio.h" | 
|---|
| 22 | /* USER CODE BEGIN 0 */ | 
|---|
| 23 | #include "ads1260.h" | 
|---|
| 24 | /* USER CODE END 0 */ | 
|---|
| 25 |  | 
|---|
| 26 | /*----------------------------------------------------------------------------*/ | 
|---|
| 27 | /* Configure GPIO                                                             */ | 
|---|
| 28 | /*----------------------------------------------------------------------------*/ | 
|---|
| 29 | /* USER CODE BEGIN 1 */ | 
|---|
| 30 |  | 
|---|
| 31 | /* USER CODE END 1 */ | 
|---|
| 32 |  | 
|---|
| 33 | /** Configure pins as  | 
|---|
| 34 |         * Analog  | 
|---|
| 35 |         * Input  | 
|---|
| 36 |         * Output | 
|---|
| 37 |         * EVENT_OUT | 
|---|
| 38 |         * EXTI | 
|---|
| 39 | */ | 
|---|
| 40 | void MX_GPIO_Init(void) | 
|---|
| 41 | { | 
|---|
| 42 |  | 
|---|
| 43 |   GPIO_InitTypeDef GPIO_InitStruct = {0}; | 
|---|
| 44 |  | 
|---|
| 45 |   /* GPIO Ports Clock Enable */ | 
|---|
| 46 |   __HAL_RCC_GPIOB_CLK_ENABLE(); | 
|---|
| 47 |   __HAL_RCC_GPIOC_CLK_ENABLE(); | 
|---|
| 48 |   __HAL_RCC_GPIOF_CLK_ENABLE(); | 
|---|
| 49 |   __HAL_RCC_GPIOA_CLK_ENABLE(); | 
|---|
| 50 |  | 
|---|
| 51 |   /*Configure GPIO pin Output Level */ | 
|---|
| 52 |   HAL_GPIO_WritePin(GPIOA, ADC_RESET_Pin|ADC_START_CONV_Pin  | 
|---|
| 53 |                     #ifndef MCO_TEST_FUNCTION  | 
|---|
| 54 |                     |OVP_ENABLE_Pin  | 
|---|
| 55 |                     #endif | 
|---|
| 56 |                     |LVP_ENABLE_Pin|LED_FUNCTION_Pin|LED_ERROR_Pin, GPIO_PIN_RESET); | 
|---|
| 57 |  | 
|---|
| 58 |   //HAL_GPIO_WritePin(GPIOB, ADC_POWER_DOWN_Pin, GPIO_PIN_RESET); | 
|---|
| 59 |  | 
|---|
| 60 |   /*Configure GPIO pin Output Level */ | 
|---|
| 61 |   HAL_GPIO_WritePin(AUX_EN_GPIO_Port, AUX_EN_Pin, GPIO_PIN_RESET); | 
|---|
| 62 |  | 
|---|
| 63 |   /*Configure GPIO pin : PtPin */ | 
|---|
| 64 |   GPIO_InitStruct.Pin = ADC_DATA_READY_Pin; | 
|---|
| 65 |   GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING; | 
|---|
| 66 |   GPIO_InitStruct.Pull = GPIO_PULLUP; | 
|---|
| 67 |   HAL_GPIO_Init(ADC_DATA_READY_GPIO_Port, &GPIO_InitStruct); | 
|---|
| 68 |  | 
|---|
| 69 |  | 
|---|
| 70 |  | 
|---|
| 71 |   /*Configure GPIO pins : PAPin PAPin PAPin PAPin  | 
|---|
| 72 |                            PAPin PAPin PAPin PAPin  | 
|---|
| 73 |                            PAPin */ | 
|---|
| 74 |   GPIO_InitStruct.Pin = ADC_RESET_Pin|ADC_START_CONV_Pin | 
|---|
| 75 |                         #ifndef MCO_TEST_FUNCTION  | 
|---|
| 76 |                         |OVP_ENABLE_Pin  | 
|---|
| 77 |                         #endif | 
|---|
| 78 |                         |LVP_ENABLE_Pin|LED_FUNCTION_Pin|LED_ERROR_Pin ; | 
|---|
| 79 |   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | 
|---|
| 80 |   GPIO_InitStruct.Pull = GPIO_NOPULL; | 
|---|
| 81 |   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; | 
|---|
| 82 |   HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); | 
|---|
| 83 |  | 
|---|
| 84 |  | 
|---|
| 85 |   /*Configure GPIO pin : PtPin */ | 
|---|
| 86 |   GPIO_InitStruct.Pin = BUTTON_Pin; | 
|---|
| 87 |   GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | 
|---|
| 88 |   GPIO_InitStruct.Pull = GPIO_PULLUP; | 
|---|
| 89 |   HAL_GPIO_Init(BUTTON_GPIO_Port, &GPIO_InitStruct); | 
|---|
| 90 |  | 
|---|
| 91 |   /*Configure GPIO pin : PtPin */ | 
|---|
| 92 |   GPIO_InitStruct.Pin = AUX_EN_Pin; | 
|---|
| 93 |   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | 
|---|
| 94 |   GPIO_InitStruct.Pull = GPIO_NOPULL; | 
|---|
| 95 |   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; | 
|---|
| 96 |   HAL_GPIO_Init(AUX_EN_GPIO_Port, &GPIO_InitStruct); | 
|---|
| 97 |  | 
|---|
| 98 |   // EDIT ECS | 
|---|
| 99 |     // Reservierter Pin wird zu restore Factory beim Startup | 
|---|
| 100 |     // Funktion wenn ber Jumper auf Masse gesetzt | 
|---|
| 101 |   //GPIO_InitStruct.Pin = RESERVED_1_Pin; | 
|---|
| 102 |   //GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | 
|---|
| 103 |   //GPIO_InitStruct.Pull = GPIO_PULLUP; | 
|---|
| 104 |   //GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; | 
|---|
| 105 |   //HAL_GPIO_Init(RESERVED_1_GPIO_Port, &GPIO_InitStruct); | 
|---|
| 106 |  | 
|---|
| 107 |   //GPIO_InitStruct.Pin = ADC_POWER_DOWN_Pin; | 
|---|
| 108 |   //GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | 
|---|
| 109 |   //GPIO_InitStruct.Pull = GPIO_PULLUP; | 
|---|
| 110 |   //GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; | 
|---|
| 111 |   //HAL_GPIO_Init(ADC_POWER_DOWN_GPIO_Port, &GPIO_InitStruct); | 
|---|
| 112 |  | 
|---|
| 113 |   GPIO_InitStruct.Pin = ADC_RESET_Pin; | 
|---|
| 114 |   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | 
|---|
| 115 |   GPIO_InitStruct.Pull = GPIO_PULLUP; | 
|---|
| 116 |   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; | 
|---|
| 117 |   HAL_GPIO_Init(ADC_RESET_GPIO_Port, &GPIO_InitStruct); | 
|---|
| 118 | } | 
|---|
| 119 |  | 
|---|
| 120 | /* USER CODE BEGIN 2 */ | 
|---|
| 121 | void HAL_GPIO_EXTI_Falling_Callback(uint16_t GPIO_Pin) | 
|---|
| 122 | { | 
|---|
| 123 |   if (GPIO_Pin == ADC_DATA_READY_Pin) | 
|---|
| 124 |   { | 
|---|
| 125 |     newCurrentValue=1; | 
|---|
| 126 |  | 
|---|
| 127 |       | 
|---|
| 128 |   } | 
|---|
| 129 | } | 
|---|
| 130 | /* USER CODE END 2 */ | 
|---|
| 131 |  | 
|---|
| 132 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | 
|---|