@@ -49,6 +49,8 | |||
|
49 | 49 | #define PSU_ALERT_1_5V PF3 |
|
50 | 50 | #define PSU_ALERT_3_3V PF4 |
|
51 | 51 | |
|
52 | #define LCD_RESET PE2 | |
|
53 | ||
|
52 | 54 | extern float VREF0; |
|
53 | 55 | |
|
54 | 56 | extern uint32_t currentCpuFreq; |
@@ -37,7 +37,7 LCD_t lcd0; | |||
|
37 | 37 | LCD_IF_t lcdIF0; |
|
38 | 38 | |
|
39 | 39 | volatile int16_t* lcd0_CMD=(volatile int16_t*)0x60000000; |
|
40 |
volatile int16_t* lcd0_DATA=(volatile int16_t*)(0x6 |
|
|
40 | volatile int16_t* lcd0_DATA=(volatile int16_t*)(0x61FFFFF0); | |
|
41 | 41 | |
|
42 | 42 | float VREF0 =(float)3.3; |
|
43 | 43 | |
@@ -109,6 +109,11 void bsp_FSMC_init() | |||
|
109 | 109 | #define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA)) |
|
110 | 110 | #define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8) |
|
111 | 111 | |
|
112 | gpio_t gpio1 = gpioopen(LCD_RESET); | |
|
113 | gpiosetspeed(&gpio1,gpiohighspeed); | |
|
114 | gpiosetdir(&gpio1,gpiooutdir); | |
|
115 | gpioclr(LCD_RESET); | |
|
116 | ||
|
112 | 117 | gpio_t LCD_DBxList[]={PD14,PD15,PD0,PD1,PE7,PE8,PE9,PE10,PE11,PE12,PE13,PE14,PE15\ |
|
113 | 118 | ,PD8,PD9,PD10,PD4,PD5,PD7,PE4}; |
|
114 | 119 | for(int i=0;i<20;i++) |
@@ -167,6 +172,7 void bsp_FSMC_init() | |||
|
167 | 172 | lcdIF0.writereg=&bsp_lcd0_write_reg; |
|
168 | 173 | lcd0.interface=&lcdIF0; |
|
169 | 174 | lcd0.init=&ili9328init; |
|
175 | gpioset(LCD_RESET); | |
|
170 | 176 | lcd0.init(&lcd0); |
|
171 | 177 | } |
|
172 | 178 | |
@@ -219,10 +225,6 void bsp_lcd0_write_reg(uint32_t reg,uin | |||
|
219 | 225 | { |
|
220 | 226 | *lcd0_CMD=(uint16_t)reg; |
|
221 | 227 | *lcd0_DATA=(uint16_t)data; |
|
222 | printf("Write to 0x%x 0x%x\n\r",reg,data); | |
|
223 | *lcd0_CMD=(uint16_t)reg; | |
|
224 | data = *lcd0_DATA; | |
|
225 | printf("Readback to 0x%x 0x%x\n\r",reg,data); | |
|
226 | 228 | } |
|
227 | 229 | |
|
228 | 230 |
@@ -16,40 +16,26 int main() | |||
|
16 | 16 | INA226_t ina5VSens,ina33VSens,ina15VSens; |
|
17 | 17 | gpioset(PSU_DISABLE); |
|
18 | 18 | volatile int16_t* regtest=(volatile int16_t*)0x60000000; |
|
19 |
volatile int16_t* regtest2=(volatile int16_t*)(0x6 |
|
|
19 | volatile int16_t* regtest2=(volatile int16_t*)(0x61FFFFF0); | |
|
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=(int16_t)0; |
|
23 | 23 | printf("LCD ID=%x\n\r",0xFFFF&(*regtest2)); |
|
24 | *regtest=(int16_t)ILI9328_REGISTER_ENTRYMODE; | |
|
25 | *regtest2=(int16_t)0x1008; | |
|
24 | //*regtest=(int16_t)ILI9328_REGISTER_ENTRYMODE; | |
|
25 | //*regtest2=(int16_t)0x1008; | |
|
26 | 26 | *regtest=(int16_t)0x20; |
|
27 | 27 | *regtest2=(int16_t)0x0; |
|
28 | 28 | *regtest=(int16_t)0x21; |
|
29 | 29 | *regtest2=(int16_t)0x0; |
|
30 | 30 | *regtest=(int16_t)0x22; |
|
31 | for(volatile int i=0;i<32;i++) | |
|
31 | for(volatile int i=0;i<(320*240);i++) | |
|
32 | 32 | { |
|
33 | *regtest=(int16_t)0x20; | |
|
34 | 33 | *regtest2=(int16_t)i; |
|
35 | *regtest=(int16_t)0x21; | |
|
36 | *regtest2=(int16_t)0x0; | |
|
37 | *regtest=(int16_t)0x22; | |
|
38 | *regtest2=(int16_t)-i; | |
|
34 | for(volatile int l=0;l<(1024);l++); | |
|
35 | ||
|
39 | 36 | } |
|
40 | *regtest=(int16_t)ILI9328_REGISTER_ENTRYMODE; | |
|
41 | *regtest2=(int16_t)0x1018; | |
|
42 | ||
|
43 | for(volatile int i=0;i<32;i++) | |
|
44 | { | |
|
45 | *regtest=(int16_t)0x20; | |
|
46 | *regtest2=(int16_t)i; | |
|
47 | *regtest=(int16_t)0x21; | |
|
48 | *regtest2=(int16_t)0x0; | |
|
49 | *regtest=(int16_t)0x22; | |
|
50 | int16_t test=*regtest2; | |
|
51 | printf("DATA@%d=%x\n\r",i,0xFFFF&(*regtest2)); | |
|
52 | } | |
|
37 | //*regtest=(int16_t)ILI9328_REGISTER_ENTRYMODE; | |
|
38 | //*regtest2=(int16_t)0x1018; | |
|
53 | 39 | |
|
54 | 40 | 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)) |
|
55 | 41 | { |
General Comments 0
You need to be logged in to leave comments.
Login now