![](https://community.ugfx.io/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
randomrat
Members-
Posts
5 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Thank you for your advice. I think I found something that has been causing my problems. In the "stm32746g_discovery_audio.c" file, the BSP_AUDIO_OUT_Stop function sends commands to the WM8994 codec to shutdown. If I don't call this function, it solves the hang 9/10 times and I can still play a new track as and when I need to. Touchscreen still operates. uint8_t BSP_AUDIO_OUT_Stop(uint32_t Option) { /* Call the Media layer stop function */ HAL_SAI_DMAStop(&haudio_out_sai); /* Call Audio Codec Stop function */ if(audio_drv->Stop(AUDIO_I2C_ADDRESS, Option) != 0) { return AUDIO_ERROR; } else { if(Option == CODEC_PDWN_HW) { /* Wait at least 100us */ HAL_Delay(1); } /* Return AUDIO_OK when all operations are correctly done */ return AUDIO_OK; } } Anyway, it looks like need to do some reading on bus arbitration and how to use the calls.
-
Hi, I would like to disable the FT5336 touchscreen programmatically and then re-enable it again at a later point in my code. The reason why i'd like to do this is because I am using the F7 Disco Serial Audio Interface which also uses I2C line. I find that once I have finished playing the audio file, my code hangs in the while loop of the stm32f7_i2c.c "i2cRead" function. Is this a bug or something? // Transmit the whole buffer for (i = 0; i < length; i++) { while (!(i2c->ISR & I2C_ISR_RXNE)); //<-- hangs here data[i] = i2c->RXDR; } For now, as a temporary solution, I am happy to disable the touchscreen driver whilst the audio is playing and then re-enable it once the track has finished. Looking in "gmouse_lld_FT5336.c" I see the following: const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{ { GDRIVER_TYPE_TOUCH, GMOUSE_VFLG_TOUCH | GMOUSE_VFLG_ONLY_DOWN | GMOUSE_VFLG_POORUPDOWN, sizeof(GMouse) + GMOUSE_FT5336_BOARD_DATA_SIZE, _gmouseInitDriver, _gmousePostInitDriver, _gmouseDeInitDriver }, 1, // z_max - (currently?) not supported 0, // z_min - (currently?) not supported 1, // z_touchon 0, // z_touchoff { // pen_jitter GMOUSE_FT5336_PEN_CALIBRATE_ERROR, // calibrate GMOUSE_FT5336_PEN_CLICK_ERROR, // click GMOUSE_FT5336_PEN_MOVE_ERROR // move }, { // finger_jitter GMOUSE_FT5336_FINGER_CALIBRATE_ERROR, // calibrate GMOUSE_FT5336_FINGER_CLICK_ERROR, // click GMOUSE_FT5336_FINGER_MOVE_ERROR // move }, ft5336Init, // init 0, // deinit //<--- Do I need to write/add an ft5336DeInit function and add it here. ft5336ReadXYZ, // get 0, // calsave 0 // calload }}; I'm not sure really sure how to go about de-initialising the driver. should I be adding a deinit function and calling it from my code? I feel as though this is supposed to be something very trivial but I am struggling a bit. Thank you for your time.
-
Hello Joel, Apologies in the delayed response. I thought I'd give some closure on this thread and say I followed Option 1 and created dedicated buttons for every page. I have named them as best as possible to avoid confusion with other buttons that also do the same thing (but on another page). All works well and I can successfully switch between pages - That's one small piece of the puzzle solved! Other things I have figured out following your documentation since my first post are: Adding multiple custom fonts, custom button images (although I need to try adding multiple images for one button), animated gifs (I get flickering, but the concept works) and ImageBox widgets! I'd love to write my experiences about uGFX someday, unfortunately the next university semester is about to start. It will have to wait for the summer, however in a nutshell I am so deeply impressed with all the work you and your team have done. Definitely inspiring and the thought gone into this project is self evident. My journey with uGFX will still continue. Keep it up! Many Thanks, Raj
-
Ahh, I totally forgot to mention what I'm using: > STM32F7Discovery board > Keil uVision V5.17 IDE > uGFX Studio 0.14
-
Hi All, I'm an embedded newbie here who has stumbled across uGFX in my research to create a nice GUI for a personal project/interest. I have some basic knowledge on C and want to try something different. I have been getting to grips with using the uGFX libraries and uGFX studio, which was a little difficult to start with, but the more I am beginning to understand it the more impressed I get with how powerful it is! Anyway, back to my post...I have a couple of problems but I was not sure whether I should split them into multiple posts. Please advise me to do so if necessary. My project currently requires 6 different "pages" which are accessible from buttons on other pages. With the aid of uGFX studio, I created multiple "display pages" and some placeholder buttons that will be used to jump between the pages (these will be custom image buttons). static void createPageMain(void) { GWidgetInit wi; gwinWidgetClearInit(&wi); // create container widget: ghContainerPageMain wi.g.show = FALSE; wi.g.x = ; wi.g.y = ; wi.g.width = 480; wi.g.height = 272; wi.g.parent = ; wi.text = "Container"; wi.customDraw = ; wi.customParam = ; wi.customStyle = ; ghContainerPageMain = gwinContainerCreate(, &wi, ); // create button widget: ghBtnSystem wi.g.show = TRUE; wi.g.x = 30; wi.g.y = 50; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainerPageMain; wi.text = "System"; wi.customDraw = gwinButtonDraw_Normal; wi.customParam = ; wi.customStyle = ; ghBtnSystem = gwinButtonCreate(, &wi); // Create label widget: ghLblMain wi.g.show = TRUE; wi.g.x = 200; wi.g.y = ; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainerPageMain; wi.text = "Main Screen"; wi.customDraw = gwinLabelDrawJustifiedCenter; wi.customParam = ; wi.customStyle = ; ghLblMain = gwinLabelCreate(, &wi); gwinLabelSetBorder(ghLblMain, FALSE); // create button widget: ghBtnCombFilter wi.g.show = TRUE; wi.g.x = 190; wi.g.y = 50; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainerPageMain; wi.text = "Comb Filter"; wi.customDraw = gwinButtonDraw_Normal; wi.customParam = ; wi.customStyle = ; ghBtnCombFilter = gwinButtonCreate(, &wi); // create button widget: ghBtnPreFilter wi.g.show = TRUE; wi.g.x = 340; wi.g.y = 50; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainerPageMain; wi.text = "Pre Filter"; wi.customDraw = gwinButtonDraw_Normal; wi.customParam = ; wi.customStyle = ; ghBtnPreFilter = gwinButtonCreate(, &wi); // wi.g.show = TRUE; // wi.g.x = 160; // wi.g.y = 10; // wi.g.width = 120; // wi.g.height = 120; // ghImage2 = gwinImageCreate(NULL, &wi.g); // gwinImageOpenMemory(ghImage2, PumpGrey); } static void createPageSystem(void) etc static void createPageCombFilter(void) etc uGFX Studio automatically generated a guiEventLoop function where the GEvents are captured. void guiEventLoop(void) { GEvent* pe; while (1) { pe = geventEventWait(&gl, 0); switch (pe->type) { case GEVENT_GWIN_BUTTON: if (((GEventGWinButton*)pe)->gwin == ghBtnSystem) { guiShowPage(1); } else if (((GEventGWinButton*)pe)->gwin == ghBtnCombFilter) { guiShowPage(2); } else if (((GEventGWinButton*)pe)->gwin == ghBtnPreFilter) { guiShowPage(3); } else if (((GEventGWinButton*)pe)->gwin == ghBtnBack) { guiShowPage(0); } else if (((GEventGWinButton*)pe)->gwin == ghBtnBack1) { guiShowPage(0); } break; default: break; } } } That works fine, however I want every page, APART from the homepage (page 0) to have a "back" button, navigating to the previous page. As you can see in the code above, I have had to create a separate button for each page which directs it to the page before (giving the appearance of back) It seems like I cannot create just one button that can be dynamically reused depending on the page that is being displayed. A very crude way of knowing what page I'm on can be handled like this, but it doesn't solve the problem of only having one button. static const uint32_t currentpage = ; ... ... guiShowPage(1); currentpage = 1; ... ... else if (((GEventGWinButton*)pe)->gwin == btnBack) { backPage() } ... ... void backPage(void) { if (currentpage == 1) guiShowPage(); //guishowpage containes currentpage = 0; else if (currentpage == 2) guiShowPage(); else if (currentpage == 3) guiShowPage(); else{} } I worry that I will end up with a sea confusing code and buttons that effectively do the same thing. Is it best to create all the pages at runtime and then show them necessary. Would it be better to only create them as and when needed and destroy (gwinDestroy()) them once I navigate to another page? I appreciate your time in reading this. I was going to ask for help about making by buttons into images as I appear to be struggling but I think I should leave that for now and solve this problem first?