Hi all I am experimenting for a new applications.
I wrote a simple application to test the hardware it only displays a button and triggers an event if pressed.
Touch screen controller is the AD7846 and its routines are implemented in GUI_X_Touch.c returning ADC readings in MEASURE_X and MEASURE_Y functions.
GUI_TOUCH_Exec(); is polled in an interrupt routing that fires every 20mS (GPIO toggle is for debug...)
than this is the main function (only relevant part shown).
Well: if to check the button pressing I use if(BUTTON_IsPressed(hButton) == 1) the program works, if, like in many example I use (GUI_GetKey() == GUI_ID_BUTTON0) the program got stuck and also the interrupt routine does not fire anymore (no led toggle). You can only reset the MCU.
What I can see with the debugger is that the GUI_GetKey() function never returns true. BTW the program never arise a fault exception, so I cannot explain the ISR lockup.
Any advice?
Many thanks.
Display All
I wrote a simple application to test the hardware it only displays a button and triggers an event if pressed.
Touch screen controller is the AD7846 and its routines are implemented in GUI_X_Touch.c returning ADC readings in MEASURE_X and MEASURE_Y functions.
GUI_TOUCH_Exec(); is polled in an interrupt routing that fires every 20mS (GPIO toggle is for debug...)
than this is the main function (only relevant part shown).
Well: if to check the button pressing I use if(BUTTON_IsPressed(hButton) == 1) the program works, if, like in many example I use (GUI_GetKey() == GUI_ID_BUTTON0) the program got stuck and also the interrupt routine does not fire anymore (no led toggle). You can only reset the MCU.
What I can see with the debugger is that the GUI_GetKey() function never returns true. BTW the program never arise a fault exception, so I cannot explain the ISR lockup.
Any advice?
Many thanks.
C Source Code
- int main(void)
- {
- HAL_Init();
- SystemClock_Config();
- MX_GPIO_Init();
- MX_I2C2_Init();
- MX_CRC_Init();
- MX_FSMC_Init();
- MX_SPI1_Init();
- MX_RTC_Init();
- MX_TIM6_Init();
- GUI_Init();
- HAL_TIM_Base_Start_IT(&htim6);
- CALIBRATION_Check();
- GUI_SetBkColor(GUI_BLACK);
- GUI_Clear();
- hButton = BUTTON_CreateEx(110,110,100,40,0,WM_CF_SHOW,0, GUI_ID_BUTTON0);
- BUTTON_SetText(hButton, "Click me...");
- GUI_Exec();
- while (1) {
- if (BUTTON_IsPressed(hButton)) {
- BUTTON_Delete(hButton);
- GUI_ClearRect(0,0,479,271);
- GUI_SetColor(GUI_RED);
- GUI_DispStringAt("CIAO", 16, 16);
- break;
- }
- GUI_Delay(10);
- while(1){}
- }