|
|
#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 <STMPE811.h>
|
|
|
#include <ina226.h>
|
|
|
#include <fonts.h>
|
|
|
#include <stdlib.h>
|
|
|
#include <core.h>
|
|
|
#include <terminal.h>
|
|
|
|
|
|
extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
|
|
|
|
|
|
#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 testAudioDAC()
|
|
|
{
|
|
|
CS43L22_t dac;
|
|
|
cs43l22open(&dac,i2c1,0);
|
|
|
uint8_t ID= cs43l22getID(&dac);
|
|
|
printf("dac ID = %d\n\r",ID);
|
|
|
}
|
|
|
|
|
|
void testIOEXPender()
|
|
|
{
|
|
|
STMPE811_t ioexp1,ioexp2;
|
|
|
char data[2]={0,0};
|
|
|
i2cwrite(i2c1,0x50,data,1);
|
|
|
|
|
|
//i2cread(i2c1,0x88,data,2);
|
|
|
// stmpe811init(&ioexp1,i2c1,0);
|
|
|
// stmpe811init(&ioexp2,i2c1,1);
|
|
|
// printf("Scan for IOEXPANDER:\n\r ID1=%d\n\rID2=%d",stmpe811getID(&ioexp1),stmpe811getID(&ioexp2));
|
|
|
}
|
|
|
|
|
|
int main()
|
|
|
{
|
|
|
delay_100us(10000);
|
|
|
uint16_t innerbuffer[16];
|
|
|
uint16_t outterbuffer[16];
|
|
|
for(int i=0;i<16;i++)innerbuffer[i]=LCD_COLOR_BLUE;
|
|
|
for(int i=0;i<16;i++)outterbuffer[i]=LCD_COLOR_RED;
|
|
|
ili9328paintFilRect(&lcd0,0,0,240,320,LCD_COLOR_CYAN,5,LCD_COLOR_BLACK);
|
|
|
|
|
|
streamdevice* fd1=__opnfiles__[1];
|
|
|
streamdevice fd2;
|
|
|
int i=0;
|
|
|
terminal_t terminal0,terminal1;
|
|
|
terminal_init(&terminal0,&lcd0,&ComicSansMS_18,fd1);
|
|
|
//terminal_init(&terminal1,&lcd0,&ComicSansMS_18,&fd2);
|
|
|
terminal_setgeometry(&terminal0,5,5,terminal0.LCD->width-10,(terminal0.LCD->height)-10);
|
|
|
//terminal_setbackgroundColor(&terminal1,0xFFFF);
|
|
|
//terminal_settextColor(&terminal1,0x0000);
|
|
|
//terminal_setgeometry(&terminal1,5,(terminal0.LCD->height/2)+5,terminal0.LCD->width-10,(terminal0.LCD->height/2)-10);
|
|
|
printf("Line cnt :\n \t%d\n",terminal0.lineCount);
|
|
|
printf("Column cnt :\n \t%d\n",terminal0.columnCount);
|
|
|
printf("CPU Freq :\n \t%dMHz\n",getCpuFreq()/1000000);
|
|
|
//testAudioDAC();
|
|
|
testIOEXPender();
|
|
|
while(1)
|
|
|
{
|
|
|
i%=1000;
|
|
|
//terminal->write(&terminal," Hi",1, 2);
|
|
|
//delay_100us(1000);
|
|
|
gpioset(LED1);
|
|
|
//delay_100us(1000);
|
|
|
gpioclr(LED1);
|
|
|
}
|
|
|
printf("hello world\n\r");
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|