Rev 3 | Rev 6 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3 | Rev 5 | ||
|---|---|---|---|
| Line 33... | Line 33... | ||
| 33 | #include "shell.h" |
33 | #include "shell.h" |
| 34 | #include "evtimer.h" |
34 | #include "evtimer.h" |
| 35 | #include "chprintf.h" |
35 | #include "chprintf.h" |
| 36 | 36 | ||
| 37 | 37 | ||
| - | 38 | #include "ap_math.h" |
|
| 38 | #include "hardware.h" |
39 | #include "hardware.h" |
| 39 | #include "spiInterface.h" |
40 | #include "spiInterface.h" |
| 40 | #include "SSD1306.h" |
41 | #include "SSD1306.h" |
| 41 | 42 | ||
| 42 | 43 | ||
| Line 110... | Line 111... | ||
| 110 | static msg_t Thread1(void *arg) { |
111 | static msg_t Thread1(void *arg) { |
| 111 | 112 | ||
| 112 | (void) arg; |
113 | (void) arg; |
| 113 | chRegSetThreadName("blinker"); |
114 | chRegSetThreadName("blinker"); |
| 114 | while (TRUE) { |
115 | while (TRUE) { |
| 115 | palTogglePad(GPIOC, GPIOC_LED); |
116 | palClearPad(GPIOA, GPIOA_STROBE); |
| - | 117 | chThdSleep(1); |
|
| - | 118 | palSetPad(GPIOA, GPIOA_STROBE); |
|
| 116 | chThdSleepMilliseconds(500); |
119 | chThdSleepMilliseconds(50); |
| 117 | } |
120 | } |
| 118 | return 0; |
121 | return 0; |
| 119 | } |
122 | } |
| 120 | 123 | ||
| 121 | /* |
124 | /* |
| Line 143... | Line 146... | ||
| 143 | /* |
146 | /* |
| 144 | * Shell manager initialization. |
147 | * Shell manager initialization. |
| 145 | */ |
148 | */ |
| 146 | shellInit(); |
149 | shellInit(); |
| 147 | 150 | ||
| - | 151 | ap_init(); |
|
| - | 152 | ||
| - | 153 | ||
| - | 154 | /* |
|
| - | 155 | * Creates the blinker thread. |
|
| - | 156 | */ |
|
| - | 157 | chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); |
|
| 148 | 158 | ||
| 149 | /* start the SPI hardware for display */ |
159 | /* start the SPI hardware for display */ |
| 150 | ssd1306spiInit(); |
160 | ssd1306spiInit(); |
| 151 | 161 | ||
| 152 | ssd1306_begin( SSD1306_SWITCHCAPVCC, 0) ; |
162 | ssd1306_begin( SSD1306_SWITCHCAPVCC, 0) ; |
| 153 | 163 | ||
| 154 | int x = 0; |
164 | int x = 0; |
| 155 | while(1) |
165 | while(1) |
| 156 | { |
166 | { |
| 157 | /* initialise the display */ |
167 | /* initialise the display */ |
| 158 | if(x==0) |
- | |
| 159 | clearDisplay(); |
168 | clearDisplay(); |
| 160 | 169 | ||
| 161 | dim(x); |
170 | dim(x); |
| - | 171 | font_gotoxy(0,0); |
|
| - | 172 | font_puts("count"); |
|
| - | 173 | font_sig_digits(12, 0,1,2, x); |
|
| 162 | 174 | ||
| - | 175 | print_digits(64, 32, 4,2, 10000-x); |
|
| 163 | 176 | ||
| 164 | font_puts("Hello !\r\nDisplay\r\n"); |
- | |
| 165 | - | ||
| 166 | drawLine(x, 0, x, 63 , 1); |
- | |
| 167 | x++; |
- | |
| 168 | if (x==128) |
- | |
| 169 | x=0; |
- | |
| 170 | 177 | ||
| 171 | 178 | ||
| 172 | display(); |
179 | display(); |
| - | 180 | // |
|
| - | 181 | // invertDisplay(x & 32); |
|
| 173 | 182 | ||
| 174 | invertDisplay(x & 32); |
183 | chThdSleep(MS2ST(10)); |
| 175 | 184 | ||
| 176 | chThdSleep(MS2ST(100)); |
185 | if (x++ == 10000) |
| - | 186 | x=0; |
|
| 177 | } |
187 | } |
| 178 | 188 | ||
| 179 | /* |
- | |
| 180 | * Creates the blinker thread. |
- | |
| 181 | */ |
- | |
| 182 | chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); |
- | |
| 183 | 189 | ||
| 184 | /* |
190 | /* |
| 185 | * Normal main() thread activity, in this demo it does nothing except |
191 | * Normal main() thread activity, in this demo it does nothing except |
| 186 | * sleeping in a loop and listen for events. |
192 | * sleeping in a loop and listen for events. |
| 187 | */ |
193 | */ |