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