##// END OF EJS Templates
Huge cleanup, removed "out of dir building" now libuc contains qmake and...
Huge cleanup, removed "out of dir building" now libuc contains qmake and spec files. Libuc uses now qmake's prl file for dependecy propagation.

File last commit:

r44:5f50f7fe4b06 dev_alexis
r71:608b7f0e27c2 dev_alexis
Show More
main.c
109 lines | 3.2 KiB | text/x-c | CLexer
#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());
ili9328paintFilCirc(&lcd0,x,y,r,rand(),t,rand());
//delay_100us(10);
//for(volatile int i=0;i<(1024*2);i++);
}
int main()
{
INA226_t ina5VSens,ina33VSens,ina15VSens;
gpioset(PSU_DISABLE);
volatile int16_t* regtest=(volatile int16_t*)0x60000000;
volatile int16_t* regtest2=(volatile int16_t*)(0x61FFFFF0);
//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);
*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();
if(-1==ina226open(&ina33VSens,i2c2,INA226_MODE_SHUNT_VOLTAGE_CONTINUOUS|INA226_AVERAGES_16|INA226_BUS_CONV_8244us|INA226_SHUNT_CONV_8244us,0,0,15,1000000))
{
printf("Can't open 3.3V monitor\n\r");
}
int current5V,current33V,current15V;
printf("\t5V\t3.3V\n\r");
while(1)
{
for(volatile int i=0;i<1024*1024;i++);
gpioset(LED1);
gpioclr(LED2);
for(volatile int i=0;i<1024*1024;i++);
gpioclr(LED1);
gpioset(LED2);
//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);
}
printf("hello world\n\r");
return 0;
}