DIY Logging Volt/Ampmeter
main.h
Go to the documentation of this file.
1 /* USER CODE BEGIN Header */
2 
3 /***************************************************************************//**
4  * @file main.h
5  * @brief Main header-file for the high-precision logging voltage/current meter project.
6  * @version 1.0
7  * @author Brecht Van Eeckhoudt
8  *
9  * ******************************************************************************
10  *
11  * @section Versions
12  *
13  * @li v1.0: Initial version.
14  *
15  * ******************************************************************************
16  *
17  * @attention
18  * Due to mistakes in the schematic/PCB-layout of the first hardware board
19  * the functionality of some GPIO pins is swapped:
20  * - `UART1_ENout` is not used, but `UART1_3V3out` instead.
21  * - `SW0`and `SW0` are swapped with `GPIO1`and `GPIO2` so the internal
22  * circuitry can be used for encoder-turn logic.
23  *
24  * ******************************************************************************
25  *
26  * @section License
27  *
28  * **Copyright (C) 2021 - Brecht Van Eeckhoudt**
29  *
30  * This program is free software: you can redistribute it and/or modify
31  * it under the terms of the **GNU General Public License** as published by
32  * the Free Software Foundation, either **version 3** of the License, or
33  * (at your option) any later version.
34  *
35  * This program is distributed in the hope that it will be useful,
36  * but WITHOUT ANY WARRANTY; without even the implied warranty of
37  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38  * GNU General Public License for more details.
39  *
40  * *A copy of the GNU General Public License can be found in the `LICENSE`
41  * file along with this source code.*
42  *
43  * @n
44  *
45  * Some methods also use code obtained from examples from STMicroelectronics.
46  *
47  * **Copyright (c) 2020 STMicroelectronics. All rights reserved.**
48  *
49  * These sections are licensed by ST under BSD 3-Clause license, the "License";
50  * One may not use these example files except in compliance with the License.
51  * One may obtain a copy of the License at: opensource.org/licenses/BSD-3-Clause
52  *
53  ******************************************************************************/
54 
55 /* USER CODE END Header */
56 
57 /* Define to prevent recursive inclusion -------------------------------------*/
58 #ifndef __MAIN_H
59 #define __MAIN_H
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 /* Includes ------------------------------------------------------------------*/
66 #include "stm32f1xx_hal.h"
67 #include "stm32f1xx_ll_adc.h"
68 #include "stm32f1xx_ll_rcc.h"
69 #include "stm32f1xx_ll_bus.h"
70 #include "stm32f1xx_ll_system.h"
71 #include "stm32f1xx_ll_exti.h"
72 #include "stm32f1xx_ll_cortex.h"
73 #include "stm32f1xx_ll_utils.h"
74 #include "stm32f1xx_ll_pwr.h"
75 #include "stm32f1xx_ll_dma.h"
76 #include "stm32f1xx_ll_rtc.h"
77 #include "stm32f1xx_ll_tim.h"
78 #include "stm32f1xx_ll_usart.h"
79 #include "stm32f1xx.h"
80 #include "stm32f1xx_ll_gpio.h"
81 
82 /* Private includes ----------------------------------------------------------*/
83 /* USER CODE BEGIN Includes */
84 
85 /* USER CODE END Includes */
86 
87 /* Exported types ------------------------------------------------------------*/
88 /* USER CODE BEGIN ET */
89 
90 /* USER CODE END ET */
91 
92 /* Exported constants --------------------------------------------------------*/
93 /* USER CODE BEGIN EC */
94 
95 /* USER CODE END EC */
96 
97 /* Exported macro ------------------------------------------------------------*/
98 /* USER CODE BEGIN EM */
99 
100 /* USER CODE END EM */
101 
102 /* Exported functions prototypes ---------------------------------------------*/
103 void Error_Handler(void);
104 
105 /* USER CODE BEGIN EFP */
106 
107 /* USER CODE END EFP */
108 
109 /* Private defines -----------------------------------------------------------*/
110 #define SW0_Pin LL_GPIO_PIN_0
111 #define SW0_GPIO_Port GPIOA
112 #define SW0_EXTI_IRQn EXTI0_IRQn
113 #define SW1_Pin LL_GPIO_PIN_1
114 #define SW1_GPIO_Port GPIOA
115 #define SW1_EXTI_IRQn EXTI1_IRQn
116 #define V_ENin_Pin LL_GPIO_PIN_4
117 #define V_ENin_GPIO_Port GPIOA
118 #define A_ENin_Pin LL_GPIO_PIN_1
119 #define A_ENin_GPIO_Port GPIOB
120 #define LED_Pin LL_GPIO_PIN_2
121 #define LED_GPIO_Port GPIOB
122 #define Buzzer_Pin LL_GPIO_PIN_13
123 #define Buzzer_GPIO_Port GPIOB
124 #define UART1_3V3out_Pin LL_GPIO_PIN_14
125 #define UART1_3V3out_GPIO_Port GPIOB
126 #define Relay_Pin LL_GPIO_PIN_8
127 #define Relay_GPIO_Port GPIOA
128 #define ENC_Key_Pin LL_GPIO_PIN_5
129 #define ENC_Key_GPIO_Port GPIOB
130 #define ENC_Key_EXTI_IRQn EXTI9_5_IRQn
131 #define UART1_ENout_Pin LL_GPIO_PIN_8
132 #define UART1_ENout_GPIO_Port GPIOB
133 #define UART1_DTRout_Pin LL_GPIO_PIN_9
134 #define UART1_DTRout_GPIO_Port GPIOB
135 /* USER CODE BEGIN Private defines */
136 
137 #define GPIO1_Pin LL_GPIO_PIN_5
138 #define GPIO1_Port GPIOA
139 #define GPIO2_Pin LL_GPIO_PIN_13
140 #define GPIO2_Port GPIOC
141 
142 /* USER CODE END Private defines */
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif /* __MAIN_H */
149 
150 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
stm32f1xx_ll_rtc.h
Header file of RTC LL module.
stm32f1xx_hal.h
This file contains all the functions prototypes for the HAL module driver.
stm32f1xx_ll_adc.h
Header file of ADC LL module.
stm32f1xx_ll_pwr.h
Header file of PWR LL module.
stm32f1xx_ll_cortex.h
Header file of CORTEX LL module.
stm32f1xx_ll_dma.h
Header file of DMA LL module.
stm32f1xx_ll_utils.h
Header file of UTILS LL module.
stm32f1xx_ll_gpio.h
Header file of GPIO LL module.
stm32f1xx_ll_bus.h
Header file of BUS LL module.
stm32f1xx_ll_tim.h
Header file of TIM LL module.
stm32f1xx_ll_usart.h
Header file of USART LL module.
stm32f1xx.h
CMSIS STM32F1xx Device Peripheral Access Layer Header File.
Error_Handler
void Error_Handler(void)
This function is executed in case of error occurrence.
Definition: main.c:1102
stm32f1xx_ll_exti.h
Header file of EXTI LL module.
stm32f1xx_ll_rcc.h
Header file of RCC LL module.
stm32f1xx_ll_system.h
Header file of SYSTEM LL module.