##// END OF EJS Templates
Added ARM CMSIS for fast math and circle drawing function for ili9328 driver.
Added ARM CMSIS for fast math and circle drawing function for ili9328 driver.

File last commit:

r41:27c5438a4566 dev_alexis
r41:27c5438a4566 dev_alexis
Show More
main.c
109 lines | 3.2 KiB | text/x-c | CLexer
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r22 #include <stdio.h>
#include <fat32.h>
#include <gpio.h>
#include <uart.h>
#include <stm32f4xx.h>
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Sync
r39 #include <math.h>
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r22 #include <bsp.h>
#include <i2c.h>
jeandet@PC-DE-JEANDET.lab-lpp.local
Sync
r27 #include <CS43L22.h>
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r29 #include <ina226.h>
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
sync
r35 #include <fonts.h>
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Sync
r39 #include <stdlib.h>
#include <core.h>
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r22
extern streamdevice* __opnfiles__[];
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
added text painter on ili9328
r37 #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
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Sync
r39 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()
{
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Added ARM CMSIS for fast math and circle drawing function for ili9328 driver.
r41 int16_t x,y,w,h,t,r;
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Sync
r39 x=rand()%240;
y=rand()%320;
w=rand()%(240-x);
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Added ARM CMSIS for fast math and circle drawing function for ili9328 driver.
r41 if(x>y)
r=(rand()%(y))%(320-y);
else
r=(rand()%(x))%(240-x);
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Sync
r39 h=rand()%(320-y);
jeandet@PC-DE-JEANDET.lab-lpp.local
added Systick handler with 100us period
r40 t=rand()%(10);
ili9328paintFilRect(&lcd0,x,y,w,h,rand(),t,rand());
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Added ARM CMSIS for fast math and circle drawing function for ili9328 driver.
r41 ili9328paintFilCirc(&lcd0,x,y,r,rand(),t,rand());
//delay_100us(10);
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Sync
r39 //for(volatile int i=0;i<(1024*2);i++);
}
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r22 int main()
{
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
I2C library partially validated, ina226 library partially validated.
r30 INA226_t ina5VSens,ina33VSens,ina15VSens;
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r29 gpioset(PSU_DISABLE);
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r31 volatile int16_t* regtest=(volatile int16_t*)0x60000000;
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r34 volatile int16_t* regtest2=(volatile int16_t*)(0x61FFFFF0);
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
I2C library partially validated, ina226 library partially validated.
r30 //ina226open(&ina5VSens,i2c2,INA226_MODE_SHUNT_VOLTAGE_CONTINUOUS|INA226_AVERAGES_16|INA226_BUS_CONV_8244us|INA226_SHUNT_CONV_8244us,0,0,15,1000000);
//ina226open(&ina15VSens,i2c2,INA226_MODE_SHUNT_VOLTAGE_CONTINUOUS|INA226_AVERAGES_16|INA226_BUS_CONV_8244us|INA226_SHUNT_CONV_8244us,1,0,15,1000000);
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r32 *regtest=(int16_t)0;
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r31 printf("LCD ID=%x\n\r",0xFFFF&(*regtest2));
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Sync
r39 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,1,1,3,3,LCD_COLOR_BLACK,1,LCD_COLOR_WHITE);
while(1)randBoxesDemo();
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
I2C library partially validated, ina226 library partially validated.
r30 if(-1==ina226open(&ina33VSens,i2c2,INA226_MODE_SHUNT_VOLTAGE_CONTINUOUS|INA226_AVERAGES_16|INA226_BUS_CONV_8244us|INA226_SHUNT_CONV_8244us,0,1,15,1000000))
{
printf("Can't open 3.3V monitor\n\r");
}
int current5V,current33V,current15V;
printf("\t5V\t3.3V\n\r");
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r22 while(1)
{
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
I2C library partially validated, ina226 library partially validated.
r30 for(volatile int i=0;i<1024*1024;i++);
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r22 gpioset(LED1);
gpioclr(LED2);
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
I2C library partially validated, ina226 library partially validated.
r30 for(volatile int i=0;i<1024*1024;i++);
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r22 gpioclr(LED1);
gpioset(LED2);
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
I2C library partially validated, ina226 library partially validated.
r30 //current5V = ina226getCurrent(&ina5VSens);
current33V = ina226getCurrent(&ina33VSens);
//current15V = ina226getCurrent(&ina15VSens);
//current = ina226getReg(&Psens1,INA226_Current_Reg);
//printf("%duA %dmA\t%duA %dmA\n\r",current5V,current5V/1000,current33V,current33V/1000);
printf("%duA %dmA\n\r",current33V,current33V/1000);
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r22 }
printf("hello world\n\r");
return 0;
}