annotate Small_CPU/Src/gpio.c @ 937:d461d9e89e3c Evo_2_23

Compile switch for RTE sleep debug: there was already a compiler switch for enabling debugging while RTE is in sleep but the switches were distributed across the code => to make selection easier they are now part of the configuration.h
author Ideenmodellierer
date Tue, 10 Dec 2024 20:59:37 +0100
parents f2494a708f52
children df87dbfc9c21
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
935
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
1 /**
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
2 ******************************************************************************
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
3 * @file gpio.c
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
4 * @author heinrichs weikamp gmbh
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
5 * @version V0.0.1
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
6 * @date 08-Dec-2024
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
7 * @brief Definitions for GPIO operations (GPIO_V2)
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
8 *
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
9 @verbatim
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
10 ==============================================================================
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
11 ##### How to use #####
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
12 ==============================================================================
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
13 @endverbatim
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
14 ******************************************************************************
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
15 * @attention
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
16 *
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
17 * <h2><center>&copy; COPYRIGHT(c) 2024 heinrichs weikamp</center></h2>
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
18 *
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
19 ******************************************************************************
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
20 */
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
21
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
22 /* Includes ------------------------------------------------------------------*/
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
23
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
24 #include "stm32f4xx_hal.h"
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
25 #include "gpio.h"
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
26
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
27 /* Exported variables --------------------------------------------------------*/
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
28 /* Private variables ---------------------------------------------------------*/
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
29
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
30 /* Private types -------------------------------------------------------------*/
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
31
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
32 /* Private function prototypes -----------------------------------------------*/
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
33
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
34 /* Exported functions --------------------------------------------------------*/
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
35 void GPIO_LEDs_VIBRATION_Init(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
36 GPIO_InitTypeDef GPIO_InitStructure;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
37
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
38 __GPIOA_CLK_ENABLE();
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
39 GPIO_InitStructure.Pin = LED_CONTROL_PIN_RED;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
40 GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
41 GPIO_InitStructure.Pull = GPIO_PULLUP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
42 GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
43 HAL_GPIO_Init( GPIOA, &GPIO_InitStructure);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
44 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_RED, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
45
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
46 GPIO_InitStructure.Pin = LED_CONTROL_PIN_GREEN;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
47 GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
48 GPIO_InitStructure.Pull = GPIO_PULLUP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
49 GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
50 HAL_GPIO_Init( GPIOA, &GPIO_InitStructure);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
51 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_GREEN, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
52
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
53 GPIO_InitStructure.Pin = VIBRATION_CONTROL_PIN;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
54 GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
55 GPIO_InitStructure.Pull = GPIO_PULLDOWN;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
56 GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
57 HAL_GPIO_Init( GPIOA, &GPIO_InitStructure);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
58 HAL_GPIO_WritePin( GPIOA, VIBRATION_CONTROL_PIN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
59
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
60 __GPIOB_CLK_ENABLE();
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
61 GPIO_InitStructure.Pin = GPS_POWER_CONTROL_PIN;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
62 GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
63 GPIO_InitStructure.Pull = GPIO_PULLUP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
64 GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
65 HAL_GPIO_Init( GPIOB, &GPIO_InitStructure);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
66 HAL_GPIO_WritePin( GPIOB, GPS_POWER_CONTROL_PIN, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
67
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
68 GPIO_InitStructure.Pin = GPS_BCKP_CONTROL_PIN;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
69 GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
70 GPIO_InitStructure.Pull = GPIO_PULLDOWN;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
71 GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
72 HAL_GPIO_Init( GPIOB, &GPIO_InitStructure);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
73 HAL_GPIO_WritePin( GPIOB, GPS_BCKP_CONTROL_PIN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
74 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
75
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
76 void GPIO_Power_MainCPU_Init(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
77 GPIO_InitTypeDef GPIO_InitStructure;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
78 __GPIOC_CLK_ENABLE();
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
79 GPIO_InitStructure.Pin = MAINCPU_CONTROL_PIN;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
80 GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
81 GPIO_InitStructure.Pull = GPIO_PULLUP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
82 GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
83 HAL_GPIO_Init( GPIOC, &GPIO_InitStructure);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
84 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
85 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
86
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
87 void GPIO_Power_MainCPU_ON(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
88 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
89 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
90
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
91 void GPIO_Power_MainCPU_OFF(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
92 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
93 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
94
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
95 #ifdef ENABLE_GPIO_V2
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
96 void GPIO_LED_GREEN_ON(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
97 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_GREEN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
98 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
99
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
100 void GPIO_LED_GREEN_OFF(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
101 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_GREEN, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
102 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
103
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
104 void GPIO_LED_RED_ON(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
105 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_RED, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
106 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
107
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
108 void GPIO_LED_RED_OFF(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
109 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_RED, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
110 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
111
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
112 void GPIO_VIBRATION_ON(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
113 HAL_GPIO_WritePin( GPIOA, VIBRATION_CONTROL_PIN, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
114 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
115
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
116 void GPIO_VIBRATION_OFF(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
117 HAL_GPIO_WritePin( GPIOA, VIBRATION_CONTROL_PIN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
118 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
119
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
120 void GPIO_GPS_ON(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
121 HAL_GPIO_WritePin( GPIOB, GPS_POWER_CONTROL_PIN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
122 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
123
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
124 void GPIO_GPS_OFF(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
125 HAL_GPIO_WritePin( GPIOB, GPS_POWER_CONTROL_PIN, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
126 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
127
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
128 void GPIO_GPS_BCKP_ON(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
129 HAL_GPIO_WritePin( GPIOB, GPS_BCKP_CONTROL_PIN, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
130 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
131
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
132 void GPIO_GPS_BCKP_OFF(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
133 HAL_GPIO_WritePin( GPIOB, GPS_BCKP_CONTROL_PIN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
134 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
135 #endif
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
136
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
137 /* Private functions ---------------------------------------------------------*/
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
138
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
139
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
140 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/