Hi Tim,
Thanks a lot for the reply.
I am not sure if the scope of use is outside Embedded Wizard, because I do not really know the limits of the scope. However, here I am attaching the code which I am using:
int DeviceDriver_ProcessData( void ){
int needUpdate = 0;
#ifdef _ApplicationDeviceClass_
if ( IsHardButtonDown )
ButtonCounter++;
else
ButtonCounter = 0;
if ( DeviceObject == 0 )
return 0;
#ifdef _ApplicationDeviceClass__UpdateHardButtonCounter_
ApplicationDeviceClass__UpdateHardButtonCounter( DeviceObject, (XInt32)ButtonCounter );
#endif
if ( IsHardButtonPressed ){
#ifdef _ApplicationDeviceClass__TriggerHardButtonEvent_
ApplicationDeviceClass__TriggerHardButtonEvent( DeviceObject );
#endif
IsHardButtonPressed = 0;
needUpdate = 1;
}
char ch = EwBspConsoleGetCharacter();
if ( ( ( ch >= 'A' ) && ( ch <= 'Z' ) ) || ( ( ch >= 'a' ) && ( ch <= 'z' ) ) || ( ( ch >= '0' ) && ( ch <= '9' ) ) || ( ch == ' ' ) )
{
EwPrint("%c\n",ch);
ApplicationDeviceClass__UpdateTerminalString( DeviceObject, (XChar)ch );
needUpdate = 1;
}
#endif
return needUpdate;
}
This is the function DeviceDrivers_ProcessData which is regularly called by the EwProcess() function inside the ewmain.c. As you may notice, I have only added the last lines which start with "char ch = EwBspConsoleGetCharacter()". Thes rest of the code is the one generated by Embedded Wizard using the example DeviceIntegration. I believe it is still within the scope of the Embedded Wizard,.
Anyway, I have 2 questions related to the code above:
1. I managed to get single characters in the beginning, but now it is suddenly not working anymore. It does not react to input from the HTerm which I am using to send data via UART. Do you have any idea why it does not read the characters?
2. The second question is related to the user button in the STM32F429 Discovery board. It is the blue button on the board and the one which is checked whether it is pressed or not by the function above. The input from the button works fine, however there is a strange behavior which I do not understand. Any time I press the button, the function EwBspConsoleGetCharacter() returns the space (' ') character. Is it supposed to do so? I looked at what the EwBspConsoleGetCharacter()does and it indeed uses the HAL_UART_Receive() function, which reads the received characters from the USART1 which is initialized in the ew_bsp_console.c file as follows:
#define USARTx_TX_PIN GPIO_PIN_9
#define USARTx_TX_GPIO_PORT GPIOA
#define USARTx_RX_PIN GPIO_PIN_10
The user button on the other side is connected to pin PA0, which is none of the USART1 pins. Why does the EwBspConsoleGetCharacter() return a valid character then when the button is pressed?
I am also attaching the project, so that you can check it on your own as well.
https://ask.embedded-wizard.de/?qa=blob&qa_blobid=7361981857356375701
Thank you very much for the support. I apologize for the long explanation, but I hope it tells clearly what my problem is.
Bests,
Gazi