void _gwmDeinit(void) { GHandle gh; while((gh = gwinGetNextWindow(0))) gwinDestroy(gh); _GWINwm->vmt->DeInit(); #if !GWIN_REDRAW_IMMEDIATE gtimerDeinit(&RedrawTimer); #endif gfxQueueASyncDeinit(&_GWINList); gfxSemDestroy(&gwinsem); }
void startupInit() { usbdataEnable(); gdispSetBacklight(50); gdispSetContrast(50); geventListenerInit(&gl); gwinAttachListener(&gl); // Setup UI objects and show splash guiCreate(); gwinProgressbarSetResolution(ghProgbarLoad, 10); gwinProgressbarStart(ghProgbarLoad, 300); graphInit(); // Setup INA219 I2C Current Sensor ina219Init(); sduObjectInit(USB_SERIAL_DRIVER); sduStart(USB_SERIAL_DRIVER, &serusbcfg); /* * Activates the USB driver and then the USB bus pull-up on D+. * Note, a delay is inserted in order to not have to disconnect the cable * after a reset. */ usbDisconnectBus(serusbcfg.usbp); chThdSleepMilliseconds(1000); usbStart(serusbcfg.usbp, &usbcfg); usbConnectBus(serusbcfg.usbp); setStartTime(); chThdCreateStatic(ledThread, sizeof(ledThread), LOWPRIO, ThreadLED, NULL); chThdCreateStatic(inaThread, sizeof(inaThread), HIGHPRIO, ThreadINA, NULL); chThdCreateStatic(gfxvalThread, sizeof(gfxvalThread), NORMALPRIO, ThreadGFXVal, NULL); chThdCreateStatic(timeThread, sizeof(timeThread), NORMALPRIO, ThreadTIME, NULL); chThdCreateStatic(gfxEventThread, sizeof(gfxEventThread), NORMALPRIO, ThreadGFXEvent, NULL); chThdSleepMilliseconds(2000); chThdCreateStatic(graphThread, sizeof(graphThread), NORMALPRIO+5, ThreadGRAPH, NULL); // Destroy splay screen and show main page gwinDestroy(ghContainerPageSplash); guiShowPage(1); }
/* Process a button event */ static void _callbackBtn(void *param, GEvent *pe) { switch (pe->type) { case GEVENT_GWIN_BUTTON: if (((GEventGWinButton *)pe)->button == ((GFrameObject*)(GHandle)param)->btnClose) gwinDestroy((GHandle)param); else if (((GEventGWinButton *)pe)->button == ((GFrameObject*)(GHandle)param)->btnMin) { ;/* ToDo */ } else if (((GEventGWinButton *)pe)->button == ((GFrameObject*)(GHandle)param)->btnMax) { ;/* ToDo */ } break; default: break; } }