FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [February 2016 Threads] FreeRTOS polling button on STM32F11Posted by laskar01 on February 7, 2016 Hi, I have this initialization for a button
~~~~
/*Configure GPIO pin : B1Pin */
GPIOInitStruct.Pin = B1Pin;
GPIOInitStruct.Mode = GPIOMODEINPUT;//GPIOMODEEVTRISING;
GPIOInitStruct.Pull = GPIONOPULL;
HALGPIOInit(B1GPIOPort, &GPIOInitStruct);
~~~~
Why is the button always read as 1, regardless if the button is pushed or not, has an onboard pull-upresistor
if(HAL_GPIO_ReadPin(GPIOx, B1_Pin == 0)){...
FreeRTOS polling button on STM32F11Posted by heinbali01 on February 8, 2016 Hi Lasse,
Don't you have a typo here?
if(HAL_GPIO_ReadPin(GPIOx, B1_Pin == 0)){...
( look at 'B1_Pin == 0' which probably evaluates to 0 )
The parameters of HAL_GPIO_ReadPin() are:
~~~~~
GPIOPinState HALGPIOReadPin(
GPIOTypeDef* GPIOx,
uint16t GPIOPin );
~~~~~
For example:
if( HAL_GPIO_ReadPin( B1_GPIO_Port, B1_Pin ) == 0 )
{
}
else
{
}
Regards.
FreeRTOS polling button on STM32F11Posted by rtel on February 8, 2016 With respect, this is a FreeRTOS forum, not a general programming forum, and to keep this resource valuable to our users it is important this remains the case. Your question does not appear to be related to FreeRTOS in any way, so in future I would appreciate it if you were to post similar such questions to a more appropriate forum - such as a general programming news group, stack overflow, or in this particular case, the ST forum as you appear to be asking a question about their drivers.
FreeRTOS polling button on STM32F11Posted by laskar01 on February 8, 2016 Sorry, it was only I typo, didn't have it in my code :(
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|