diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 24ae69c..fc36963 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/Core/Src/main.c b/Core/Src/main.c index ee89af5..856c67c 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -32,7 +32,7 @@ int main(void) HAL_GPIO_WritePin(GPIOA, LR_OUT_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOA, RL_OUT_Pin, GPIO_PIN_RESET); // uint8_t slave_present = HAL_GPIO_ReadPin(GPIOA, Slave_Detect_Pin); - +// // if(slave_present == TRUE) // { // HAL_GPIO_WritePin(Last_Node_Switch_GPIO_Port, feed_back_Pin, GPIO_PIN_RESET); @@ -46,21 +46,21 @@ int main(void) { -// feed_back_present = HAL_GPIO_ReadPin(GPIOA, feed_back_Pin); -// if(feed_back_present == TRUE) { -// RL_mode = TRUE; -// } -// else { -// RL_mode = FALSE; -// } -// -// slave_master = HAL_GPIO_ReadPin(GPIOA, RL_OUT_Pin); -// if(slave_master == TRUE) { -// LR_mode = TRUE; -// } -// else { -// LR_mode = FALSE; -// } + bool feed_back_present = HAL_GPIO_ReadPin(GPIOA, feed_back_Pin); + if(feed_back_present == TRUE) { + LR_mode = TRUE; + } + else { + LR_mode = FALSE; + } + + bool slave_master = HAL_GPIO_ReadPin(GPIOA, RL_OUT_Pin); + if(slave_master == TRUE) { + RL_mode = TRUE; + } + else { + RL_mode = FALSE; + } // / Update LED states based on current mode / if(AMBERFLASH_mode) { @@ -85,7 +85,7 @@ int main(void) HAL_GPIO_WritePin(GPIOA, Amber_LED_OUT_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOA, Red_LED_OUT_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOA, LR_OUT_Pin, GPIO_PIN_RESET); -// HAL_GPIO_WritePin(GPIOA, RL_OUT_Pin, GPIO_PIN_SET); this line was to check whether the interrupt is working fine or not + HAL_GPIO_WritePin(GPIOA, RL_OUT_Pin, GPIO_PIN_SET); //this line was to check whether the interrupt is working fine or not // updated section here the mode is changed to output since the slave acts as origin of input @@ -188,7 +188,7 @@ static void MX_GPIO_Init(void) } -/// USER CODE BEGIN 4 / + void HAL_GPIO_EXTI_Rising_Callback(uint16_t GPIO_Pin) { if (GPIO_Pin == Red_IN_Pin) {