Exemplo n.º 1
0
void drawMainMenu( void )
{
    PYGMYCOLOR pygmyColor;
    PYGMYFILE pygmyFile;
    PYGMYWIDGET widgetButton;

    pinInterrupt( eventMouseMoveUp, A0, TRIGGER_RISING, 1 );
    pinInterrupt( eventMouseMoveDown, D3, TRIGGER_RISING, 1 );
    pinInterrupt( eventMouseMoveLeft, TA0, TRIGGER_RISING, 1 );
    pinInterrupt( eventMouseMoveRight, DAC1, TRIGGER_RISING, 1 );
    pinInterrupt( eventMouseClickLeft, DAC2, TRIGGER_RISING, 1 );
    pinInterrupt( eventMouseClickCenter, TX2, TRIGGER_RISING, 1 );
    pinInterrupt( eventMouseClickRight, RX2, TRIGGER_RISING, 1 );

    colorSetRGB( colorGetRootColor(), 0x65, 0xBE, 0xFF ); //0x48, 0x8E, 0xDF );
    colorSetRGB( colorGetRootBackColor(), 0x65, 0x65, 0x65 );
    colorSetRGB( colorGetRootFocusColor(), 0x65, 0x65, 0x65 );//0x38, 0x6E, 0xBF  );
    colorSetRGB( colorGetRootFocusBackColor(), 0x65, 0x8E, 0xDF );
    colorSetRGB( colorGetRootClearColor(), 0xFF, 0x0E, 0xE0 );//0xFF, 0xE0, 0xE0 );
     
    guiSetRadius( 8 );
    guiSetStyle( VISIBLE|BUTTON|ROUNDED|BORDER|CENTERED );
    
    formFreeAll();
    formNew( 0, 0, 128, 128 );
    //formCurrentSetColor;
    //formCurrentSetBackColor;
    //formCurrentSetClearColor;
    widgetButton.Style = CAPTION|FILLED|VISIBLE|ROUNDED|BORDER|CENTERED;
    //widgetButton.Style = FILLED|VISIBLE|ROUNDED|BORDER|CENTERED;
    widgetButton.Type = BUTTON;
    widgetButton.X = 0;
    widgetButton.Y = 6;
    widgetButton.Width = 127;
    widgetButton.Height = 36;
    widgetButton.String = "Start Game";
    formAddWidget( &widgetButton );
    //widgetAddEventHandler( widgetGetCurrent(), eventGotFocus, GOTFOCUS );
    //widgetAddEventHandler( widgetGetCurrent(), eventLostFocus, LOSTFOCUS );
    widgetAddEventHandler( widgetGetCurrent(), gemInit, SELECTED );
    
    widgetButton.Y = 46;
    widgetButton.String = "RF Demo";
    formAddWidget( &widgetButton );
    //widgetAddEventHandler( widgetGetCurrent(), eventGotFocus, GOTFOCUS );
    //widgetAddEventHandler( widgetGetCurrent(), eventLostFocus, LOSTFOCUS );
    widgetAddEventHandler( widgetGetCurrent(), drawRFTest, SELECTED );
    
    widgetButton.Y = 86;
    widgetButton.String = "Contrast";
    formAddWidget( &widgetButton );
    //widgetAddEventHandler( widgetGetCurrent(), eventGotFocus, GOTFOCUS );
    //widgetAddEventHandler( widgetGetCurrent(), eventLostFocus, LOSTFOCUS );
    //widgetAddEventHandler( widgetGetCurrent(), eventSelected, SELECTED );
    
    drawForms( );
}
Exemplo n.º 2
0
void drawRFTest( void )
{
    //PYGMYCOLOR pygmyColor;
    //PYGMYFILE pygmyFile;
    PYGMYWIDGET widgetButton;

    colorSetRGB( colorGetRootColor(), 0x65, 0xBE, 0xFF ); //0x48, 0x8E, 0xDF );
    colorSetRGB( colorGetRootBackColor(), 0x65, 0x65, 0x65 );
    colorSetRGB( colorGetRootFocusColor(), 0x65, 0x65, 0x65 );//0x38, 0x6E, 0xBF  );
    colorSetRGB( colorGetRootFocusBackColor(), 0x65, 0x8E, 0xDF );
    colorSetRGB( colorGetRootClearColor(), 0xFF, 0x0E, 0xE0 );
     
    guiSetRadius( 8 );
    guiSetStyle( VISIBLE|BUTTON|ROUNDED|BORDER|CENTERED );
    
    formFreeAll();
    formNew( 0, 0, 128, 128 );
    
    widgetButton.Style = CAPTION|CENTERED|VISIBLE|ROUNDED|BORDER;
    widgetButton.Type = LABEL;
    widgetButton.X = 0;
    widgetButton.Y = 6;
    widgetButton.Width = 127;
    widgetButton.Height = 36;
    widgetButton.String = "Humidity";
    formAddWidget( &widgetButton );
    
    widgetButton.Style = CAPTION|VISIBLE|ROUNDED;
    widgetButton.Type = LABEL;
    widgetButton.X = 0;
    widgetButton.Y = 46;
    widgetButton.Width = 127;
    widgetButton.Height = 36;
    copyString( "Waiting...", globalHumidity );
    widgetButton.String = globalHumidity;
    formAddWidget( &widgetButton );
    //formSetFocus( formGetWidgetCount() - 1 );
    
    widgetButton.Style = CAPTION|FILLED|VISIBLE|ROUNDED|BORDER|CENTERED;
    widgetButton.Type = BUTTON;
    widgetButton.Y = 86;
    widgetButton.String = "Back";
    formAddWidget( &widgetButton );
    formSetFocus( formGetWidgetCount() - 1 );
    
    widgetAddEventHandler( widgetGetCurrent(), eventRFBack, SELECTED );
    
    
    drawForms();
    //taskNewSimple( "humidity", 1000, (void*)threadRFHumidity );
}
Exemplo n.º 3
0
void     _cameraInit(CAMERA* camera){

	// Make RAM space for the colour bins
	if(camera->bins == NULL){
		camera->bins = malloc( _cameraNumColorBins(camera) * sizeof(CAMERA_BIN));
	}

	// Zap all colour bins to RGB(0,0,0) except bin#0
	if(camera->bins != NULL){
		uint8_t maxBins = _cameraNumColorBins(camera);
		for(uint8_t i = 0; i < maxBins; i++){
			CAMERA_BIN* bin = &camera->bins[i];
			bin->active = bin->dirty = FALSE;
			if(i==0){
				COLOR min,max;
				colorSetRGB(&min,180,180,180);
				colorSetRGB(&max,255,255,255);
				_cameraSetBin(camera,i,&min,&max);
			}else{
				colorSetRGB(&(bin->min),0,0,0);
				colorSetRGB(&(bin->max),0,0,0);
			}
		}
	}

	// Allocate space for blobs
	if(camera->blobs == null){
		camera->blobs = malloc(_cameraMaxBlobs(camera) * sizeof(CAMERA_BLOB));
	}


	// Get the method implementation for this class of camera
	const CAMERA_CLASS* class = camera->clazz;
	void (*fn)(CAMERA*) = (void (*)(CAMERA*))pgm_read_word(&class->init);
	if(fn){
		fn(camera);
	}
}