Jump to content

Alan Chang

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by Alan Chang

  1. Hi Joel, Very thanks for your quick reply. Also thanks for your tip about the image. I will think about a way to draw this needle. Thanks.
  2. Hi Joel, Thanks for the new version of demo. There is no error when complied. By the way, can I use the custom image of the needle? Like this. And it can rotate also. Thanks.
  3. Hello, When I compiled the Dial widget example(win32_dial), I got those errors. ..\dial.c(127): error: #167: argument of type "point (*)[4]" is incompatible with parameter of type "point *" ..\dial.c(127): error: #167: argument of type "point (*)[4]" is incompatible with parameter of type "const point *" What can I do to fix them? I use freeRTOS and STM32F429-disco board. Thanks.
  4. Hi Joel, Thanks for your information. It seems BMP format is a good option. Now I will continue to develop my application. Cheers.
  5. Hi Joel, Very thanks for your information. It is my first time to use this OS. I think I have to check the size of stack in task very carefully in case my application uses lot of images. I also tried to change the memory management file on freeRTOS to heap_4.c, and this issue was solved. In begging I used heap_1.c and I think it can not release the memory. Maybe gdispImageClose called freeRTOS API (like vPortFree) failure, so all task was block. This is my guess. Thanks. Have a good day.
  6. Hi Joel, Thanks for your fast reply. Do you mean this one in FreeRTOSConfig.h? #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 1024 ) Thanks.
  7. Hello, I followed the gdisp demo code which is images and run on freeRTOS. I made a gui.c file. Here is my code. #include "gui.h" static gdispImage myImage; void creat_UI (void){ coord_t swidth, sheight; // Get the display dimensions swidth = gdispGetWidth(); sheight = gdispGetHeight(); gdispClear(Silver); // Set up IO for our image gdispImageOpenFile(&myImage, "test-pal8.bmp"); gdispImageDraw(&myImage, 0, 0, swidth, sheight, 0, 0); gdispImageClose(&myImage); } void guiEventLoop(void) { gfxSleepMilliseconds(1000); } Then I made a task to run ugfx on main.c. Here is the code on main.c void uGFX_task(void *pvParameters) { STM_EVAL_LEDOn(LED3); //LED3 on gfxInit(); creat_UI (); while (1) { guiEventLoop(); } } When execute the program, all task was stopped. I found that the function "gdispImageClose(&myImage);" caused. If I don not use "gdispImageClose", everything is fine. I have no idea why. Hope you can help. Thanks.
  8. Hi Joel, I have check the file "changelog.txt". I can see "*** Changes after 2.7 ***". Does that mean that I use the latest version? Thanks.
  9. Hi Joel, I tried this code first. void guiShowPage(unsigned pageIndex) { // Detach all toggles gwinDetachToggle(ghButton1, 0); gwinDetachToggle(ghButton2, 0); // Hide all pages gwinHide(ghContainerPage0); gwinHide(ghContainerPage1); // Show page selected page switch (pageIndex) { case 0: gwinShow(ghContainerPage0); gwinAttachToggle(ghButton1, 0, 0); break; case 1: gwinShow(ghContainerPage1); gwinAttachToggle(ghButton2, 0, 0); break; default: break; } } void guiEventLoop(void) { while (1) { // Get an event pe = geventEventWait(&glistener, TIME_INFINITE ); switch (pe->type) { case GEVENT_GWIN_BUTTON: if (((GEventGWinButton*)pe)->gwin == ghButton1) { guiShowPage(1); } else if (((GEventGWinButton*)pe)->gwin == ghButton2) { guiShowPage(0); } break; } } } When press physical button, the page did not change. Same as before. Then I tried to remove the gwinDetachToggle, and run again. void guiShowPage(unsigned pageIndex) { // Hide all pages gwinHide(ghContainerPage0); gwinHide(ghContainerPage1); // Show page selected page switch (pageIndex) { case 0: gwinShow(ghContainerPage0); gwinAttachToggle(ghButton1, 0, 0); break; case 1: gwinShow(ghContainerPage1); gwinAttachToggle(ghButton2, 0, 0); break; default: break; } } It can work now. I can change page when press the physical button. Hope you can understand. I searched the gwinDetachToggle, but I still do not figure out this function. Thanks.
  10. Hi Joel, Thanks for your reply. I tried this code. void guiShowPage(unsigned pageIndex) { // Detach all toggles gwinDetachToggle(ghButton1, 0); gwinDetachToggle(ghButton2, 0); // Hide all pages gwinHide(ghContainerPage0); gwinHide(ghContainerPage1); // Show page selected page switch (pageIndex) { case 0: gwinShow(ghContainerPage0); gwinAttachToggle(ghButton1, 0, 0); break; case 1: gwinShow(ghContainerPage1); gwinAttachToggle(ghButton2, 0, 0); break; default: break; } } void guiEventLoop(void) { while (1) { // Get an event pe = geventEventWait(&glistener, TIME_INFINITE ); switch (pe->type) { case GEVENT_GWIN_BUTTON: if (((GEventGWinButton*)pe)->gwin == ghButton1) { guiShowPage(1); } else if (((GEventGWinButton*)pe)->gwin == ghButton2) { guiShowPage(0); } break; } } } It is not work. But If I do not use "gwinDetachToggle", it can work. void guiShowPage(unsigned pageIndex) { // Detach all toggles //gwinDetachToggle(ghButton1, 0); //gwinDetachToggle(ghButton2, 0); // Hide all pages gwinHide(ghContainerPage0); gwinHide(ghContainerPage1); // Show page selected page switch (pageIndex) { case 0: gwinShow(ghContainerPage0); gwinAttachToggle(ghButton1, 0, 0); break; case 1: gwinShow(ghContainerPage1); gwinAttachToggle(ghButton2, 0, 0); break; default: break; } } What is "gwinDetachToggle"? Thanks.
  11. Hello, Does someone help me? I really do not have idea. Thanks.
  12. Hi Joel, Thanks for your reply. Maybe I did not describe my question well. Sorry about that. Now I am using STM32F429i-discovery board. There is only one USER button on this board. According to this code, I have 2 pages. void guiShowPage(unsigned pageIndex) { gwinHide(ghContainerPage0); gwinHide(ghContainerPage1); switch (pageIndex) { case 0: gwinShow(ghContainerPage0); break; case 1: gwinShow(ghContainerPage1); break; default: break; } I want to switch these 2 pages when get ghButton1 or ghButton2 event. ghButton1 is in ghContainerPage0. ghButton2 is in ghContainerPage1. So when get ghButton1, change to ghContainerPage1. when get ghButton2, change back to ghContainerPage0. switch (pe->type) { case GEVENT_GWIN_BUTTON: if (((GEventGWinButton*)pe)->gwin == ghButton1) { guiShowPage(1); } else if (((GEventGWinButton*)pe)->gwin == ghButton2) { guiShowPage(0); } break; } However, I only have one button on my STM32F429i-discovery board. Can I use same button and attach to ghButton1 and ghButton2? I have tried this way, but it was wrong action. gwinAttachToggle(ghButton1, 0, 0); gwinAttachToggle(ghButton2, 0, 0); Then I change other way like this. gwinAttachToggle(ghButton1, 0, 0); gwinAttachToggle(ghButton2, 1, 0); But also wrong. My question is below. 1. I want to know how to set ghButton1 and ghButton2 in same toggle instance. Is that possible? 2. What is the "role" meaning in gwinAttachToggle()? Please give me some advice or other solution. Hope you can understand my question. Thanks, Joel.
  13. Hello, If I want to control the 2 GHandles by one key, what can I do? It is like to switch 2 pages, and there are ghButton1 and ghButton2 in the different page. I use gwinAttachToggle to assign ghButton1 and can change to page 2. How can I assign ghButton2 and return back page 1? Please give some advice. Thanks.
  14. Hi, Thanks for help. I also check the low level driver of LCD, and fixed some issue. Now it can run well. Thanks.
  15. Hi, Thanks for the information. I modified the code for geventEventWait problem. I put non-zero like this. void guiEventLoop(void) { GEvent* pe; while (1) { // Get an event pe = geventEventWait(&glistener, 500 ); if(pe->type==GEVENT_GWIN_BUTTON){ printf("Button clicked\r\n"); //test gwinShow(ghTextedit1); } } Also I moved the gwinAttachToggle to other place. void guiCreate(void) { GWidgetInit wi; // Prepare fonts dejavu_sans_16 = gdispOpenFont("DejaVuSans16"); // Prepare images // GWIN settings gwinWidgetClearInit(&wi); gwinSetDefaultFont(dejavu_sans_16); gwinSetDefaultStyle(&white, FALSE); gwinSetDefaultColor(black_studio); gwinSetDefaultBgColor(white_studio); // Create all the display pages createPagePage0(); createPagePage1(); // Select the default display page guiShowPage(0); gwinAttachToggle(ghButton1, 0, 0); } After test, I still got same result which white screen happened same as before. Do I miss something? By the way, I check the puTTY. I saw it can show the "Button clicked" after press the button, so I think the printf in guiEventLoop executed well. Hope can give some advice. Thank you guys.
  16. Hi everyone, I use uGFX with FreeRTOS on STM32F407. I tried to use the key of the board to control the Textedit visual. But when I press the key, the screen was became white. Here is the gui.c file. static void createPagePage0(void) { GWidgetInit wi; gwinWidgetClearInit(&wi); // create container widget: ghContainerPage0 wi.g.show = FALSE; wi.g.x = 0; wi.g.y = 0; wi.g.width = 240; wi.g.height = 320; wi.g.parent = 0; wi.text = "Container"; wi.customDraw = 0; wi.customParam = 0; wi.customStyle = 0; ghContainerPage0 = gwinContainerCreate(0, &wi, 0); // Create textedit widget: ghTextedit1 wi.g.show = FALSE; wi.g.x = 10; wi.g.y = 70; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainerPage0; wi.text = "First Name"; wi.customDraw = gwinTexteditDefaultDraw; wi.customParam = 0; wi.customStyle = 0; ghTextedit1 = gwinTexteditCreate(0, &wi, 0); // Create textedit widget: ghTextedit2 wi.g.show = TRUE; wi.g.x = 10; wi.g.y = 10; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainerPage0; wi.text = "User Name"; wi.customDraw = gwinTexteditDefaultDraw; wi.customParam = 0; wi.customStyle = 0; ghTextedit2 = gwinTexteditCreate(0, &wi, 0); // create button widget: ghButton1 wi.g.show = TRUE; wi.g.x = 50; wi.g.y = 280; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainerPage0; wi.text = "Change Page"; wi.customDraw = gwinButtonDraw_Normal; wi.customParam = 0; wi.customStyle = 0; ghButton1 = gwinButtonCreate(0, &wi); } static void createPagePage1(void) { GWidgetInit wi; gwinWidgetClearInit(&wi); // create container widget: ghContainerPage1 wi.g.show = FALSE; wi.g.x = 0; wi.g.y = 0; wi.g.width = 240; wi.g.height = 320; wi.g.parent = 0; wi.text = "Container"; wi.customDraw = 0; wi.customParam = 0; wi.customStyle = 0; ghContainerPage1 = gwinContainerCreate(0, &wi, 0); // create container widget: ghContainer1 wi.g.show = TRUE; wi.g.x = 30; wi.g.y = 170; wi.g.width = 200; wi.g.height = 110; wi.g.parent = ghContainerPage1; wi.text = "Container1"; wi.customDraw = gwinContainerDraw_Std; wi.customParam = 0; wi.customStyle = 0; ghContainer1 = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER); // create radiobutton widget: ghRadiobutton3 wi.g.show = TRUE; wi.g.x = 80; wi.g.y = 70; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainer1; wi.text = "white"; wi.customDraw = gwinRadioDraw_Radio; wi.customParam = 0; wi.customStyle = 0; ghRadiobutton3 = gwinRadioCreate(0, &wi, 0); gwinSetColor(ghRadiobutton3, black_studio); gwinSetBgColor(ghRadiobutton3, white_studio); // create radiobutton widget: ghRadiobutton2 wi.g.show = TRUE; wi.g.x = 80; wi.g.y = 40; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainer1; wi.text = "Black"; wi.customDraw = gwinRadioDraw_Radio; wi.customParam = 0; wi.customStyle = 0; ghRadiobutton2 = gwinRadioCreate(0, &wi, 0); gwinSetColor(ghRadiobutton2, black_studio); gwinSetBgColor(ghRadiobutton2, white_studio); // create radiobutton widget: ghRadiobutton1 wi.g.show = TRUE; wi.g.x = 80; wi.g.y = 10; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainer1; wi.text = "Custom"; wi.customDraw = gwinRadioDraw_Radio; wi.customParam = 0; wi.customStyle = 0; ghRadiobutton1 = gwinRadioCreate(0, &wi, 0); gwinSetColor(ghRadiobutton1, black_studio); gwinSetBgColor(ghRadiobutton1, white_studio); gwinRadioPress(ghRadiobutton1); // create checkbox widget: ghCheckbox1 wi.g.show = TRUE; wi.g.x = 50; wi.g.y = 10; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainerPage1; wi.text = "Checkbox1"; wi.customDraw = gwinCheckboxDraw_CheckOnLeft; wi.customParam = 0; wi.customStyle = 0; ghCheckbox1 = gwinCheckboxCreate(0, &wi); gwinCheckboxCheck(ghCheckbox1, FALSE); // create checkbox widget: ghCheckbox2 wi.g.show = TRUE; wi.g.x = 50; wi.g.y = 30; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainerPage1; wi.text = "Checkbox2"; wi.customDraw = gwinCheckboxDraw_CheckOnLeft; wi.customParam = 0; wi.customStyle = 0; ghCheckbox2 = gwinCheckboxCreate(0, &wi); gwinCheckboxCheck(ghCheckbox2, FALSE); // create button widget: ghButton2 wi.g.show = TRUE; wi.g.x = 50; wi.g.y = 290; wi.g.width = 120; wi.g.height = 20; wi.g.parent = ghContainerPage1; wi.text = "Change Page"; wi.customDraw = gwinButtonDraw_Normal; wi.customParam = 0; wi.customStyle = 0; ghButton2 = gwinButtonCreate(0, &wi); // Create label widget: ghLabel1 wi.g.show = TRUE; wi.g.x = 30; wi.g.y = 140; wi.g.width = 173; wi.g.height = 24; wi.g.parent = ghContainerPage1; wi.text = "Select a Widget Style"; wi.customDraw = gwinLabelDrawJustifiedLeft; wi.customParam = 0; wi.customStyle = 0; ghLabel1 = gwinLabelCreate(0, &wi); gwinLabelSetBorder(ghLabel1, FALSE); } void guiShowPage(unsigned pageIndex) { // Hide all pages gwinHide(ghContainerPage0); gwinHide(ghContainerPage1); // Show page selected page switch (pageIndex) { case 0: gwinShow(ghContainerPage0); break; case 1: gwinShow(ghContainerPage1); break; default: break; } } void guiCreate(void) { GWidgetInit wi; // Prepare fonts dejavu_sans_16 = gdispOpenFont("DejaVuSans16"); // Prepare images // GWIN settings gwinWidgetClearInit(&wi); gwinSetDefaultFont(dejavu_sans_16); gwinSetDefaultStyle(&white, FALSE); gwinSetDefaultColor(black_studio); gwinSetDefaultBgColor(white_studio); // Create all the display pages createPagePage0(); createPagePage1(); // Select the default display page guiShowPage(0); } void guiEventLoop(void) { GEvent* pe; while (1) { gwinAttachToggle(ghButton1, 0, 0); // Get an event pe = geventEventWait(&glistener, 0); if(pe->type==GEVENT_GWIN_BUTTON){ printf("Button clicked\r\n"); //test gwinShow(ghTextedit1); } } } I attached the executive result. Hope can give some advice. Thank you guys.
×
×
  • Create New...