ReykorSlave/back_up_for_stm_code/backup_rey.txt

82 lines
2.7 KiB
Plaintext

HAL_GPIO_WritePin(GPIOA, Amber_LED_OUT_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOB, Red_LED_OUT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, LR_LED_OUT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, RL_LED_OUT_Pin, GPIO_PIN_RESET);
while (1)
{
if(AMBERFLASH_mode){
HAL_GPIO_WritePin(GPIOA, Amber_LED_OUT_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOB, Red_LED_OUT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, LR_LED_OUT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, RL_LED_OUT_Pin, GPIO_PIN_RESET);
}/* USER CODE END WHILE */
else if(REDLEDFLASH_mode){
HAL_GPIO_WritePin(GPIOA, Amber_LED_OUT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, Red_LED_OUT_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA, LR_LED_OUT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, RL_LED_OUT_Pin, GPIO_PIN_RESET);
}
else if(LR_mode){
HAL_GPIO_WritePin(GPIOA, Amber_LED_OUT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, Red_LED_OUT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, LR_LED_OUT_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA, RL_LED_OUT_Pin, GPIO_PIN_RESET);
}
else if(RL_mode){
HAL_GPIO_WritePin(GPIOA, Amber_LED_OUT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, Red_LED_OUT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, LR_LED_OUT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, RL_LED_OUT_Pin, GPIO_PIN_SET);
}
void HAL_GPIO_EXTI_Rising_Callback(uint16_t GPIO_Pin) {
if (GPIO_Pin == Red_LED_IN_Pin ) {
// Rising edge detected
// Handle the rising edge
RL_mode = false;
LR_mode = false;
AMBERFLASH_mode = false;
REDLEDFLASH_mode = true;
} else if (GPIO_Pin == Amber_LED_IN_Pin ) {
// Rising edge detected
// Handle the rising edge
RL_mode = false;
LR_mode = false;
REDLEDFLASH_mode = false;
AMBERFLASH_mode = true;
} else if (GPIO_Pin == Amber_LED_LR_Pin) {
// Rising edge detected
// Handle the rising edge
RL_mode = false;
AMBERFLASH_mode = false;
REDLEDFLASH_mode = false;
LR_mode = false;
} else if ((GPIO_Pin == Amber_LED_RL_Pin) || (GPIO_Pin == Last_Node_Signal_Pin) ) {
// Rising edge detected
// Handle the rising edge
AMBERFLASH_mode = false;
REDLEDFLASH_mode = false;
LR_mode = false;
RL_mode = true;
}
}
void HAL_GPIO_EXTI_Falling_Callback(uint16_t GPIO_Pin) {
if (GPIO_Pin == Red_LED_IN_Pin ) {
// Rising edge detected
// Handle the rising edge
RL_mode = false;
LR_mode = false;
AMBERFLASH_mode = false;
REDLEDFLASH_mode = false;
} else if (GPIO_Pin == Amber_Flash_IN_Pin ) {
// Falling edge detected
// Handle the falling edge
RL_mode = false;
LR_mode = false;
REDLEDFLASH_mode = false;
AMBERFLASH_mode = false;
}
}