16 #elif defined TARGET_HP34970_FP_F303RD |
16 #elif defined TARGET_HP34970_FP_F303RD |
17 #include "def_hp34970_fp.h" |
17 #include "def_hp34970_fp.h" |
18 #endif |
18 #endif |
19 |
19 |
20 #include "platform/CircularBuffer.h" |
20 #include "platform/CircularBuffer.h" |
21 |
21 #include <USBSerial.h> |
22 // cannot make it work... |
|
23 // #include <USBSerial.h> |
|
24 // USBSerial usbcdc(false); |
|
25 |
|
26 |
22 |
27 Display *dsp; |
23 Display *dsp; |
28 volatile bool splashscreen; |
24 volatile bool splashscreen; |
29 HPSerial *hp; |
25 HPSerial *hp; |
30 Thread tdsp(osPriorityNormal, OS_STACK_SIZE, nullptr, "DSP"); |
26 Thread tdsp(osPriorityNormal, OS_STACK_SIZE, nullptr, "DSP"); |
152 |
148 |
153 #if defined(HAVE_PC) |
149 #if defined(HAVE_PC) |
154 FileHandle *mbed::mbed_override_console(int fd) |
150 FileHandle *mbed::mbed_override_console(int fd) |
155 { |
151 { |
156 return static_cast<FileHandle*> (&pc); |
152 return static_cast<FileHandle*> (&pc); |
|
153 //return &pc; |
157 } |
154 } |
158 #endif |
155 #endif |
159 |
156 |
160 |
157 |
161 void setup() { |
158 void setup() { |
|
159 #if defined(HAVE_PC) |
|
160 pc.connect(); |
|
161 ThisThread::sleep_for(100ms); |
|
162 //pc.printf("SERIAL CONNECTION\r\n"); |
|
163 #endif |
|
164 |
162 printf("\n\nSETUP\n"); |
165 printf("\n\nSETUP\n"); |
163 printf(" System Core Clock = %ld MHZ\r\n", SystemCoreClock/1000000); |
166 printf(" System Core Clock = %ld MHZ\r\n", SystemCoreClock/1000000); |
164 |
167 |
|
168 printf("Create USBSerial\n"); |
165 hp = NULL; |
169 hp = NULL; |
166 #if defined(TARGET_NUCLEO_F446RE) |
170 |
167 printf("Serial communication pins\r\n"); |
|
168 printf(" USBRX=%d\r\n", USBRX); |
|
169 printf(" USBTX=%d\r\n", USBTX); |
|
170 #endif |
|
171 #if defined(TARGET_HP34970_FP_F303RD) |
|
172 printf("Serial communication via UART4\r\n"); |
171 printf("Serial communication via UART4\r\n"); |
173 #endif |
|
174 |
172 |
175 printf("Setup HP communication pins\r\n"); |
173 printf("Setup HP communication pins\r\n"); |
176 //printf(" HP_RX=%d\r\n", HP_RX); |
174 //printf(" HP_RX=%d\r\n", HP_RX); |
177 DigitalIn(HP_RX).mode(PullDown); |
175 DigitalIn(HP_RX).mode(PullDown); |
178 //printf(" HP_TX=%d\r\n", HP_TX); |
176 //printf(" HP_TX=%d\r\n", HP_TX); |
227 |
225 |
228 printf("Attach timers\r\n"); |
226 printf("Attach timers\r\n"); |
229 splashscreen = true; |
227 splashscreen = true; |
230 splashscreen_timer.attach(callback(&end_splashscreen), 5s); |
228 splashscreen_timer.attach(callback(&end_splashscreen), 5s); |
231 rst.fall(&reset_irq); |
229 rst.fall(&reset_irq); |
232 |
|
233 printf("SETUP DONE\r\n"); |
230 printf("SETUP DONE\r\n"); |
|
231 |
|
232 if (rst.read() == 0) |
|
233 reset(); |
234 } |
234 } |
235 |
235 |
236 void end_splashscreen(void) |
236 void end_splashscreen(void) |
237 { |
237 { |
238 splashscreen = false; |
238 splashscreen = false; |