Demo of low res colour vga video for stm32f3 discovery board

Dependencies:   STM32F3-Discovery-minimal

Fork of Space_Invaders_Demo by Martin Johnson

Committer:
MartinJohnson
Date:
Wed Apr 03 22:05:56 2019 +0000
Revision:
17:833f1b69e11d
Parent:
14:3035b3271395
update library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MartinJohnson 0:404dae88af71 1 /***************************************************************************
MartinJohnson 0:404dae88af71 2 * STM32 VGA demo
MartinJohnson 0:404dae88af71 3 * Copyright (C) 2012 Artekit Italy
MartinJohnson 0:404dae88af71 4 * http://www.artekit.eu
MartinJohnson 0:404dae88af71 5 * Written by Ruben H. Meleca
MartinJohnson 0:404dae88af71 6
MartinJohnson 0:404dae88af71 7 ### main.c
MartinJohnson 0:404dae88af71 8
MartinJohnson 0:404dae88af71 9 # This program is free software; you can redistribute it and/or modify
MartinJohnson 0:404dae88af71 10 # it under the terms of the GNU General Public License as published by
MartinJohnson 0:404dae88af71 11 # the Free Software Foundation; either version 2 of the License, or
MartinJohnson 0:404dae88af71 12 # (at your option) any later version.
MartinJohnson 0:404dae88af71 13 #
MartinJohnson 0:404dae88af71 14 # This program is distributed in the hope that it will be useful,
MartinJohnson 0:404dae88af71 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
MartinJohnson 0:404dae88af71 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MartinJohnson 0:404dae88af71 17 # GNU General Public License for more details.
MartinJohnson 0:404dae88af71 18 #
MartinJohnson 0:404dae88af71 19 # You should have received a copy of the GNU General Public License
MartinJohnson 0:404dae88af71 20 # along with this program; if not, write to the Free Software
MartinJohnson 0:404dae88af71 21 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
MartinJohnson 0:404dae88af71 22
MartinJohnson 0:404dae88af71 23 ***************************************************************************/
MartinJohnson 0:404dae88af71 24
MartinJohnson 0:404dae88af71 25 #include "stm32f30x.h"
MartinJohnson 0:404dae88af71 26 #include "sys.h"
MartinJohnson 0:404dae88af71 27 #include "video.h"
MartinJohnson 0:404dae88af71 28 #include "gdi.h"
MartinJohnson 14:3035b3271395 29 #include "menu.h"
MartinJohnson 0:404dae88af71 30
MartinJohnson 0:404dae88af71 31 extern void demoInit(void);
MartinJohnson 0:404dae88af71 32
MartinJohnson 3:93e488fbb8a2 33 void RCC_Configuration(void) {
MartinJohnson 14:3035b3271395 34 RCC->AHBENR |= RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOEEN ;
MartinJohnson 0:404dae88af71 35 }
MartinJohnson 14:3035b3271395 36 extern void bounce(),conway_demo(),bubble_demo(),rotozoom(),cube_demo();
MartinJohnson 14:3035b3271395 37 menuentry_t entries[]={{"Ball Game",bounce},{"Game Of Life",conway_demo},{"Bubbles",bubble_demo},{"Graphics Demo",demoInit},{"RotoZoom",rotozoom},{"Cube",cube_demo}};
MartinJohnson 14:3035b3271395 38 menu_t mainmenu={"Demo Menu",sizeof(entries)/sizeof(menuentry_t),entries};
MartinJohnson 0:404dae88af71 39
MartinJohnson 3:93e488fbb8a2 40 void GPIO_Configuration(void) {
MartinJohnson 3:93e488fbb8a2 41 GPIOE->MODER = (GPIOE->MODER&0xffff) | 0x55550000; // output mode for PE8-15
MartinJohnson 3:93e488fbb8a2 42 GPIOA->MODER = (GPIOA->MODER&0xfffffffc) ; // input mode for PA0
MartinJohnson 3:93e488fbb8a2 43 GPIOA->PUPDR = (GPIOA->PUPDR & ~0x3) | 0x2; // pull down (10)
MartinJohnson 0:404dae88af71 44 }
MartinJohnson 3:93e488fbb8a2 45 extern void siInit(void);
MartinJohnson 3:93e488fbb8a2 46 int main(void) {
MartinJohnson 0:404dae88af71 47 RCC_Configuration();
MartinJohnson 0:404dae88af71 48 GPIO_Configuration();
MartinJohnson 0:404dae88af71 49 vidInit();
MartinJohnson 0:404dae88af71 50 sysInitSystemTimer();
MartinJohnson 14:3035b3271395 51 menu(&mainmenu);
MartinJohnson 3:93e488fbb8a2 52 if(GPIOA->IDR & 1)
MartinJohnson 0:404dae88af71 53 demoInit();
MartinJohnson 0:404dae88af71 54 else
MartinJohnson 3:93e488fbb8a2 55 bounce();
MartinJohnson 0:404dae88af71 56 return 0;
MartinJohnson 0:404dae88af71 57 }
MartinJohnson 0:404dae88af71 58