Exemple #1
0
/**
 * Control the progress bar auto-increment
 */
static void setProgressbar(bool_t onoff) {
	if (onoff)
		gwinProgressbarStart(ghProgressbar1, 500);
	else {
		gwinProgressbarStop(ghProgressbar1);		// Stop the progress bar
		gwinProgressbarReset(ghProgressbar1);
	}
}
Exemple #2
0
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);
}