DisplayAPP_Base
Dependents: GR-Boads_Camera_DisplayApp_base GR-Boads_Camera_DisplayApp_base DisplayApp LED01
Diff: DisplayApp.cpp
- Revision:
- 4:3c46efbe6d21
- Parent:
- 3:693902c86ca0
- Child:
- 6:3bb202b0ce01
diff -r 693902c86ca0 -r 3c46efbe6d21 DisplayApp.cpp --- a/DisplayApp.cpp Thu May 18 06:50:51 2017 +0000 +++ b/DisplayApp.cpp Tue Jun 13 12:16:47 2017 +0000 @@ -7,12 +7,13 @@ int pos_x_wk; int pos_wk; - pPcApp = new USBSerial; + while (!PcApp.configured()) { + Thread::wait(100); + } - displayThread.set_priority(change_pri); while (1) { - if (pPcApp->readable()) { - data = pPcApp->getc(); + if (PcApp.readable()) { + data = PcApp.getc(); if (data == '{') { pos_seq = POS_SEQ_START; } else if (data == 'X') { @@ -84,8 +85,8 @@ } } -DisplayApp::DisplayApp(osPriority tsk_pri, osPriority init_pri, uint32_t stack_size) : change_pri(tsk_pri), displayThread(init_pri, stack_size) { -// displayThread.start(this, &DisplayApp::display_app_process); +DisplayApp::DisplayApp(osPriority tsk_pri, uint32_t stack_size) : + PcApp(0x1f00, 0x2012, 0x0001, false), displayThread(tsk_pri, stack_size) { displayThread.start(callback(this, &DisplayApp::display_app_process)); } @@ -96,7 +97,7 @@ headder_data[9] = (uint8_t)((uint32_t)size >> 8); headder_data[10] = (uint8_t)((uint32_t)size >> 16); headder_data[11] = (uint8_t)((uint32_t)size >> 24); - pPcApp->writeBlock((uint8_t *)headder_data, sizeof(headder_data)); + PcApp.writeBlock((uint8_t *)headder_data, sizeof(headder_data)); } void DisplayApp::SendData(uint8_t * buf, uint32_t size) { @@ -109,7 +110,7 @@ } else { send_size = size; } - pPcApp->writeBlock(&buf[send_index], send_size); + PcApp.writeBlock(&buf[send_index], send_size); send_index += send_size; size -= send_size; } @@ -123,10 +124,10 @@ uint8_t wk_bitmap_buf[54]; int wk_idx = 0; - if (pPcApp == NULL) { + if (!PcApp.configured()) { return 0; } - if (pPcApp->_putc(0) == 0) { // terminal connect check + if (PcApp._putc(0) == 0) { // terminal connect check return 0; } SendHeader(total_size); @@ -190,7 +191,7 @@ wk_bitmap_buf[wk_idx++] = 0; /* biCirImportant */ wk_bitmap_buf[wk_idx++] = 0; /* biCirImportant */ wk_bitmap_buf[wk_idx++] = 0; /* biCirImportant */ - pPcApp->writeBlock(wk_bitmap_buf, wk_idx); + PcApp.writeBlock(wk_bitmap_buf, wk_idx); SendData(buf, pic_size); wk_idx += pic_size; @@ -203,10 +204,10 @@ } int DisplayApp::SendJpeg(uint8_t * buf, uint32_t size) { - if (pPcApp == NULL) { + if (!PcApp.configured()) { return 0; } - if (pPcApp->_putc(0) == 0) { // terminal connect check + if (PcApp._putc(0) == 0) { // terminal connect check return 0; } SendHeader(size);