annotate Small_CPU/Src/gpio.c @ 949:c6b858f2e025 Evo_2_23 tip

GNSS UTC in Date-Time menu: The UTC time provided by the gnss module is not shown in the date-time settings menu. If a valid time signal is available then the OSTC RTC may be set to it by selecting the UTC menu entry. The time zone has to be selected manually. This is possible using a separate edit line.
author Ideenmodellierer
date Sun, 22 Dec 2024 21:19:21 +0100
parents 96cf6c53c934
children
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);
938
df87dbfc9c21 Update GPIO:
Ideenmodellierer
parents: 935
diff changeset
59 }
df87dbfc9c21 Update GPIO:
Ideenmodellierer
parents: 935
diff changeset
60
df87dbfc9c21 Update GPIO:
Ideenmodellierer
parents: 935
diff changeset
61 void GPIO_GNSS_Init()
df87dbfc9c21 Update GPIO:
Ideenmodellierer
parents: 935
diff changeset
62 {
df87dbfc9c21 Update GPIO:
Ideenmodellierer
parents: 935
diff changeset
63 GPIO_InitTypeDef GPIO_InitStructure;
935
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
64
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
65 __GPIOB_CLK_ENABLE();
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
66 GPIO_InitStructure.Pin = GPS_POWER_CONTROL_PIN;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
67 GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
68 GPIO_InitStructure.Pull = GPIO_PULLUP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
69 GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
70 HAL_GPIO_Init( GPIOB, &GPIO_InitStructure);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
71 HAL_GPIO_WritePin( GPIOB, GPS_POWER_CONTROL_PIN, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
72
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
73 GPIO_InitStructure.Pin = GPS_BCKP_CONTROL_PIN;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
74 GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
75 GPIO_InitStructure.Pull = GPIO_PULLDOWN;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
76 GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
77 HAL_GPIO_Init( GPIOB, &GPIO_InitStructure);
947
96cf6c53c934 GNSS sleep mode:
Ideenmodellierer
parents: 938
diff changeset
78 HAL_GPIO_WritePin( GPIOB, GPS_BCKP_CONTROL_PIN, GPIO_PIN_SET);
935
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
79 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
80
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
81 void GPIO_Power_MainCPU_Init(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
82 GPIO_InitTypeDef GPIO_InitStructure;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
83 __GPIOC_CLK_ENABLE();
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
84 GPIO_InitStructure.Pin = MAINCPU_CONTROL_PIN;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
85 GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
86 GPIO_InitStructure.Pull = GPIO_PULLUP;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
87 GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
88 HAL_GPIO_Init( GPIOC, &GPIO_InitStructure);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
89 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
90 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
91
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
92 void GPIO_Power_MainCPU_ON(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
93 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
94 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
95
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
96 void GPIO_Power_MainCPU_OFF(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
97 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_SET);
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 #ifdef ENABLE_GPIO_V2
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
101 void GPIO_LED_GREEN_ON(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
102 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_GREEN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
103 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
104
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
105 void GPIO_LED_GREEN_OFF(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
106 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_GREEN, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
107 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
108
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
109 void GPIO_LED_RED_ON(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
110 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_RED, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
111 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
112
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
113 void GPIO_LED_RED_OFF(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
114 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_RED, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
115 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
116
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
117 void GPIO_VIBRATION_ON(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
118 HAL_GPIO_WritePin( GPIOA, VIBRATION_CONTROL_PIN, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
119 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
120
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
121 void GPIO_VIBRATION_OFF(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
122 HAL_GPIO_WritePin( GPIOA, VIBRATION_CONTROL_PIN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
123 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
124
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
125 void GPIO_GPS_ON(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
126 HAL_GPIO_WritePin( GPIOB, GPS_POWER_CONTROL_PIN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
127 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
128
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
129 void GPIO_GPS_OFF(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
130 HAL_GPIO_WritePin( GPIOB, GPS_POWER_CONTROL_PIN, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
131 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
132
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
133 void GPIO_GPS_BCKP_ON(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
134 HAL_GPIO_WritePin( GPIOB, GPS_BCKP_CONTROL_PIN, GPIO_PIN_SET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
135 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
136
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
137 void GPIO_GPS_BCKP_OFF(void) {
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
138 HAL_GPIO_WritePin( GPIOB, GPS_BCKP_CONTROL_PIN, GPIO_PIN_RESET);
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
139 }
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
140 #endif
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
141
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
142 /* Private functions ---------------------------------------------------------*/
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
143
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
144
f2494a708f52 Added unit files for GPIO:
Ideenmodellierer
parents:
diff changeset
145 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/