Video image display and touch panel sample for GR-PEACH LCD Shield.
Information
Japanese version is available in lower part of this page.
このページの後半に日本語版が用意されています.
Information
This sample has multiple frame buffers so that the clock source can display different cameras and LCDs cleanly. If you are using the NTSC signal, the following sample is simpler.
このサンプルはクロック元が異なるカメラとLCDを綺麗に表示するために、複数のフレームバッファを持っています。NTSC信号を使用するのであれば、以下のサンプルの方が単純です。
https://developer.mbed.org/users/dkato/code/GR-PEACH_NTSC_in_2ch/
What is this ?
The basic function of the GR-PEACH LCD Shield can be tried by this sample.
Display the information of the touch panel on the camera image.
A character font is shown to the screen lower right every 1 second.
Touch panel information
The touch location of the blue and the 2nd point becomes pink in the 1st touch location in case of a multi-touch.
While touching the screen, a white square in the upper left corner of the screen will be displayed.
Touch information is being output in printf. When doing terminal designation, please set 230400 as a baud rate.
Composition
GR-PEACH, GR-PEACH 4.3 inch LCD Shield or GR-PEACH 7.1 inch LCD Shield, GR-PEACH AUDIO CAMERA Shield and Camera.
When using analog input for video input, GR-PEACH AUDIO CAMERA Shield and the camera are unnecessary.
(Setting the VIDEO_CVBS to VIDEO_INPUT_METHOD)
Please input analog signal to NTSC1A pin. (Even if there are no input signals, a touch panel can be operated.).
Video input of default is a digital input (Cmos Camera). When changing the video input, please change the below.
mbed_app.json
{ "config": { "camera":{ "help": "0:disable 1:enable", "value": "1" }, "camera-type":{ "help": "Please see README.md", "value": "CAMERA_CVBS" }, "lcd":{ "help": "0:disable 1:enable", "value": "1" }, "lcd-type":{ "help": "Please see README.md", "value": "GR_PEACH_4_3INCH_SHIELD" } } }
camera-type "value" | Description |
---|---|
CAMERA_CVBS | GR-PEACH NTSC signal |
CAMERA_MT9V111 | GR-PEACH MT9V111 |
CAMERA_OV7725 | GR-LYHCEE included camera |
CAMERA_OV5642 | GR-PEACH OV5642 |
CAMERA_WIRELESS_CAMERA | GR-PEACH Wireless/Camera shield (MT9V111) |
lcd-type "value" | Description |
---|---|
GR_PEACH_4_3INCH_SHIELD | GR-PEACH 4.3 inch LCD shield |
GR_PEACH_7_1INCH_SHIELD | GR-PEACH 7.1 inch LCD shield |
GR_PEACH_RSK_TFT | GR-PEACH RSK board LCD |
GR_PEACH_DISPLAY_SHIELD | GR-PEACH Display Shield or DVi-Board |
GR_LYCHEE_LCD | GR-LYHCEE TF043HV001A0..etc(40pin) |
概要
このサンプルではGR-PEACH LCD Shieldの基本的な機能を試せます。
カメラ画像の上にタッチパネルの情報を重ねて表示します。
文字フォントが右下に1秒毎に表示されます。
タッチパネルの情報
マルチタッチの場合は1点目のタッチ位置は青、2点目のタッチ位置はピンクになります。
画面がタッチされている間、画面左上に白い四角が表示されます。
printfでもタッチ情報を出力しています。ターミナル表示を行う際は、ボーレートに230400を設定してください。
構成
GR-PEACH、GR-PEACH 4.3 inch LCD Shield または GR-PEACH 7.1 inch LCD Shield、GR-PEACH AUDIO CAMERA Shield 、カメラ。
ビデオ入力にアナログ入力を使用する場合はGR-PEACH AUDIO CAMERA Shield とカメラは不要です。
(VIDEO_INPUT_METHOD にVIDEO_CVBS を設定)
NTSC1Aピンにアナログ信号を入力してください。(入力信号が無くてもタッチパネルは操作できます。)
デフォルトのビデオ入力はデジタル入力(Cmos Camera)です。ビデオ入力を変更する際は以下を変更してください。
mbed_app.json
{ "config": { "camera":{ "help": "0:disable 1:enable", "value": "1" }, "camera-type":{ "help": "Please see README.md", "value": "CAMERA_CVBS" }, "lcd":{ "help": "0:disable 1:enable", "value": "1" }, "lcd-type":{ "help": "Please see README.md", "value": "GR_PEACH_4_3INCH_SHIELD" } } }
camera-type "value" | Description |
---|---|
CAMERA_CVBS | GR-PEACH NTSC signal |
CAMERA_MT9V111 | GR-PEACH MT9V111 |
CAMERA_OV7725 | GR-LYHCEE included camera |
CAMERA_OV5642 | GR-PEACH OV5642 |
CAMERA_WIRELESS_CAMERA | GR-PEACH Wireless/Camera shield (MT9V111) |
lcd-type "value" | Description |
---|---|
GR_PEACH_4_3INCH_SHIELD | GR-PEACH 4.3 inch LCD shield |
GR_PEACH_7_1INCH_SHIELD | GR-PEACH 7.1 inch LCD shield |
GR_PEACH_RSK_TFT | GR-PEACH RSK board LCD |
GR_PEACH_DISPLAY_SHIELD | GR-PEACH Display Shield or DVi-Board |
GR_LYCHEE_LCD | GR-LYHCEE TF043HV001A0..etc(40pin) |
Diff: main.cpp
- Revision:
- 2:8721836b639d
- Parent:
- 1:54a3e69f6f09
- Child:
- 4:bafd63604b7c
diff -r 54a3e69f6f09 -r 8721836b639d main.cpp --- a/main.cpp Thu Jun 30 13:26:05 2016 +0000 +++ b/main.cpp Fri Nov 25 10:04:49 2016 +0000 @@ -94,10 +94,12 @@ /* 32 bytes aligned */ #pragma data_alignment=32 static uint8_t user_frame_buffer0[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]; +#pragma data_alignment=32 static uint8_t user_frame_buffer1[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]; +#pragma data_alignment=32 static uint8_t user_frame_buffer2[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]; +#pragma data_alignment=32 static uint8_t user_frame_buffer_touch[TOUCH_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]; -#pragma data_alignment=4 #else /* 32 bytes aligned */ static uint8_t user_frame_buffer0[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]__attribute((aligned(32))); @@ -106,7 +108,9 @@ static uint8_t user_frame_buffer_touch[TOUCH_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]__attribute((aligned(32))); #endif static uint8_t * FrameBufferTbl[FRAME_BUFFER_NUM] = {user_frame_buffer0, user_frame_buffer1, user_frame_buffer2}; +#if VIDEO_INPUT_METHOD == VIDEO_CVBS static volatile int32_t vfield_count = 0; +#endif static int write_buff_num = 0; static int read_buff_num = 0; static bool graphics_init_end = false; @@ -192,10 +196,14 @@ static void IntCallbackFunc_Vfield(DisplayBase::int_type_t int_type) { /* Interrupt callback function */ +#if VIDEO_INPUT_METHOD == VIDEO_CVBS if (vfield_count == 0) { vfield_count = 1; } else { vfield_count = 0; +#else + { +#endif if (p_VideoLcdTask != NULL) { p_VideoLcdTask->signal_set(1); } @@ -329,7 +337,7 @@ } /****** Video input is output to LCD ******/ -static void video_lcd_task(void const *) { +static void video_lcd_task(void) { DisplayBase::graphics_error_t error; int wk_num; int i; @@ -467,7 +475,7 @@ sem_touch_int.release(); } -static void touch_task(void const *) { +static void touch_task(void) { DisplayBase::rect_t rect; TouchKey::touch_pos_t touch_pos[TOUCH_NUM]; int touch_num = 0; @@ -537,10 +545,12 @@ Init_Video(); /* Start Video and Lcd processing */ - p_VideoLcdTask = new Thread(video_lcd_task, NULL, osPriorityAboveNormal, 1024 * 4); + p_VideoLcdTask = new Thread; + p_VideoLcdTask->start(video_lcd_task); /* Start touch panel processing */ - Thread touchTask(touch_task, NULL, osPriorityNormal, 1024 * 4); + Thread touchTask; + touchTask.start(touch_task); while (1) { led_blue = !led_blue;