DiplayApp library

Dependents:   mbed-os_Watson-IoT_ZXing_sample mbed-os_Watson-IoT_ZXing_sample GR-Boads_Camera_DisplayApp GR-Boads_Camera_DisplayApp ... more

For Windows PC

For Mac

Serial setting

You need to connect your PC and MicroUSB Connector(RZ/A1 Ch.0).

/media/uploads/dkato/usb0_and_button.jpg

Troubleshooting!

If your PC isn't Windows10, you need to install the specified driver from the below URL.
https://os.mbed.com/handbook/USBSerial

Unfortunately, since that is "Unsigned driver", you cannot install as is depending on your Windows version. Since the setting method is different for each PC, please search with "Unsigned driver" keyword on the search site.

トラブルシューティング!

Windows10以外ご使用の場合、ドライバのインストールが必要となります。下記サイトのからドライバーをダウンロードできます。
https://os.mbed.com/handbook/USBSerial

但し、「署名なしドライバ」となっていますので、お使いのWindowsバージョンによってはそのままインストールすることはできません。お使いのPC毎に設定方法が異なるため、検索サイトで「署名なしドライバ」で検索してください。

Files at this revision

API Documentation at this revision

Comitter:
dkato
Date:
Tue Jun 13 12:16:47 2017 +0000
Parent:
3:693902c86ca0
Child:
5:6c04d9d15395
Commit message:
Bug fix.

Changed in this revision

DisplayApp.cpp Show annotated file Show diff for this revision Revisions of this file
DisplayApp.h Show annotated file Show diff for this revision Revisions of this file
--- 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);
--- a/DisplayApp.h	Thu May 18 06:50:51 2017 +0000
+++ b/DisplayApp.h	Tue Jun 13 12:16:47 2017 +0000
@@ -28,7 +28,7 @@
      * @param   init_pri       Priority of before the USB is connected. (default: osPriorityLow).
      * @param   stack_size     stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
      */
-    DisplayApp(osPriority tsk_pri = osPriorityNormal, osPriority init_pri = osPriorityLow, uint32_t stack_size = DEFAULT_STACK_SIZE);
+    DisplayApp(osPriority tsk_pri = osPriorityNormal, uint32_t stack_size = DEFAULT_STACK_SIZE);
 
     /** Send RGB888 data
      *
@@ -102,9 +102,8 @@
         POS_SEQ_END,
     } pos_seq_t;
 
-    osPriority change_pri;
+    USBSerial PcApp;
     Thread displayThread;
-    USBSerial * pPcApp;
     pos_seq_t pos_seq;
     int pos_x;
     int pos_y;