Mercurial > ~darius > hgwebdir.cgi > stm32temp
comparison main.c @ 7:9404b9869c27
Make the LCD panel work (timings, GPIOE clock needs to be on, etc)
Factor out LCD init (needs more work)
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Sun, 22 Jan 2012 17:10:51 +1030 |
parents | efa2c22266e3 |
children | 58d76cf522ff |
comparison
equal
deleted
inserted
replaced
6:2b92d9632999 | 7:9404b9869c27 |
---|---|
117 comm_puts("Can't setup SysTick\r\n"); | 117 comm_puts("Can't setup SysTick\r\n"); |
118 while (1) | 118 while (1) |
119 ; | 119 ; |
120 } | 120 } |
121 | 121 |
122 /* Init LCD interface */ | 122 /* Init LCD panel */ |
123 LCD_init(); | 123 LCD_init(); |
124 | 124 |
125 /* Set stdout to unbuffered */ | 125 /* Set stdout to unbuffered */ |
126 setvbuf(stdout, NULL, _IONBF, 0); | 126 setvbuf(stdout, NULL, _IONBF, 0); |
127 | 127 |
128 /* Say hello */ | 128 /* Say hello */ |
129 fputs("\r\nHello world\r\n", stdout); | 129 fputs("\r\n\r\n\r\nHello world\r\n", stdout); |
130 | 130 |
131 while (1) { | 131 while (1) { |
132 fputs("> ", stdout); | 132 fputs("> ", stdout); |
133 | 133 |
134 while (cmd.state != 255) | 134 while (cmd.state != 255) |
143 } else if (!strncmp("sc ", cmd.buf, 3)) { | 143 } else if (!strncmp("sc ", cmd.buf, 3)) { |
144 struct timeval tv; | 144 struct timeval tv; |
145 tv.tv_sec = atoi(cmd.buf + 3); | 145 tv.tv_sec = atoi(cmd.buf + 3); |
146 tv.tv_usec = 0; | 146 tv.tv_usec = 0; |
147 settimeofday(&tv, NULL); | 147 settimeofday(&tv, NULL); |
148 } else if (!strncmp("lcd", cmd.buf, 3)) { | |
149 printf("LCD ID = %hx\r\n", LCD_RD_Reg(0x00)); | |
150 } else if (!strncmp("read", cmd.buf, 4)) { | 148 } else if (!strncmp("read", cmd.buf, 4)) { |
151 printf("PB5 = %d\r\n", GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_15)); | 149 printf("PB5 = %d\r\n", GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_15)); |
152 } else if (!strncmp("touch", cmd.buf, 5)) { | 150 } else if (!strncmp("touch", cmd.buf, 5)) { |
153 for (int i = 0; i < 10; i++) { | 151 for (int i = 0; i < 10; i++) { |
154 uint16_t x, y, z1, z2; | 152 uint16_t x, y, z1, z2; |
197 fputs(" ", stdout); | 195 fputs(" ", stdout); |
198 } | 196 } |
199 printf("(0x%02x)\r\n", status); | 197 printf("(0x%02x)\r\n", status); |
200 } else if (!strncmp("pwm ", cmd.buf, 4)) { | 198 } else if (!strncmp("pwm ", cmd.buf, 4)) { |
201 lcd_setpwm(atoi(cmd.buf + 4)); | 199 lcd_setpwm(atoi(cmd.buf + 4)); |
200 } else if (!strncmp("timing", cmd.buf, 6)) { | |
201 fputs("Timing..\r\n", stdout); | |
202 Delay(10000); | |
203 fputs("Done\r\n", stdout); | |
202 } else if (!strncmp("zz", cmd.buf, 2)) { | 204 } else if (!strncmp("zz", cmd.buf, 2)) { |
203 NVIC_SystemReset(); | 205 NVIC_SystemReset(); |
204 } else { | 206 } else { |
205 printf("Unknown command\r\n"); | 207 printf("Unknown command\r\n"); |
206 } | 208 } |