コード例 #1
0
ファイル: Graphics.cpp プロジェクト: m1h4/Analyzed
HRESULT CGraphics::Reset(void)
{
	m_NeedReset = FALSE;

	// If the device can be restored, the application prepares the 
	// device by destroying all video-memory resources and any 
	// swap chains
	if(FAILED(Invalidate()))
	{
		TRACE(TEXT("Error: Failed to invalidate device.\n"));
		return E_FAIL;
	}

	// Try to reset the device
	HRESULT hr = m_Device->Reset(&m_PresentParameters);
	if(FAILED(hr))
	{
		// Check if error other than device lost
		if(hr != D3DERR_DEVICELOST)
		{
			HWND hWnd = GetWindowHandle();
			UINT width = GetWidth();
			UINT height = GetHeight();
			BOOL blur = GetBlur();

			UninitializeRenderer();
			UninitializeDisplay();
			InitializeDisplay(hWnd,width,height,blur);
			InitializeRenderer();
			TRACE(TEXT("Warning: Failed to reset the display device, reinitialized graphics.\n"));
			return S_FALSE;
		}

		// The device was lost again, so continue waiting until it can be reset
		TRACE(TEXT("Error: Failed to reset the display device.\n"));
		return S_FALSE;
	}

	// Finally, a lost device must re-create resources (including  
	// video memory resources) after it has been reset
	if(FAILED(Restore()))
	{
		HWND hWnd = GetWindowHandle();
		UINT width = GetWidth();
		UINT height = GetHeight();
		BOOL blur = GetBlur();

		UninitializeRenderer();
		UninitializeDisplay();
		InitializeDisplay(hWnd,width,height,blur);
		InitializeRenderer();
		TRACE(TEXT("Warning: Failed to restore device, reinitialized graphics.\n"));
		return false;
	}

	return S_OK;
}
コード例 #2
0
ファイル: MainDialog.cpp プロジェクト: zephyrer/update-it
BOOL CMainDialog::OnInitDialog(void)
{
	__super::OnInitDialog();

	// set dialog's icons
	SetIcon(m_hIcon, TRUE);
	SetIcon(m_hSmIcon, FALSE);

	// get our path name - we assume that crashed exe is in same directory
	ZeroMemory(m_szModulePath, sizeof(m_szModulePath));
	::GetModuleFileName(NULL, m_szModulePath, _countof(m_szModulePath) - 2);
	TCHAR *cp = _tcsrchr(m_szModulePath, _T('\\'));
	if (*cp)
	{
		*(cp + 1) = _T('\0');   // remove file name
	}

	InitializeDisplay();
	GetRegistryDetails();
	GetFileDetails();

	m_nFilesInZip = ZipFiles();

	LoadHandCursor();
	SetTimer(1, 80, NULL);

	// initialized
	return (TRUE);
}
コード例 #3
0
ファイル: main.c プロジェクト: FTGStudio/Sound-Visualizer
int main()
{
	// Set the clocking to run directly from the crystal.
	SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);

	//Initialize peripherals
	InitializeDisplay();
	InitializeTimers();
	InitializeADC();
	InitializeInterrupts();

	//Main program loop
	unsigned long avgADCValue = 0;
	while(1)
	{
		if(BufOneReadyToRead)
		{
			avgADCValue = GetAvgOfBuf(1);
			usnprintf(str, 25, "Buf1: %5u", avgADCValue);
			RIT128x96x4StringDraw(str, 0, 0, 15);
			BufOneReadyToRead = 0;
		}
		else if(BufTwoReadyToRead)
		{
			avgADCValue = GetAvgOfBuf(2);
			usnprintf(str, 25, "Buf2: %5u", avgADCValue);
			RIT128x96x4StringDraw(str, 0, 10, 15);
			BufTwoReadyToRead = 0;
		}
	}
}
コード例 #4
0
bool CWinEGLPlatformGeneric::CreateWindow()
{
  if (m_display == EGL_NO_DISPLAY || m_config == NULL)
  {
    if (!InitializeDisplay())
      return false;
  }
  
  if (m_surface != EGL_NO_SURFACE)
    return true;
  
  m_nativeWindow = getNativeWindow();

  m_surface = eglCreateWindowSurface(m_display, m_config, m_nativeWindow, NULL);
  if (!m_surface)
  {
    CLog::Log(LOGERROR, "EGL couldn't create window surface");
    return false;
  }

  // Let's get the current width and height
  EGLint width, height;
  if (!eglQuerySurface(m_display, m_surface, EGL_WIDTH, &width) || !eglQuerySurface(m_display, m_surface, EGL_HEIGHT, &height) ||
      width <= 0 || height <= 0)
  {
    CLog::Log(LOGERROR, "EGL couldn't provide the surface's width and/or height");
    return false;
  }

  m_width = width;
  m_height = height;
  
  return true;
}
コード例 #5
0
ファイル: XLibWindow.cpp プロジェクト: lambertjamesd/Krono
XLibWindow::XLibWindow(const Vector2i& size) :
	Window(size),
	mWindowHandle(0)
{
	InitializeDisplay();
	int screenNumber = DefaultScreen(gDisplay);

	::Window root = DefaultRootWindow(gDisplay);

	GLint attributes[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None };
	mVisualInfo = glXChooseVisual(gDisplay, 0, attributes);
	Colormap colorMap = XCreateColormap(gDisplay, root, mVisualInfo->visual, AllocNone);
	XSetWindowAttributes windowAttributes;

	windowAttributes.colormap = colorMap;
	windowAttributes.event_mask = ExposureMask | KeyPressMask;

	mWindowHandle = XCreateWindow(gDisplay, root,
		0, 0,
		size.x, size.y,
		0,
		mVisualInfo->depth, InputOutput, mVisualInfo->visual,
		CWColormap | CWEventMask,
		&windowAttributes);

	XSelectInput(gDisplay, mWindowHandle, ExposureMask | KeyPressMask);
	XSetWMProtocols(gDisplay, mWindowHandle, &WM_DELETE_WINDOW, 1);
}
コード例 #6
0
EFI_STATUS
EFIAPI
LcdGraphicsSetMode (
  IN EFI_GRAPHICS_OUTPUT_PROTOCOL   *This,
  IN UINT32                         ModeNumber
  )
{
  LCD_INSTANCE  *Instance;

  Instance = LCD_INSTANCE_FROM_GOP_THIS(This);

  if (ModeNumber >= Instance->Mode.MaxMode) {
    return EFI_UNSUPPORTED;
  }

  if (!mDisplayInitialized) {
    InitializeDisplay (Instance);
  }

  DssSetMode((UINT32)Instance->Mode.FrameBufferBase, ModeNumber);

  Instance->Mode.Mode = ModeNumber;
  Instance->ModeInfo.HorizontalResolution = LcdModes[ModeNumber].HorizontalResolution;
  Instance->ModeInfo.VerticalResolution = LcdModes[ModeNumber].VerticalResolution;

  return EFI_SUCCESS;
}
コード例 #7
0
ファイル: Display.c プロジェクト: vista980622/VgaShim
/**
  Performs the initial scan for graphics adapters if one
  has not been performed yet and returns a simple TRUE/FALSE
  information if one has been found and information about
  it is ready for use in the global DisplayInfo variable.

  @retval TRUE            An adapter has been found and its current
                          mode parameters stored in DisplayInfo
						  global variable.
  @retval other           No compatible adapters were found or
                          their mode parameters could not be
						  retrieved.
  
**/
EFI_STATUS
EnsureDisplayAvailable()
{
	if (!DisplayInfo.Initialized) {
		InitializeDisplay();
	}
	return DisplayInfo.AdapterFound && DisplayInfo.Protocol != NONE ? EFI_SUCCESS : EFI_NOT_FOUND;
}
コード例 #8
0
ファイル: AndroidEventLoop.cpp プロジェクト: mike96/Framework
    void AndroidEventLoop::Activate()
    {
        // Enables activity only if a window is available.
        if ((!mEnabled) && (Global::pAndroidApp->window != NULL))
        {
            mQuit = false; mEnabled = true;
            if ( InitializeDisplay() != STATUS_OK )
            {
            	mQuit = true;
				Deactivate();
				ANativeActivity_finish(Global::pAndroidApp->activity);
				return;
            }
            if (m_pActivityHandler->onActivate() != STATUS_OK)
            {
                mQuit = true;
                Deactivate();
                ANativeActivity_finish(Global::pAndroidApp->activity);
            }
        }
    }
コード例 #9
0
		ReturnValue WindowsEventLoop::Run(ActivityHandler* pActivityHandler)
		{
			m_pActivityHandler = pActivityHandler;
			m_isRunning=true;

			InitializeDisplay();
			m_pActivityHandler->onActivate();

			// Global step loop.
			while(m_isRunning)
			{
				ProcessEvents();
				if(m_pActivityHandler->onStep() != RETURN_VALUE_OK)
				{
					m_isRunning=false;
				}
				SwapBuffers();
			}

			m_pActivityHandler->onDeactivate();
			DestroyDisplay();
			return RETURN_VALUE_OK;
		}
コード例 #10
0
EFI_STATUS
EFIAPI
LcdGraphicsQueryMode (
  IN EFI_GRAPHICS_OUTPUT_PROTOCOL            *This,
  IN UINT32                                  ModeNumber,
  OUT UINTN                                  *SizeOfInfo,
  OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION   **Info
  )
{
  LCD_INSTANCE  *Instance;

  Instance = LCD_INSTANCE_FROM_GOP_THIS(This);

  if (!mDisplayInitialized) {
    InitializeDisplay (Instance);
  }

  // Error checking
  if ( (This == NULL) || (Info == NULL) || (SizeOfInfo == NULL) || (ModeNumber >= This->Mode->MaxMode) ) {
    DEBUG((DEBUG_ERROR, "LcdGraphicsQueryMode: ERROR - For mode number %d : Invalid Parameter.\n", ModeNumber ));
    return EFI_INVALID_PARAMETER;
  }

  *Info = AllocateCopyPool(sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION), &Instance->ModeInfo);
  if (*Info == NULL) {
    return EFI_OUT_OF_RESOURCES;
  }

  *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);

  (*Info)->Version = 0;
  (*Info)->HorizontalResolution = LcdModes[ModeNumber].HorizontalResolution;
  (*Info)->VerticalResolution = LcdModes[ModeNumber].VerticalResolution;
  (*Info)->PixelFormat = PixelBltOnly;

  return EFI_SUCCESS;
}
コード例 #11
0
void AmTimeView::AttachedToWindow()
{
	inherited::AttachedToWindow();
	if ( Parent() != 0 ) SetViewColor( Parent()->ViewColor() );
	InitializeDisplay();
}
コード例 #12
0
///////////////////////////////////////////////////////////////////////////////
// OnInitDialog
BOOL CCrashReportDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// get our path name - we assume that crashed exe is in same directory
	TCHAR appPath[_MAX_PATH];
	appPath[0]=0;
	::GetModuleFileName(NULL, appPath, _MAX_PATH);
	TCHAR *cp = _tcsrchr(appPath, _T('\\'));
	if (cp != NULL)
	{
		cp++;
		*cp = 0;
	}
	TCHAR crashedAppicationPath[MAX_PATH];
	_sntprintf(crashedAppicationPath, MAX_PATH, _T("%s%s"), appPath, CRASHREPORT_APPEXENAME);
	//=== Initialize the gui with the Crashed Title / icon
	InitializeDisplay(CRASHREPORT_APPTITLE, crashedAppicationPath);
	//=== Create the native report
	m_debugInfo += CollectInformation(crashedAppicationPath);


	//=== Application Monitor Data
#ifdef USE_APPLICATIONMONITOR
	TCHAR bf[MAX_PATH];
	GetModuleFileName(NULL, bf, MAX_PATH);
	LPTSTR pos = _tcsrchr(bf, '\\');
	pos[1] = 0;
	_tcscat(bf, CRASHREPORT_APPEXENAME);
	pos = _tcsrchr(bf, '.');
	pos[1] = 0;
	_tcscat(bf, _T("ini"));

	IniAppSettings settings;
	settings.Load(bf);
	std::basic_string<TCHAR> stateString;
	if (settings.Read(CRASHREPORT_INIMONITORSECTION, CRASHREPORT_INIMONITORVALUE, stateString, _T("")))
	{
		AppMonitor appMon;
		if (appMon.Load(stateString.c_str()))
		{
			const AppMonitor::State& state = appMon.GetState();
			m_appID = state.AppUniqueID;
			CString line;
			line.Format(_T("AppUniqueID: %u\r\n"), state.AppUniqueID);
			m_debugInfo += line;
			line.Format(_T("IsAfterCrashStatus: %d\r\n"), appMon.IsAfterCrash());
			m_debugInfo += line;
			line.Format(_T("Statistics: %d/%d - %d/%d\r\n"), 
				state.Crashes, 
				state.Runs, 
				state.TotalCrashes, 
				state.TotalRuns
				);
			m_debugInfo += line;
		}

	}

#endif


	//=== Add the rest of the files to the report
	INT fileNum = 0;
	LPCTSTR files[] = CRASHREPORT_FILES;
	while (files[fileNum] != 0)
	{
		TCHAR bf[MAX_PATH];
		_sntprintf(bf, MAX_PATH, _T("%s%s"), appPath, files[fileNum]);
		CStringA fileContents;
		if (ReadFileContents(bf, fileContents))
		{
			m_debugInfo += _T("\r\n@===");
			m_debugInfo += files[fileNum];
			m_debugInfo += _T("\r\n");
			m_debugInfo += CA2CT(fileContents);
		}
		fileNum++;
	}
	LoadHandCursor();
	SetTimer(1, 80, NULL);
	return TRUE;  // return TRUE  unless you set the focus to a control
}
コード例 #13
0
ファイル: LCD.c プロジェクト: Samuraikurisu/LCD_Lab6
void InitializeLCDIO()  //Initializes the starting state of the I/O for LCD.
{
  DDRK.ddrk=0xff;
  DDRD.ddrd=0xe0;
  InitializeDisplay();
}
コード例 #14
0
ファイル: main.c プロジェクト: synergia/BalanSyner
//-----------------------Private functions-----------------------------//
int main(void)
{
    uint16_t i;
    for( i = 0; i < 64000; i++) asm("nop");

    InitializeClock();
    InitializeSysTick();

#ifdef _USE_DISPLAY
    InitializeDisplay();
#endif

#ifdef _USE_MOTORS
    InitializeMotors();
#endif

#ifdef _USE_ADC_BATTERY
    InitializeBattery();
#endif

#ifdef _USE_ADC_SHARP
    InitializeSharp();
#endif

#ifdef _USE_ENCODERS
    InitializeEncoders();
#endif

#ifdef _USE_SERVOS
    InitializeServos();
#endif

#ifdef _USE_LED_NUCLEO
    InitializeLedNucleo();
#endif

#ifdef _USE_LED_14
    InitializeLed14();
#endif

#ifdef _USE_LED_EYE
    InitializeLedEye();
#endif

#ifdef _USE_BT
    InitializeBT();
#endif

#ifdef _USE_WIFI
    InitializeWifi();
#endif

#ifdef _USE_MPU
    InitializeMPU();
#endif

#if 0
    if(//MPU error))
{
    //sth bad had happened...
}
#endif


oMotors.SetSpeedLeft( 0.0f );
oMotors.SetSpeedRight( 0.0f );
oServos.SetAngleArmLeft( 0.0f );
oServos.SetAngleArmRight( 0.0f );
oServos.SetAngleCamVer( 0.0f );
oServos.SetAngleCamHor( -15.0f );
while (1)
{

}
return 0;
}
コード例 #15
0
ファイル: main.c プロジェクト: compihu/cardetector
int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_I2C1_Init();
  MX_USART1_UART_Init();
  MX_TIM16_Init();
  MX_TIM17_Init();

  /* USER CODE BEGIN 2 */
  g_config = g_config_default;

#ifdef USE_I2C
	g_i2c = I2cMaster_Init(&hi2c1);
	InitializeDisplay(g_i2c);
	I2cEEPROM_Init(&g_eeprom, g_i2c, EEPROMADDR, 1, 8);
#endif

#ifdef USE_SERIAL
	UsartInit(&huart1);
#endif

#if defined(USE_I2C) && defined(USE_LCD)
	I2cLcd_Clear(&g_lcd);
	I2cLcd_PrintStr(&g_lcd, "Hello");
#endif

#if defined(USE_SERIAL) && defined(USE_EEPROM)

#define TESTSIZE 2048/8

	HAL_StatusTypeDef st;
	uint8_t i2cBuffer[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

/*
	for(uint16_t i = 0; i < TESTSIZE; i += sizeof(i2cBuffer)) {
		if(!(i & (sizeof(i2cBuffer)-1))) {
			st = I2cEEPROM_Write(&g_eeprom, i, i2cBuffer, sizeof(i2cBuffer));
		}
	}

	for (uint16_t i = 0; i < TESTSIZE; ++i) {
		if(!(i & (sizeof(i2cBuffer)-1))) 	{
			st = I2cEEPROM_Read(&g_eeprom, i, i2cBuffer, sizeof(i2cBuffer));
			UsartSendStr("\r\n", 1);
			UsartPrintUint(i, 4, 1);
			UsartSendStr(" ", 1);
		}
		UsartPrintByte(i2cBuffer[i&(sizeof(i2cBuffer)-1)], 2, 1);
		UsartSendStr(" ", 1);
	}
	UsartSendStr("\r\n", 1);

	for(uint16_t i = 0; i < TESTSIZE; i += sizeof(i2cBuffer)) {
		if(!(i & (sizeof(i2cBuffer)-1))) {
			for(uint16_t j = 0; j<sizeof(i2cBuffer); ++j)
				i2cBuffer[j] = i+j;
			st = I2cEEPROM_Write(&g_eeprom, i, i2cBuffer, sizeof(i2cBuffer));
		}
	}

	for (uint16_t i = 0; i < TESTSIZE; ++i) {
		if(!(i & (sizeof(i2cBuffer)-1))) 	{
			st = I2cEEPROM_Read(&g_eeprom, i, i2cBuffer, sizeof(i2cBuffer));
			UsartSendStr("\r\n", 1);
			UsartPrintUint(i, 4, 1);
			UsartSendStr(" ", 1);
		}
		UsartPrintByte(i2cBuffer[i&(sizeof(i2cBuffer)-1)], 2, 1);
		UsartSendStr(" ", 1);
	}
	UsartSendStr("\r\n", 1);
*/
	{
		LIVECONFIG config;

		if (I2cEEPROM_Read(&g_eeprom, EESTART, &config, sizeof(config)) == HAL_OK) {
			I2cMaster_WaitCallback(g_i2c);
			if (config.magic == 0xA5)
				g_config = config;
		}
	}

	for (uint16_t i = 0; i < TESTSIZE; ++i) {
		if(!(i & (sizeof(i2cBuffer)-1))) 	{
			st = I2cEEPROM_Read(&g_eeprom, i, i2cBuffer, sizeof(i2cBuffer));
			UsartSendStr("\r\n", 1);
			UsartPrintUint(i, 4, 1);
			UsartSendStr(" ", 1);
		}
		UsartPrintByte(i2cBuffer[i&(sizeof(i2cBuffer)-1)], 2, 1);
		UsartSendStr(" ", 1);
	}
	UsartSendStr("\r\n", 1);

#endif
	HAL_TIM_IC_Start_IT(&htim16, TIM_CHANNEL_1);
	HAL_TIM_IC_Start_IT(&htim17, TIM_CHANNEL_1);

	HAL_UART_Receive_IT(&huart1, g_lineBuffer, sizeof(g_lineBuffer));

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */

	while (1) {

		if (g_lineReceived) {
			ProcessInput(&g_config, (char*) g_lineBuffer);
			//DisplayInput(&i2clcd);
			g_lineReceived = 0;
			HAL_UART_Receive_IT(&huart1, g_lineBuffer, sizeof(g_lineBuffer));
		}

		if(g_statuses[0].trigger) {
		  DisplayResults(0);
		  g_statuses[0].trigger = 0;
		}
		if(g_statuses[1].trigger) {
		  DisplayResults(1);
		  g_statuses[1].trigger = 0;
		}

  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

	}
  /* USER CODE END 3 */

}