Mercurial > public > ostc4
comparison Small_CPU/Src/gpio.c @ 951:e9c37071933b Evo_2_23
Added vibration warning:
The internal buzzer of the GPIO_V2 may now be used as additional warning notificator. It can be activated using the check button in the customer view menu. The vibration will be active while the warning message is displayed in the dive window. In case the diver is in the menu then the warning will be active for a shorter duration.
author | Ideenmodellierer |
---|---|
date | Sun, 29 Dec 2024 18:29:56 +0100 |
parents | 96cf6c53c934 |
children |
comparison
equal
deleted
inserted
replaced
950:922ee3d7d2f3 | 951:e9c37071933b |
---|---|
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) { |