|
|
#include <stdio.h>
|
|
|
#include <fat32.h>
|
|
|
#include <gpio.h>
|
|
|
#include <uart.h>
|
|
|
#include <stm32f4xx.h>
|
|
|
#include <math.h>
|
|
|
#include <bsp.h>
|
|
|
#include <i2c.h>
|
|
|
#include <CS43L22.h>
|
|
|
#include <ina226.h>
|
|
|
#include <fonts.h>
|
|
|
#include <stdlib.h>
|
|
|
#include <core.h>
|
|
|
|
|
|
|
|
|
extern streamdevice* __opnfiles__[];
|
|
|
|
|
|
#define LCD_COLOR_WHITE 0xFFFF
|
|
|
#define LCD_COLOR_BLACK 0x0000
|
|
|
#define LCD_COLOR_GREY 0xF7DE
|
|
|
#define LCD_COLOR_BLUE 0x001F
|
|
|
#define LCD_COLOR_BLUE2 0x051F
|
|
|
#define LCD_COLOR_RED 0xF800
|
|
|
#define LCD_COLOR_MAGENTA 0xF81F
|
|
|
#define LCD_COLOR_GREEN 0x07E0
|
|
|
#define LCD_COLOR_CYAN 0x7FFF
|
|
|
#define LCD_COLOR_YELLOW 0xFFE0
|
|
|
|
|
|
|
|
|
void monkDemo()
|
|
|
{
|
|
|
while(1)
|
|
|
{
|
|
|
lcd0.paintText(&lcd0," ",10,Monk_24.Height+10,&Monk_24,LCD_COLOR_BLACK);
|
|
|
lcd0.paintText(&lcd0," ",230-Monk_24.Width,310,&Monk_24,LCD_COLOR_BLUE);
|
|
|
for(volatile int i=0;i<(1024*1024*16);i++);
|
|
|
lcd0.paintFilRect(&lcd0,0,0,240,320,LCD_COLOR_WHITE,1,LCD_COLOR_WHITE);
|
|
|
for(volatile int i=0;i<(1024*1024*4);i++);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
void randBoxesDemo()
|
|
|
{
|
|
|
int16_t x,y,w,h,t,r;
|
|
|
x=rand()%240;
|
|
|
y=rand()%320;
|
|
|
w=rand()%(240-x);
|
|
|
if(x>y)
|
|
|
r=(rand()%(y))%(320-y);
|
|
|
else
|
|
|
r=(rand()%(x))%(240-x);
|
|
|
h=rand()%(320-y);
|
|
|
t=rand()%(10);
|
|
|
//ili9328paintFilRect(&lcd0,x,y,w,h,rand(),t,rand());
|
|
|
ili9328paintFilCircMidPoint(&lcd0,x,y,r,rand(),t,rand());
|
|
|
}
|
|
|
|
|
|
int main()
|
|
|
{
|
|
|
//volatile int16_t* regtest=(volatile int16_t*) 0x80000000;
|
|
|
//volatile int16_t* regtest2=(volatile int16_t*)(0x80000001);
|
|
|
//*regtest=(int16_t)0;
|
|
|
//printf("LCD ID=%x\n\r",0xFFFF&(*regtest2));
|
|
|
printf("Sys Tick=%d\n\r",SysTick->VAL);
|
|
|
printf("Sys Tick=%d\n\r",SysTick->VAL);
|
|
|
printf("Sys Tick=%d\n\r",SysTick->VAL);
|
|
|
printf("Sys Tick=%d\n\r",SysTick->VAL);
|
|
|
ili9328paintFilRect(&lcd0,0,0,240,320,LCD_COLOR_BLACK,1,LCD_COLOR_WHITE);
|
|
|
// while(1)randBoxesDemo();//monkDemo();
|
|
|
ili9328paintFilCircMidPoint(&lcd0,120,160,100,LCD_COLOR_BLUE2,10,LCD_COLOR_GREEN);
|
|
|
while(1)
|
|
|
{
|
|
|
delay_100us(5000);
|
|
|
gpioset(LED1);
|
|
|
gpioclr(LED2);
|
|
|
delay_100us(5000);
|
|
|
gpioclr(LED1);
|
|
|
gpioset(LED2);
|
|
|
}
|
|
|
printf("hello world\n\r");
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|