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
- Application for Windows PC.
DisplayApp
- Development environment (Microsoft Visual Studio).
Development environment
For Mac
- Application for Mac.
DisplayApp
Serial setting
You need to connect your PC and MicroUSB Connector(RZ/A1 Ch.0).
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毎に設定方法が異なるため、検索サイトで「署名なしドライバ」で検索してください。
DisplayApp.h@5:6c04d9d15395, 2018-06-21 (annotated)
- Committer:
- dkato
- Date:
- Thu Jun 21 09:54:13 2018 +0000
- Revision:
- 5:6c04d9d15395
- Parent:
- 4:3c46efbe6d21
Supports mbed-os 5.9.1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dkato | 0:13c1f522bbef | 1 | /**************************************************************************//** |
dkato | 0:13c1f522bbef | 2 | * @file DisplayApp.h |
dkato | 0:13c1f522bbef | 3 | * @brief DisplayApp API |
dkato | 0:13c1f522bbef | 4 | ******************************************************************************/ |
dkato | 0:13c1f522bbef | 5 | |
dkato | 0:13c1f522bbef | 6 | #ifndef DISPLAY_APP_H |
dkato | 0:13c1f522bbef | 7 | #define DISPLAY_APP_H |
dkato | 0:13c1f522bbef | 8 | |
dkato | 0:13c1f522bbef | 9 | #include "mbed.h" |
dkato | 0:13c1f522bbef | 10 | #include "rtos.h" |
dkato | 0:13c1f522bbef | 11 | #include "USBSerial.h" |
dkato | 0:13c1f522bbef | 12 | |
dkato | 0:13c1f522bbef | 13 | /** A class to communicate a DisplayApp |
dkato | 0:13c1f522bbef | 14 | * |
dkato | 0:13c1f522bbef | 15 | */ |
dkato | 0:13c1f522bbef | 16 | class DisplayApp { |
dkato | 0:13c1f522bbef | 17 | public: |
dkato | 0:13c1f522bbef | 18 | /** Touch position structure */ |
dkato | 0:13c1f522bbef | 19 | typedef struct { |
dkato | 0:13c1f522bbef | 20 | uint32_t x; /**< The position of the x-coordinate. */ |
dkato | 0:13c1f522bbef | 21 | uint32_t y; /**< The position of the y-coordinate. */ |
dkato | 0:13c1f522bbef | 22 | bool valid; /**< Whether a valid data.. */ |
dkato | 0:13c1f522bbef | 23 | } touch_pos_t; |
dkato | 0:13c1f522bbef | 24 | |
dkato | 0:13c1f522bbef | 25 | /** Constructor: Initializes DisplayApp. |
dkato | 0:13c1f522bbef | 26 | * |
dkato | 2:b7ffe5216cd7 | 27 | * @param tsk_pri Priority of the thread function. (default: osPriorityNormal). |
dkato | 2:b7ffe5216cd7 | 28 | * @param init_pri Priority of before the USB is connected. (default: osPriorityLow). |
dkato | 5:6c04d9d15395 | 29 | * @param stack_size stack size (in bytes) requirements for the thread function. (default: 2048). |
dkato | 0:13c1f522bbef | 30 | */ |
dkato | 5:6c04d9d15395 | 31 | DisplayApp(osPriority tsk_pri = osPriorityNormal, uint32_t stack_size = 2048); |
dkato | 0:13c1f522bbef | 32 | |
dkato | 0:13c1f522bbef | 33 | /** Send RGB888 data |
dkato | 0:13c1f522bbef | 34 | * |
dkato | 0:13c1f522bbef | 35 | * @param buf data buffer address |
dkato | 0:13c1f522bbef | 36 | * @param pic_width picture width |
dkato | 0:13c1f522bbef | 37 | * @param pic_height picture height |
dkato | 0:13c1f522bbef | 38 | * @return send data size |
dkato | 0:13c1f522bbef | 39 | */ |
dkato | 0:13c1f522bbef | 40 | int SendRgb888(uint8_t * buf, uint32_t pic_width, uint32_t pic_height); |
dkato | 0:13c1f522bbef | 41 | |
dkato | 0:13c1f522bbef | 42 | /** Send JPEG data |
dkato | 0:13c1f522bbef | 43 | * |
dkato | 0:13c1f522bbef | 44 | * @param buf data buffer address |
dkato | 0:13c1f522bbef | 45 | * @param size data size |
dkato | 0:13c1f522bbef | 46 | * @return send data size |
dkato | 0:13c1f522bbef | 47 | */ |
dkato | 0:13c1f522bbef | 48 | int SendJpeg(uint8_t * buf, uint32_t size); |
dkato | 0:13c1f522bbef | 49 | |
dkato | 3:693902c86ca0 | 50 | /** Attach a function to call whenever a serial interrupt is generated |
dkato | 3:693902c86ca0 | 51 | * |
dkato | 3:693902c86ca0 | 52 | * @param func A pointer to a void function, or 0 to set as none |
dkato | 3:693902c86ca0 | 53 | */ |
dkato | 3:693902c86ca0 | 54 | void SetCallback(Callback<void()> func); |
dkato | 3:693902c86ca0 | 55 | |
dkato | 0:13c1f522bbef | 56 | /** Attach a function to call when touch panel int |
dkato | 0:13c1f522bbef | 57 | * |
dkato | 3:693902c86ca0 | 58 | * @param obj pointer to the object to call the member function on |
dkato | 3:693902c86ca0 | 59 | * @param method pointer to the member function to be called |
dkato | 0:13c1f522bbef | 60 | */ |
dkato | 3:693902c86ca0 | 61 | template<typename T> |
dkato | 3:693902c86ca0 | 62 | void SetCallback(T* obj, void (T::*method)()) { |
dkato | 3:693902c86ca0 | 63 | // Underlying call thread safe |
dkato | 3:693902c86ca0 | 64 | SetCallback(callback(obj, method)); |
dkato | 0:13c1f522bbef | 65 | } |
dkato | 3:693902c86ca0 | 66 | |
dkato | 0:13c1f522bbef | 67 | /** Attach a member function to call when touch panel int |
dkato | 0:13c1f522bbef | 68 | * |
dkato | 3:693902c86ca0 | 69 | * @param obj pointer to the object to call the member function on |
dkato | 3:693902c86ca0 | 70 | * @param method pointer to the member function to be called |
dkato | 0:13c1f522bbef | 71 | */ |
dkato | 0:13c1f522bbef | 72 | template<typename T> |
dkato | 3:693902c86ca0 | 73 | void SetCallback(T* obj, void (*method)(T*)) { |
dkato | 3:693902c86ca0 | 74 | // Underlying call thread safe |
dkato | 3:693902c86ca0 | 75 | SetCallback(callback(obj, method)); |
dkato | 0:13c1f522bbef | 76 | } |
dkato | 0:13c1f522bbef | 77 | /** Get the maximum number of simultaneous touches |
dkato | 0:13c1f522bbef | 78 | * |
dkato | 0:13c1f522bbef | 79 | * @return The maximum number of simultaneous touches. |
dkato | 0:13c1f522bbef | 80 | */ |
dkato | 0:13c1f522bbef | 81 | int GetMaxTouchNum(void); |
dkato | 0:13c1f522bbef | 82 | |
dkato | 0:13c1f522bbef | 83 | /** Get the coordinates |
dkato | 0:13c1f522bbef | 84 | * |
dkato | 0:13c1f522bbef | 85 | * @param touch_buff_num The number of structure p_touch. |
dkato | 0:13c1f522bbef | 86 | * @param p_touch Touch position information. |
dkato | 0:13c1f522bbef | 87 | * @return The number of touch points. |
dkato | 0:13c1f522bbef | 88 | */ |
dkato | 0:13c1f522bbef | 89 | int GetCoordinates(int touch_buff_num, touch_pos_t * p_touch); |
dkato | 0:13c1f522bbef | 90 | |
dkato | 0:13c1f522bbef | 91 | private: |
dkato | 0:13c1f522bbef | 92 | typedef enum { |
dkato | 0:13c1f522bbef | 93 | POS_SEQ_INIT, |
dkato | 0:13c1f522bbef | 94 | POS_SEQ_START, |
dkato | 0:13c1f522bbef | 95 | POS_SEQ_X, |
dkato | 0:13c1f522bbef | 96 | POS_SEQ_X_POS, |
dkato | 0:13c1f522bbef | 97 | POS_SEQ_X_M, |
dkato | 0:13c1f522bbef | 98 | POS_SEQ_C, |
dkato | 0:13c1f522bbef | 99 | POS_SEQ_Y, |
dkato | 0:13c1f522bbef | 100 | POS_SEQ_Y_POS, |
dkato | 0:13c1f522bbef | 101 | POS_SEQ_Y_M, |
dkato | 0:13c1f522bbef | 102 | POS_SEQ_END, |
dkato | 0:13c1f522bbef | 103 | } pos_seq_t; |
dkato | 0:13c1f522bbef | 104 | |
dkato | 4:3c46efbe6d21 | 105 | USBSerial PcApp; |
dkato | 0:13c1f522bbef | 106 | Thread displayThread; |
dkato | 0:13c1f522bbef | 107 | pos_seq_t pos_seq; |
dkato | 0:13c1f522bbef | 108 | int pos_x; |
dkato | 0:13c1f522bbef | 109 | int pos_y; |
dkato | 3:693902c86ca0 | 110 | Callback<void()> event; |
dkato | 0:13c1f522bbef | 111 | |
dkato | 0:13c1f522bbef | 112 | void touch_int_callback(void); |
dkato | 0:13c1f522bbef | 113 | void display_app_process(); |
dkato | 0:13c1f522bbef | 114 | void SendHeader(uint32_t size); |
dkato | 0:13c1f522bbef | 115 | void SendData(uint8_t * buf, uint32_t size); |
dkato | 0:13c1f522bbef | 116 | }; |
dkato | 0:13c1f522bbef | 117 | #endif |