Add door locking fuction
This commit is contained in:
parent
2146e886a0
commit
3d346863ae
16 changed files with 3545 additions and 3451 deletions
|
@ -21,7 +21,8 @@
|
|||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
|
@ -107,18 +108,21 @@ int main(void) {
|
|||
uint8_t payload[3] = { 0x01, HAL_GPIO_ReadPin(GPIOA,
|
||||
GPIO_PIN_7), 0xFF };
|
||||
HAL_UART_Transmit(&huart2, payload, 3, 1500);
|
||||
} else if (uart_buffer[0] == 0x02) {
|
||||
//HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_9);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, uart_buffer[1]);
|
||||
}
|
||||
}
|
||||
uart_index = 0;
|
||||
memset(uart_buffer, 0, 10);
|
||||
}
|
||||
}
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
/* USER CODE BEGIN 3 */
|
||||
|
||||
/* USER CODE END 3 */
|
||||
}
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
/* USER CODE BEGIN 3 */
|
||||
|
||||
/* USER CODE END 3 */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -212,7 +216,7 @@ static void MX_GPIO_Init(void) {
|
|||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, LD2_Pin | Door_Lock_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin : B1_Pin */
|
||||
GPIO_InitStruct.Pin = B1_Pin;
|
||||
|
@ -220,12 +224,12 @@ static void MX_GPIO_Init(void) {
|
|||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : LD2_Pin */
|
||||
GPIO_InitStruct.Pin = LD2_Pin;
|
||||
/*Configure GPIO pins : LD2_Pin Door_Lock_Pin */
|
||||
GPIO_InitStruct.Pin = LD2_Pin | Door_Lock_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : Door_Sensor_Pin */
|
||||
GPIO_InitStruct.Pin = Door_Sensor_Pin;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue