Jump to content

kiwi

Members
  • Posts

    8
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. kiwi

    text input with ugfx

    Hi guys, Thanks for your advice! Handwriting recognition is not an option then, was a joke anyways. So I will probably have to go with a hardware keyboard, but which one to take. Do you have any experiences with specific hardware? I'm using a STM32F4 and my goal is to have a max. mobilphone size embedded device including the keyboard. Do you maybe now a shop with a good selection of keyboards? Also, if you have a alpha version of your virtual keyboard, I'm happy to test it I'm probably busy with this project another 3 month since it's my bachelor thesis. best, kiwi
  2. Hi guys, I'm not sure whether this is the right board, if not excuse me I'm currently developing an embedded where the user should be able to input text (length similar to text messages on a mobile phone). Since I'm growing fond of using ugfx and chibios I was wondering what is the best solution for this problem with these tools. Right now I'm thinking about to either use a touch keyboard or a hardware keyboard for text input, but I'm not sure what the better approach is. So I wanted to check with you guys. Maybe one of you knows a cool vendor for little phone hardware keyboards? Or did anybody of you already implement an on screen keyboard I could base my work on? I'm even open for new ways of designs like a text recognition and enabling the user to really write on the screen. Any Ideas? best, kiwi
  3. Hi, you were right. Image caching exceeded the ram. thanks, kiwi
  4. Hello, I used the demonstration code for a winButton and added a winImgBox to the layout. This leads to the button being not pressable even though both of them are not overlapping each other. I guess this is no intended behaviour, right? Or there a best practice to avoid this. Sample code is below. thanks, kiwi #include "gfx.h" static GListener gl; static GHandle ghButton1, ghImg; MMCDriver MMCD1; /* Maximum speed SPI configuration (18MHz, CPHA=0, CPOL=0, MSb first).*/ static SPIConfig hs_spicfg = {NULL, GPIOE, GPIOE_PIN4, 0}; /* Low speed SPI configuration (281.250kHz, CPHA=0, CPOL=0, MSb first).*/ static SPIConfig ls_spicfg = {NULL, GPIOE, GPIOE_PIN4, SPI_CR1_BR_2 | SPI_CR1_BR_1}; /* MMC/SD over SPI driver configuration.*/ static MMCConfig mmccfg = {&SPID4, &ls_spicfg, &hs_spicfg}; static void createWidgets(void) { GWidgetInit wi; GImageObject img; // Apply some default values for GWIN gwinWidgetClearInit(&wi); wi.g.show = TRUE; // Apply the button parameters wi.g.width = 100; wi.g.height = 30; wi.g.y = 80; wi.g.x = 10; wi.text = "Push Button"; // Create the actual button ghButton1 = gwinButtonCreate(0, &wi); wi.g.show = TRUE; wi.g.x = 0; wi.g.y = 0; wi.g.width = 220; wi.g.height = 60; ghImg = gwinImageCreate(&img, &wi.g); gwinImageOpenFile(ghImg, "logo.gif"); gwinImageCache(ghImg); gwinShow(ghImg); } void ExtraOSInit(void) { /* Initialize SDCard */ mmcObjectInit(&MMCD1); mmcStart(&MMCD1,&mmccfg); mmcConnect(&MMCD1); } int main(void) { GEvent* pe; static const orientation_t orients[] = { GDISP_ROTATE_0, GDISP_ROTATE_90, GDISP_ROTATE_180, GDISP_ROTATE_270 }; unsigned which; // Initialize the display gfxInit(); // We are currently at GDISP_ROTATE_0 which = 0; gdispSetOrientation(orients[which]); // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gdispClear(White); // create the widget createWidgets(); // We want to listen for widget events geventListenerInit(&gl); gwinAttachListener(&gl); while(1) { // Get an Event pe = geventEventWait(&gl, TIME_INFINITE); switch(pe->type) { case GEVENT_GWIN_BUTTON: if (((GEventGWinButton*)pe)->gwin == ghButton1) { // Our button has been pressed if (++which >= sizeof(orients)/sizeof(orients[0])) which = 0; // Setting the orientation during run-time is a bit naughty particularly with // GWIN windows. In this case however we know that the button is in the top-left // corner which should translate safely into any orientation. gdispSetOrientation(orients[which]); gdispClear(White); gwinRedrawDisplay(GDISP, FALSE); } break; default: break; } } return 0; }
  5. I connected the SDcard via SPI4 now and it worked immediately. Since I don't depend on SDIO yet I will eventually looked into getting it to work with the LCD later. thanks a lot, kiwi
  6. Thanks for the feature! But it does not fix the problem. I don't think it is a software issue anymore, but rather a conflict in the pin setup according to http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00071990.pdf the Pin PC10 is used for LCD_R2 (standard config in ChibiOS) but I reconfigured it to be used as SDIO_D2. So I think configuring the SDCard before the LCD breaks the LCD init of GFX and the other way around. To verify this I will connect the SDCard with SPI Mode. I will let you know about the outcome.
  7. Hello, I investigated my issue further and found out that this does work: /* uGFX */ #include /* ChibiOS */ #include "ch.h" #include "hal.h" #include "main.h" /* SDCDriver config. */ static SDCConfig sdccfg = {0}; int main(void) { halInit(); chSysInit(); /* Initialize SDCard over SDIO */ sdcObjectInit(&SDCD1); sdcStart(&SDCD1, &sdccfg); if(sdcConnect(&SDCD1) != CH_SUCCESS) return 0; GFILE* file; file = gfileOpen("test.txt", "w"); gfileWrite(file, (void*) "main1", 5); gfileClose(file); while(TRUE) { chThdSleepMilliseconds(500); } return 1; } but this does not work (this time I let gfxInit() take care of ChibiOS init) /* uGFX */ #include /* ChibiOS */ #include "ch.h" #include "hal.h" #include "main.h" /* SDCDriver config. */ static SDCConfig sdccfg = {0}; int main(void) { gfxInit(); /* Initialize SDCard over SDIO */ sdcObjectInit(&SDCD1); sdcStart(&SDCD1, &sdccfg); if(sdcConnect(&SDCD1) != CH_SUCCESS) return 0; GFILE* file; file = gfileOpen("test.txt", "w"); gfileWrite(file, (void*) "main2", 5); gfileClose(file); while(TRUE) { chThdSleepMilliseconds(500); } return 1; } Do I have to initialize Gfx in a different way? thanks, kiwi
  8. Hello guys, I have a Stm32f429 with an sd card connect via SDIO, using GFILE to access the card works like a charm but it seems there is a initialization order problem when I try to save calibration data for my touch display on the card. Here is the relevant part of my main.c. If I run the code like this gFileOpen() in the SaveMouseCalibration() method returns 0, even though I can read/write to the sd card after sdcConnect. I guess this is due to gfxInit() being run before the SDCard is ready. So I moved the SDCard init, start and connect calls in between gfxInit() and chSysInit(), but this leads to a failing gfxInit(). As far as I could debug it it hangs on _gfxdispInit() in gdriver.c:48. From there on gdb just prints in ../../../../../../newlib/libc/string/memset.c. Any ideas? btw: I have #define GFX_NO_OS_INIT TRUE in my gfxconf.h thanks, kiwi bool_t SaveMouseCalibration(unsigned instance, const void *data, size_t sz) { (void)instance; GFILE* f; uint8_t bsize; bsize = (uint8_t)sz; if((f = gfileOpen("calib.gfx", "w")) == 0) return false; if(gfileWrite(f, (void*)&bsize, 1) != 1) goto fail; if(gfileWrite(f, data, bsize) != bsize) goto fail; gfileClose(f); return true; fail: gfileClose(f); return false; } bool_t LoadMouseCalibration(unsigned instance, void *data, size_t sz) { (void)instance; GFILE* f; if((f = gfileOpen("calib.gfx", "r")) == 0) return false; if(gfileRead(f, (void*)&sz, 1) != 1) goto fail; if((data = gfxAlloc(sz)) == NULL) return false; if(gfileRead(f, (void*)data, sz) != sz) goto fail; gfileClose(f); return true; fail: gfileClose(f); return false; } int main(void) { GEvent* pe; /* Init ChibiOS */ halInit(); chSysInit(); /* Init Display and uGFX */ gfxInit(); gdispSetBacklight(100); gdispSetContrast(100); /* Initialize SDCard over SDIO */ sdcObjectInit(&SDCD1); sdcStart(&SDCD1, &sdccfg); /* If SDCard not connected exit */ //TODO: enable card insertion monitor. if(sdcConnect(&SDCD1) != CH_SUCCESS) return 0; /* Attach events */ geventListenerInit(&gl); gwinAttachListener(&gl); /* Insert other threads hear */ /* Create widgets */ createGUI(); /* Listen for events */ while(true) { pe = geventEventWait(&gl, TIME_INFINITE); switch(pe->type) { } } /* Return success */ return 1; }
×
×
  • Create New...