Mercurial > public > ostc4
comparison Small_CPU/Src/gpio.c @ 969:81049905d829 Evo_2_23
Zusammenf?hren
author | heinrichsweikamp |
---|---|
date | Sun, 19 Jan 2025 12:02:59 +0100 (2 months ago) |
parents | e9c37071933b |
children |
comparison
equal
deleted
inserted
replaced
968:b9a1710522b1 | 969:81049905d829 |
---|---|
21 | 21 |
22 /* Includes ------------------------------------------------------------------*/ | 22 /* Includes ------------------------------------------------------------------*/ |
23 | 23 |
24 #include "stm32f4xx_hal.h" | 24 #include "stm32f4xx_hal.h" |
25 #include "gpio.h" | 25 #include "gpio.h" |
26 #include "data_exchange.h" | |
27 #include "scheduler.h" | |
26 | 28 |
27 /* Exported variables --------------------------------------------------------*/ | 29 /* Exported variables --------------------------------------------------------*/ |
28 /* Private variables ---------------------------------------------------------*/ | 30 /* Private variables ---------------------------------------------------------*/ |
29 | 31 |
30 /* Private types -------------------------------------------------------------*/ | 32 /* Private types -------------------------------------------------------------*/ |
87 GPIO_InitStructure.Speed = GPIO_SPEED_LOW; | 89 GPIO_InitStructure.Speed = GPIO_SPEED_LOW; |
88 HAL_GPIO_Init( GPIOC, &GPIO_InitStructure); | 90 HAL_GPIO_Init( GPIOC, &GPIO_InitStructure); |
89 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET); | 91 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET); |
90 } | 92 } |
91 | 93 |
94 #ifdef ENABLE_GPIO_V2 | |
95 void GPIO_HandleBuzzer() | |
96 { | |
97 static uint32_t buzzerOnTick = 0; | |
98 static uint8_t buzzerWasOn = 0; | |
99 | |
100 if(((global.dataSendToSlave.data.externalInterface_Cmd & EXT_INTERFACE_BUZZER_ON) != 0)) | |
101 { | |
102 if(!buzzerWasOn) | |
103 { | |
104 buzzerOnTick = HAL_GetTick(); | |
105 GPIO_VIBRATION_ON(); | |
106 /* GPIO_LED_RED_ON(); */ | |
107 | |
108 if(time_elapsed_ms(buzzerOnTick,HAL_GetTick()) > EXT_INTERFACE_BUZZER_ON_TIME_MS) | |
109 { | |
110 GPIO_VIBRATION_OFF(); | |
111 /* GPIO_LED_RED_OFF(); */ | |
112 } | |
113 } | |
114 buzzerWasOn = 1; | |
115 } | |
116 else | |
117 { | |
118 if(buzzerWasOn) | |
119 { | |
120 buzzerOnTick = 0; | |
121 GPIO_VIBRATION_OFF(); | |
122 /* GPIO_LED_RED_OFF(); */ | |
123 } | |
124 buzzerWasOn = 0; | |
125 } | |
126 } | |
127 #endif | |
92 void GPIO_Power_MainCPU_ON(void) { | 128 void GPIO_Power_MainCPU_ON(void) { |
93 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET); | 129 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET); |
94 } | 130 } |
95 | 131 |
96 void GPIO_Power_MainCPU_OFF(void) { | 132 void GPIO_Power_MainCPU_OFF(void) { |