adjust pin
This commit is contained in:
parent
8394bf9892
commit
f6946613ad
12 changed files with 10551 additions and 10499 deletions
|
@ -362,6 +362,9 @@ static void MX_GPIO_Init(void)
|
|||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(ALARM_GPIO_Port, ALARM_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOA, LD2_Pin|Door_Lock_Pin, GPIO_PIN_RESET);
|
||||
|
||||
|
@ -371,6 +374,13 @@ static void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : ALARM_Pin */
|
||||
GPIO_InitStruct.Pin = ALARM_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(ALARM_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : LD2_Pin Door_Lock_Pin */
|
||||
GPIO_InitStruct.Pin = LD2_Pin|Door_Lock_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
|
@ -455,11 +465,13 @@ void startDoorHandleTask(void *argument)
|
|||
{
|
||||
/* USER CODE BEGIN startDoorHandleTask */
|
||||
/* Infinite loop */
|
||||
HAL_GPIO_WritePin(DOOR_LOCK_BANK, DOOR_LOCK_PIN, 1);
|
||||
for (;;) {
|
||||
door_state = HAL_GPIO_ReadPin(DOOR_SENSOR_BANK, DOOR_SENSOR_PIN);
|
||||
door_state = !HAL_GPIO_ReadPin(DOOR_SENSOR_BANK, DOOR_SENSOR_PIN);
|
||||
if (door_lock_state != door_lock_state_command) {
|
||||
if (door_lock_state_command == DOOR_LOCK_LOCKED) {
|
||||
if (door_state == DOOR_STATE_CLOSED) {
|
||||
osDelay(500);
|
||||
HAL_GPIO_WritePin(DOOR_LOCK_BANK, DOOR_LOCK_PIN, 1);
|
||||
door_lock_state = DOOR_LOCK_LOCKED;
|
||||
door_lock_waiting = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue