@@ -1,57 +1,57 | |||
|
1 | 1 | #include <stdio.h> |
|
2 | 2 | #include <fat32.h> |
|
3 | 3 | #include <gpio.h> |
|
4 | 4 | #include <uart.h> |
|
5 | 5 | #include <stm32f4xx.h> |
|
6 | 6 | #include <bsp.h> |
|
7 | 7 | #include <i2c.h> |
|
8 | 8 | #include <CS43L22.h> |
|
9 | 9 | #include <ina226.h> |
|
10 | 10 | |
|
11 | 11 | |
|
12 | 12 | extern streamdevice* __opnfiles__[]; |
|
13 | 13 | |
|
14 | 14 | int main() |
|
15 | 15 | { |
|
16 | 16 | INA226_t ina5VSens,ina33VSens,ina15VSens; |
|
17 | 17 | gpioset(PSU_DISABLE); |
|
18 |
volatile int |
|
|
19 |
volatile int |
|
|
18 | volatile int16_t* regtest=(volatile int16_t*)0x60000000; | |
|
19 | volatile int16_t* regtest2=(volatile int16_t*)(0x60000000+(1<<20)); | |
|
20 | 20 | //ina226open(&ina5VSens,i2c2,INA226_MODE_SHUNT_VOLTAGE_CONTINUOUS|INA226_AVERAGES_16|INA226_BUS_CONV_8244us|INA226_SHUNT_CONV_8244us,0,0,15,1000000); |
|
21 | 21 | //ina226open(&ina15VSens,i2c2,INA226_MODE_SHUNT_VOLTAGE_CONTINUOUS|INA226_AVERAGES_16|INA226_BUS_CONV_8244us|INA226_SHUNT_CONV_8244us,1,0,15,1000000); |
|
22 | 22 | *regtest=0; |
|
23 |
printf("LCD ID=% |
|
|
23 | printf("LCD ID=%x\n\r",0xFFFF&(*regtest2)); | |
|
24 | 24 | 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)) |
|
25 | 25 | { |
|
26 | 26 | printf("Can't open 3.3V monitor\n\r"); |
|
27 | 27 | } |
|
28 | 28 | |
|
29 | 29 | int current5V,current33V,current15V; |
|
30 | 30 | printf("\t5V\t3.3V\n\r"); |
|
31 | 31 | while(1) |
|
32 | 32 | { |
|
33 | 33 | for(volatile int i=0;i<1024*1024;i++); |
|
34 | 34 | gpioset(LED1); |
|
35 | 35 | gpioclr(LED2); |
|
36 | 36 | for(volatile int i=0;i<1024*1024;i++); |
|
37 | 37 | gpioclr(LED1); |
|
38 | 38 | gpioset(LED2); |
|
39 | 39 | //current5V = ina226getCurrent(&ina5VSens); |
|
40 | 40 | current33V = ina226getCurrent(&ina33VSens); |
|
41 | 41 | //current15V = ina226getCurrent(&ina15VSens); |
|
42 | 42 | //current = ina226getReg(&Psens1,INA226_Current_Reg); |
|
43 | 43 | //printf("%duA %dmA\t%duA %dmA\n\r",current5V,current5V/1000,current33V,current33V/1000); |
|
44 | 44 | printf("%duA %dmA\n\r",current33V,current33V/1000); |
|
45 | 45 | } |
|
46 | 46 | printf("hello world\n\r"); |
|
47 | 47 | return 0; |
|
48 | 48 | } |
|
49 | 49 | |
|
50 | 50 | |
|
51 | 51 | |
|
52 | 52 | |
|
53 | 53 | |
|
54 | 54 | |
|
55 | 55 | |
|
56 | 56 | |
|
57 | 57 |
General Comments 0
You need to be logged in to leave comments.
Login now