main.c
93 lines
| 2.8 KiB
| text/x-c
|
CLexer
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r22 | #include <stdio.h> | ||
#include <fat32.h> | ||||
#include <gpio.h> | ||||
#include <uart.h> | ||||
#include <stm32f4xx.h> | ||||
#include <bsp.h> | ||||
#include <i2c.h> | ||||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r27 | #include <CS43L22.h> | ||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r29 | #include <ina226.h> | ||
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
|
r35 | #include <fonts.h> | ||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r22 | |||
extern streamdevice* __opnfiles__[]; | ||||
int main() | ||||
{ | ||||
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
|
r30 | INA226_t ina5VSens,ina33VSens,ina15VSens; | ||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r29 | gpioset(PSU_DISABLE); | ||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r31 | volatile int16_t* regtest=(volatile int16_t*)0x60000000; | ||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r34 | volatile int16_t* regtest2=(volatile int16_t*)(0x61FFFFF0); | ||
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
|
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
|
r32 | *regtest=(int16_t)0; | ||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r31 | printf("LCD ID=%x\n\r",0xFFFF&(*regtest2)); | ||
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
|
r35 | |||
while(1) | ||||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r32 | { | ||
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
|
r35 | /* *regtest=(int16_t)ILI9328_REGISTER_ENTRYMODE; | ||
*regtest2=(int16_t)0x1008;*/ | ||||
ili9328setFrame(&lcd0,0,0,240,320); | ||||
*regtest=(int16_t)0x22; | ||||
for(volatile int i=0;i<(320*240);i++) | ||||
{ | ||||
*regtest2=(int16_t)0x001F; | ||||
//for(volatile int l=0;l<(1024);l++); | ||||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r34 | |||
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
|
r35 | } | ||
/* *regtest=(int16_t)ILI9328_REGISTER_ENTRYMODE; | ||||
*regtest2=(int16_t)0x1018;*/ | ||||
for(volatile int i=0;i<(320*240*100);i++); | ||||
/* *regtest=(int16_t)ILI9328_REGISTER_ENTRYMODE; | ||||
*regtest2=(int16_t)0x1008;*/ | ||||
//ili9328setGRAMaddress(&lcd0,60,80); | ||||
uint16_t test[80*80]; | ||||
ili9328setFrame(&lcd0,10,10,100,100); | ||||
*regtest=(int16_t)0x22; | ||||
for(volatile int i=0;i<(100*100);i++) | ||||
{ | ||||
*regtest2=(int16_t)(0xF800); | ||||
//test[i]=(int16_t)0xF800; | ||||
//for(volatile int l=0;l<(1024);l++); | ||||
} | ||||
//lcd0.paint(&lcd0,test,100,100,80,80); | ||||
/**regtest=(int16_t)ILI9328_REGISTER_ENTRYMODE; | ||||
*regtest2=(int16_t)0x1018;*/ | ||||
for(volatile int i=0;i<(320*240*100);i++); | ||||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r32 | } | ||
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
|
r33 | |||
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
|
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
|
r22 | while(1) | ||
{ | ||||
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
|
r30 | for(volatile int i=0;i<1024*1024;i++); | ||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r22 | gpioset(LED1); | ||
gpioclr(LED2); | ||||
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
|
r30 | for(volatile int i=0;i<1024*1024;i++); | ||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r22 | gpioclr(LED1); | ||
gpioset(LED2); | ||||
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
|
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
|
r22 | } | ||
printf("hello world\n\r"); | ||||
return 0; | ||||
} | ||||