shadow12348 Posted August 16, 2018 Report Share Posted August 16, 2018 (edited) Hi everyone, I've got uGFX working on my STM32L496ZG with an ILI9341 SPI display. OS - RAW32 The touch works, the library functions all work fine. I'm stuck with one issue where I have a simple screen with 4 buttons on it and listening for a touch event through geventEventWait(&gl, TIME_INFINITE); When I'm using this everything works fine and I can get the buttons to do what I want. But if I change the timeout to anything other than TIME_INFINITE OR even just comment out this single line, the buttons are not drawn on the screen. This is basically what I am doing static void drawHomeButtonsWidget(void) { GWidgetInit wi; gwinWidgetClearInit(&wi); wi.g.show = TRUE; wi.g.x = 35; wi.g.y = 20; wi.g.width = 32; wi.g.height = 32; //ghLogo = gwinImageCreate(0, &wi.g); gwinImageOpenFile(ghLogo, "test.bmp"); // Apply the button parameters wi.g.width = 240; wi.g.height = 50; wi.g.y = 120; wi.g.x = 0; wi.text = "A"; ghButtonSend = gwinButtonCreate(0, &wi); wi.g.y = 170; wi.g.x = 0; wi.text = "B"; ghButtonReceive = gwinButtonCreate(0, &wi); wi.g.y = 220; wi.g.x = 0; wi.text = "C"; ghButtonTransactions = gwinButtonCreate(0, &wi); wi.g.y = 270; wi.g.x = 0; wi.text = "D"; ghButtonSettings = gwinButtonCreate(0, &wi); } So here are my questions - 1. Why are no buttons drawn when I change TIME_INFINITE to another value OR even just remove the line? (I do check for NULL if it is not TIME_INFINITE) 2. How can I have geventEventWait be non-blocking? I would like to listen for touch events but be able to receive/send UART messages parallely or do other work infact. 3. When I display an image within this same widget, only the image and the first button are drawn, the other buttons are not drawn. Can't seem to figure out why this is. Any help is appreciated! Thanks in advance! Edited August 16, 2018 by shadow12348 Link to comment Share on other sites More sharing options...
shadow12348 Posted August 20, 2018 Author Report Share Posted August 20, 2018 Still stuck with this, any help anyone? Link to comment Share on other sites More sharing options...
inmarket Posted August 20, 2018 Report Share Posted August 20, 2018 1. Widget drawing requires a gtimer event to fire. As RAW32 is non-preemptive it requires a gfxYield() to trigger that context switch. When you comment out geventWait, unless you put a gfxYield or gfxSleepMilliseconds call in you will not get drawing. Any geventWait should be sufficient even with only a 1ms delay (even a TIME_IMMEDIATE I think). 2. Users are commonly interrupt driven and therefore Async so there should be no need for a non-blocking geventWait. The strategy is to create a gtimer task to read the uart buffer data. You can add a gtimerJabI call in your interrupt handler when your uart buffer has enough data which will then wake up the gtimer task. If you really want to make geventWait return immediately use TIME_IMMEDIATE or 1 (1ms) as the parameter. 3. Without a look at all the code it is impossible for us to say. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now