Esempio n. 1
0
static void HSYNCHandler175()
{
	switch(VGAHorizontalSyncInterruptType())
	{
		case VGAHorizontalSyncStartInterrupt:
			RaiseVGAHSYNCLine();
		break;

		case VGAHorizontalSyncEndInterrupt:
			LowerVGAHSYNCLine();
		break;

		case VGAVideoStartInterrupt:
			if(Line<350)
			{
				StartPixelDMA();
				if(Line&1) CurrentLineAddress+=PixelsPerRow;
			}
			else if(Line==350)
			{
				Frame++;
				// TODO: VBlank interrupt.
			}
			else if(Line==387)
			{
				LowerVGAVSYNCLine();
			}
			else if(Line==389)
			{		
				RaiseVGAVSYNCLine();
			}
			else if(Line==448)
			{
				Line=-1;
				CurrentLineAddress=FrameBufferAddress;
			}
			Line++;
		break;
	}
}
Esempio n. 2
0
void InitializeVGAPort(void)
{
	GPIO_InitTypeDef GPIO_InitStructure;

	//Enable peripheral clocks
	RCC_AHB1PeriphClockCmd(GPIO_DAC_PORT_CLK | GPIO_HSYNC_PORT_CLK | GPIO_VSYNC_PORT_CLK | RCC_AHB1ENR_DMA2EN, ENABLE);
	RCC_APB2PeriphClockCmd(RCC_APB2ENR_TIM8EN | RCC_APB2ENR_TIM9EN | RCC_APB2ENR_SYSCFGEN, ENABLE);


	//Configure DAC Pins
	GPIO_InitStructure.GPIO_Pin = GPIO_DAC_PINS;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
	GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
	GPIO_Init(GPIO_DAC_PORT, &GPIO_InitStructure);

	//DAC Output = Black
	GPIO_ResetBits(GPIO_DAC_PORT, GPIO_DAC_PINS);


	//Configure HSYNC pin
	GPIO_InitStructure.GPIO_Pin = GPIO_HSYNC_PIN;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
	GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
	GPIO_Init(GPIO_HSYNC_PORT, &GPIO_InitStructure);

	//Configure VSYNC pin
	GPIO_InitStructure.GPIO_Pin = GPIO_VSYNC_PIN;
	GPIO_Init(GPIO_VSYNC_PORT, &GPIO_InitStructure);

	//SYNC Pins = idle high
	RaiseVGAHSYNCLine();
	RaiseVGAVSYNCLine();
}