Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: STM32F3-Discovery-minimal
Fork of Space_Invaders_Demo by
Diff: video.c
- Revision:
- 9:654866da5da4
- Parent:
- 8:34fb94209517
- Child:
- 10:8ffcefda667a
--- a/video.c Tue May 29 23:16:35 2018 +0000
+++ b/video.c Tue May 29 23:52:40 2018 +0000
@@ -97,10 +97,7 @@
Horizontal timing
-----------------
- Timer 1 period = 31468.53 Hz
-
- Since firing the DMA takes more or less 400ns, we'll start it 28 ticks early.
-
+ Timer 1 period = 31468.53 Hz
Horizontal timing info
----------------------
@@ -112,12 +109,13 @@
Sync pulse 96 3.8133068520357 275
Back porch 48 1.9066534260179 137
Whole line 800 31.777557100298 2288
+ Sync + bp 144 5.7199602780536 412
*/
TimerPeriod = 2288;//2303;
Channel1Pulse = 275;//274;//274;//277; /* HSYNC */
- Channel3Pulse = 382;//412;//394;
+ Channel3Pulse = 412;//412;//394;
TIM1->CR1 &= ~TIM_CR1_CEN;
@@ -290,7 +288,7 @@
//printf("l:%d\n",nlines);
nlines=0;
- DMA2_Channel1->CCR = DMA_CCR_DIR | DMA_CCR_MINC | DMA_CCR_PL_1 | DMA_CCR_PL_0 | DMA_CCR_TCIE | DMA_CCR_EN | DMA_CCR_CIRC;
+ DMA2_Channel1->CCR = DMA_CCR_DIR | DMA_CCR_MINC | DMA_CCR_PL_1 | DMA_CCR_PL_0 | DMA_CCR_TCIE | DMA_CCR_EN;// | DMA_CCR_CIRC;
}
//*****************************************************************************
@@ -315,7 +313,7 @@
vline++;
if (vline == VID_VSIZE) {
vdraw = vline = vflag = 0;
- DMA2_Channel1->CMAR = (u32) fba+fboffset;
+ DMA2_Channel1->CMAR = (u32)fba;
DMA2_Channel1->CPAR=&nlines;
GPIOD->ODR=0x00;
} else {
@@ -324,18 +322,13 @@
}
//GPIOD->ODR=0x00;
if(vflag)
- DMA2_Channel1->CCR = DMA_CCR_DIR | DMA_CCR_MINC | DMA_CCR_PL_1 | DMA_CCR_PL_0 | DMA_CCR_TCIE | DMA_CCR_EN | DMA_CCR_CIRC;
+ DMA2_Channel1->CCR = DMA_CCR_DIR | DMA_CCR_MINC | DMA_CCR_PL_1 | DMA_CCR_PL_0 | DMA_CCR_TCIE | DMA_CCR_EN;// | DMA_CCR_CIRC;
}
-__attribute__ ((section ("ccmram"))) void vidNextBuffer1(void) {
- char *fp=(unsigned *)fb[0];
- for(int i=0;i<VID_VSIZE*HTOTAL;i++)
- *fp++=(*fp>>4);//&0xf0f0f0f;
-}
__attribute__ ((section ("ccmram"))) void vidNextBuffer(void) {
- unsigned *fp=(unsigned *)fb[0];
+ unsigned *fp=(unsigned *)fba;
for(int i=0;i<VID_VSIZE*HTOTAL/4;i++)
*fp++=(*fp>>4)&0xf0f0f0f;
}
@@ -343,6 +336,7 @@
__attribute__ ((section ("ccmram"))) void waitForRefresh(void) {
while(vflag) __wfi();
}
+
void vidClearScreen(void) {
u16 x, y;
@@ -366,7 +360,7 @@
DMA_Configuration();
TIMER_Configuration();
for(i=0;i<VID_VSIZE;i++)
- fb[i]=fba+i*HTOTAL;
+ fb[i]=fba+i*HTOTAL+2;
vidClearScreen();
}
