STM32f4 HAL library
Hi, I am using the STM32F4. Now i learning to use the HAL library so i want to ensure i got the same result with and without using the HAL library but now i face some problem.
I used the HAL library to control the LED by press the button it is work.
void fnvdAss2_V2_Main(void)
{
#ifdef QUESTION_1
GPIO_PinState boButton_state; // Variable to store the state of the button
printf("Hello Cruel World\n");
while (1)
{
boButton_state = HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin);
HAL_GPIO_WritePin(LD6_GPIO_Port, LD6_Pin, boButton_state);
}
#endif
BUT it is not work without using the HAL library can anyone help me check what is going error in my code?
void fnvdAss2_V2_Main(void)
{
#ifdef QUESTION_1
GPIO_PinState boButton_state; // Variable to store the state of the button
printf("Hello Cruel World\n");
while (1)
{
if((GPIOA->IDR & B1_Pin) != GPIO_PIN_RESET)
{
boButton_state = GPIO_PIN_SET;
}
else
{
boButton_state = GPIO_PIN_RESET;
}
return boButton_state;
if(boButton_state != GPIO_PIN_RESET)
{
GPIOD->BSRR = LD6_Pin;
}
else
{
GPIOD->BSRR = LD6_Pin << 16U;
}
}
