예제 #1
0
/**
@deprecated Use NewScreenDeviceL(TInt aScreenNo, TDisplayMode aDispMode)
*/
EXPORT_C CFbsDrawDevice* CFbsDrawDevice::NewScreenDeviceL(TScreenInfoV01 aInfo,
														  TDisplayMode aDispMode)
	{
	__ASSERT_ALWAYS(aInfo.iScreenAddressValid && aInfo.iScreenAddress, Panic(EScreenDriverPanicInvalidWindowHandle));
	TScreenInfo screenInfo(aInfo.iScreenAddress, aInfo.iScreenSize);
	return ::CreateInstanceL(KDefaultScreenNo, aDispMode, screenInfo);
	}
예제 #2
0
/**
Creates a new screen device instance, which implements CFbsDrawDevice interface.
The method has to be implemented for each type of supported video hardware.
@param aScreenNo Screen number
@param aDispMode Requested display mode
@return A pointer to just created screen device, which implements CFbsDrawDevice interface
@leave KErrNoMemory Not enough memory
	   KErrNotSupported The requested screen device type is not supported
*/
EXPORT_C CFbsDrawDevice* CFbsDrawDevice::NewScreenDeviceL(TInt aScreenNo,
														  TDisplayMode aDispMode)
	{
	TInt address = 0, width = 0, height = 0;
	User::LeaveIfError(HAL::Get(aScreenNo, HALData::EDisplayMemoryAddress, address));
	User::LeaveIfError(HAL::Get(aScreenNo, HALData::EDisplayXPixels, width));
	User::LeaveIfError(HAL::Get(aScreenNo, HALData::EDisplayYPixels, height));
	__ASSERT_ALWAYS(width > 0 && height > 0 && address != 0, Panic(EScreenDriverPanicInvalidHalValue));
	TScreenInfo screenInfo(reinterpret_cast <TAny*> (address), TSize(width, height));
	return ::CreateInstanceL(aScreenNo, aDispMode, screenInfo);
	}
        //--------------------------------------------------------------------------------
        ChilliSource::SystemInfoCUPtr SystemInfoFactory::CreateSystemInfo() noexcept
        {
            // Create DeviceInfo.
            ChilliSource::DeviceInfo deviceInfo(k_deviceModel, k_deviceModelType, k_deviceManufacturer, k_deviceUdid, GetLocale(), ParseLanguageFromLocale(GetLocale()), GetOSVersion(), GetNumberOfCPUCores());

            // Create ScreenInfo.
            ChilliSource::ScreenInfo screenInfo(GetScreenResolution(), 1.0f, 1.0f, GetSupportedFullscreenResolutions());

			//Create RenderInfo
			ChilliSource::RenderInfo renderInfo = OpenGL::RenderInfoFactory::CreateRenderInfo();

            // Create SystemInfo.
            ChilliSource::SystemInfoUPtr systemInfo(new ChilliSource::SystemInfo(deviceInfo, screenInfo, renderInfo, ""));

            return std::move(systemInfo);
        }
예제 #4
0
void ChromeClient::setWindowRectWithAdjustment(const IntRect& pendingRect)
{
    IntRect screen = screenInfo().availableRect;
    IntRect window = pendingRect;

    IntSize minimumSize = minimumWindowSize();
    // Let size 0 pass through, since that indicates default size, not minimum
    // size.
    if (window.width())
        window.setWidth(std::min(std::max(minimumSize.width(), window.width()), screen.width()));
    if (window.height())
        window.setHeight(std::min(std::max(minimumSize.height(), window.height()), screen.height()));

    // Constrain the window position within the valid screen area.
    window.setX(std::max(screen.x(), std::min(window.x(), screen.maxX() - window.width())));
    window.setY(std::max(screen.y(), std::min(window.y(), screen.maxY() - window.height())));
    setWindowRect(window);
}
예제 #5
0
파일: options.cpp 프로젝트: KDE/kwin
int currentRefreshRate()
{
    int rate = -1;
    QString syncScreenName(QLatin1String("primary screen"));
    if (options->refreshRate() > 0) {  // use manually configured refresh rate
        rate = options->refreshRate();
    } else if (Screens::self()->count() > 0) {
        // prefer the refreshrate calculated from the screens mode information
        // at least the nvidia driver reports 50Hz BS ... *again*!
        int syncScreen = 0;
        if (Screens::self()->count() > 1) {
            const QByteArray syncDisplayDevice(qgetenv("__GL_SYNC_DISPLAY_DEVICE"));
            // if __GL_SYNC_DISPLAY_DEVICE is exported, the GPU shall sync to that device
            // so we try to use its refresh rate
            if (!syncDisplayDevice.isEmpty()) {
                for (int i = 0; i < Screens::self()->count(); ++i) {
                    if (Screens::self()->name(i) == syncDisplayDevice) {
                        syncScreenName = Screens::self()->name(i);
                        syncScreen = i;
                        break;
                    }
                }
            }
        }
        rate = qRound(Screens::self()->refreshRate(syncScreen)); // TODO forward float precision?
    } else if (Xcb::Extensions::self()->isRandrAvailable()) {
        // last restort - query XRandR screenInfo rate - probably wrong on nvidia systems
        Xcb::RandR::ScreenInfo screenInfo(rootWindow());
        rate = screenInfo->rate;
    }

    // 0Hz or less is invalid, so we fallback to a default rate
    if (rate <= 0)
        rate = 60; // and not shitty 50Hz for sure! *grrr*

    // QTimer gives us 1msec (1000Hz) at best, so we ignore anything higher;
    // however, additional throttling prevents very high rates from taking place anyway
    else if (rate > 1000)
        rate = 1000;
    qCDebug(KWIN_CORE) << "Vertical Refresh rate " << rate << "Hz (" << syncScreenName << ")";
    return rate;
}
예제 #6
0
GLInfo::GLInfo()
{
    QGLWidget gl((QWidget *) 0);
    gl.makeCurrent();
    Display *dpy;
    char *displayName = 0;
    int numScreens, scrNum;

    dpy = gl.x11Display();
    if ( !dpy ) {
        qWarning( "Error: unable to open display %s\n", displayName );
    }

    numScreens = ScreenCount( dpy );
    infotext.sprintf( "Display name: %s\nDirect rendering: %s\n", DisplayString( dpy ),
 		       gl.format().directRendering() ? "Yes" : "No" );

    for ( scrNum = 0; scrNum < numScreens; scrNum++ ) {
	screenInfo( dpy, scrNum, infotext );
	visualInfo( dpy, scrNum, infotext );
	if ( scrNum + 1 < numScreens )
	    infotext.append( "\n\n" );
    }
}
예제 #7
0
int main (void) {            
 
//-------------------------------------------------------------------------------------	
	//Variablen

	//PWM-Wert für Heizungsservos
	//MIN = 31 (1ms)
	//MAX = 63 (2ms)
	//uint16_t pwmWert=32;
	uint16_t pwmWert=62;	

	//System Modes
	enum ControllerStates
	{ 
		heatControlManualMode,
		heatControlAutoMode, 
		voltageControlMode, 
		tempInfoMode, 
		versionInfoMode
	} currentMode;
	
	//flag um zu speichern ob heat- manual oder auto mode zuletzt aktiv war
	//=1 -> Manual Mode
	//=2 -> Auto Mode
	uint8_t heatControlFlag=0;
	
	//Flags für Buttons(Menü-Button)
	//gedrückt       -> =0
	//lange gedrückt -> =2
	//ungedrückt     -> =1
	uint8_t buttonLinks=1;
	uint8_t buttonMitte=1;
	uint8_t buttonRechts=1;

	//Temperatur Variable für den Heat Control Auto Mode
	//Wert in °C
	//Uint16_t wegen Umwandlung in string mit utoa funktion
	uint16_t tempSollwert=20;

	//Variablen für die beiden Batterie-Spannungen
	uint16_t batt1Volt=0;
	uint16_t batt2Volt=0;

	//Variablen für die beiden Temperatur-Sensor Spannungen
	//Umrechnung in Temperatur erfolgt in Display Routine.
	uint16_t temp1Volt=0;
	uint16_t temp2Volt=0;

	//Variable die im Manual Heizungs Mode die Anzahl der auf dem Display dargestellten
	//"Heiz-Punkte" einstellt.
	uint8_t heizLevel=0;


//-------------------------------------------------------------------------------------	
	

	for(;;);
		
	//Initialisierungen
	sleep_disable();
		
	myInit();
	adcInit();
	pwmInit(pwmWert);
	pwmUpdate(pwmWert);
	lcd_init();
	menuInit();
	
	//set system led
	PORTD |= (1<<BIT7);

	//Start system in heat control auto mode
	//display regarding screen -> gleichbleibend heizen
	currentMode = heatControlManualMode;
	//screenHeatingManual(2, &heizLevel);
	//_delay_ms(3000);

	//enable interrupts for wakeup sleepmode
	sei();

	
//-------------------------------------------------------------------------------------
	

	while(1)  
	{   
		_delay_ms(100);


		//button links lesen
 	 	//nutzt das Debounce-Makro (debounce.h)
		if ((debounce(PIND,PD0))) 
		{
			buttonLinks=0;
		}
		else
		{
			buttonLinks=1;
		}

		//button mitte lesen
		if ((debounce(PIND,PD3)))
		{
			buttonMitte=0;
		}
		else
		{
			buttonMitte=1;
		}

		//button rechts lesen
		if ((debounce(PIND,PD2)))
		{
			buttonRechts=0;
		}
		else
		{
			buttonRechts=1;
		}
		

		//wenn buttonLinks einmal gedrückt wurde -> nächster Mode
		//heatControlFlag abfragen um zu wissen welcher heatControlMode
		//zuletzt aktiv war.
		if (buttonLinks==0)
		{	
			if (currentMode==versionInfoMode)
				if (heatControlFlag==2)
					currentMode=heatControlAutoMode;
				else 
					currentMode=heatControlManualMode;
			else
			{	
				currentMode +=1;
			}
		}


		//Mode selector
		switch (currentMode)
		{
			//---------------------------------------------------------------------------------------------
			case heatControlManualMode:
				//button links auf langen Tastendruck prüfen
				//prüfen -> kurz warten -> wenn immer noch gedrückt -> = lange gedrückt
				if ((debounce(PIND,PD0)))
				{
					_delay_ms(200);
					if ((debounce(PIND,PD0))) 
					{
						buttonLinks=2;
					}
				}
				//wenn button links lange gedrückt wurde -> wechsle in den anderen heating-mode	
				if (buttonLinks==2)
				{
					currentMode=heatControlAutoMode;
					screenHeatingAuto(tempSollwert);
				}
				//button mitte -> heizungs-level verringern (auf display und servo)
				else if (buttonMitte==0)
				{
					screenHeatingManual(0, &heizLevel);
					if (pwmWert>64)
					{
						pwmWert -= 2;
					}
					else
					{
						pwmWert=62;
					}
					pwmUpdate(pwmWert);
				}
				//button rechts -> heizungs-level erhöhen(auf display und servo)
				else if (buttonRechts==0)
				{
					screenHeatingManual(1, &heizLevel);
					if (pwmWert<118)
					{
						pwmWert += 2;
					}
					else
					{
						pwmWert=120;
					}
					pwmUpdate(pwmWert);
				}
				//wenn nichts gedrückt wurde aktuellen heizlevel auf display anzeigen
				else
				{
					screenHeatingManual(2, &heizLevel);
				}
				break;
			//---------------------------------------------------------------------------------------------
			case heatControlAutoMode:
				//button links auf langen Tastendruck prüfen
				//prüfen -> kurz warten -> wenn immer noch gedrückt -> = lange gedrückt
				if ((debounce(PIND,PD0)))
				{
					_delay_ms(100);
					if ((debounce(PIND,PD0))) 
					{
						buttonLinks=2;
					}
				}
				//wenn button links lange gedrückt wurde -> wechsle in den anderen heating-mode	
				if (buttonLinks==2)
				{
					currentMode=heatControlManualMode;
					screenHeatingManual(2, &heizLevel);
				}
				//button Mitte -> temperatur Sollwert für Regler verringern
				else if (buttonMitte==0)
				{
					if (tempSollwert>17)
					{
						tempSollwert -= 1;
					}
					else
					{
						tempSollwert=16;
					}
					screenHeatingAuto(tempSollwert);
				}
				//button rechts -> temperatur sollwert für regler erhöhen
				else if (buttonRechts==0)
				{
					if (tempSollwert<25)
					{
						tempSollwert += 1;
					}
					else
					{
						tempSollwert=26;
					}
					screenHeatingAuto(tempSollwert);
				}
				break;
			//---------------------------------------------------------------------------------------------
			case voltageControlMode:
				//start adc single conversion for both batteries
				//both values are voltage*100
				batt1Volt = adcRead15(4);
				batt2Volt = adcRead15(5);
				screenVoltageControl(batt1Volt, batt2Volt);
				break;
			//---------------------------------------------------------------------------------------------
			case tempInfoMode:
				//start adc single conversion for both temperature sensors voltages
				//both values are voltage*100
				temp1Volt = adcRead5(6);
				temp2Volt = adcRead5(7);
				screenTempInfo(temp1Volt,temp2Volt);
				break;
			//---------------------------------------------------------------------------------------------
			case versionInfoMode:
				screenInfo();
				break;
			//---------------------------------------------------------------------------------------------
			default:
				break;		
		}
		

		//Folgende routinen versetzen den controller in den sleep-mode wenn die zündungsspannung aus ist.
		// Zündung=ON  -> Transistor schaltet 0V -> PIND.6 = 0
		// Zündung=OFF -> Transistor sperrt      -> PIND.6 = 1 (interner Pull-Up)
		// ->Sleep ON
		/*
		if (PIND & (1<<BIT6))	
		{						
			screenGotoSleepmode();
			_delay_ms(2000);
			lcd_clear();
			PORTC &= ~(1<<BIT0);//Display -> Spannungslos (Display-Masse wird abgeschaltet)
			PORTC |= (1<<BIT1); //DisplayBeleuchtung -> spannungslos (über Darlington 0V an TransistorBasis)
			sleep_enable();	   
			sleep_cpu();
		}			
		
		//Wenn uC gerade aufgewacht ist, dann willkommens und battVolt Screens darstellen.
		if (wakeUp==1)
		{
			menuInit();
			wakeUp=0;
		}
		*/

	}
}