Mar. 14. 2018

Dependencies:   GraphicsFramework GR-PEACH_video LCD_shield_config AsciiFont R_BSP USBHost_custom

Revision:
0:f5de229c9a00
Child:
5:49a61433290a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jan 23 06:22:08 2017 +0000
@@ -0,0 +1,71 @@
+#include "mbed.h"
+#include "DisplayBace.h"
+#include "rtos.h"
+#include "LCD_shield_config_4_3inch.h"
+#include "recognition_proc.h"
+#include "touch_proc.h"
+
+static DisplayBase Display;
+static DigitalOut  lcd_pwon(P7_15);
+static DigitalOut  lcd_blon(P8_1);
+static PwmOut      lcd_cntrst(P8_15);
+static Thread      recognitionTask;
+static Thread      touchTask;
+
+/****** LCD ******/
+static void IntCallbackFunc_LoVsync(DisplayBase::int_type_t int_type) {
+    /* Interrupt callback function for Vsync interruption */
+    touch_lcd_int(int_type);
+}
+
+static void Init_LCD_Display(void) {
+    DisplayBase::graphics_error_t error;
+    DisplayBase::lcd_config_t lcd_config;
+    PinName lvds_pin[8] = {
+        /* data pin */
+        P5_7, P5_6, P5_5, P5_4, P5_3, P5_2, P5_1, P5_0
+    };
+
+    lcd_pwon = 0;
+    lcd_blon = 0;
+    Thread::wait(100);
+    lcd_pwon = 1;
+    lcd_blon = 1;
+
+    Display.Graphics_Lvds_Port_Init(lvds_pin, 8);
+
+    /* Graphics initialization process */
+    lcd_config = LcdCfgTbl_LCD_shield;
+    error = Display.Graphics_init(&lcd_config);
+    if (error != DisplayBase::GRAPHICS_OK) {
+        printf("Line %d, error %d\n", __LINE__, error);
+        mbed_die();
+    }
+
+    /* Interrupt callback function setting (Vsync signal output from scaler 0) */
+    error = Display.Graphics_Irq_Handler_Set(DisplayBase::INT_TYPE_S0_LO_VSYNC, 0, IntCallbackFunc_LoVsync);
+    if (error != DisplayBase::GRAPHICS_OK) {
+        printf("Line %d, error %d\n", __LINE__, error);
+        mbed_die();
+    }
+}
+
+/****** main ******/
+int main(void) {
+    /* Initialization of LCD */
+    Init_LCD_Display();
+
+    /* Start recognition processing */
+    recognitionTask.start(callback(recognition_task, &Display));
+
+    /* Start touch panel processing */
+    touchTask.start(callback(touch_task, &Display));
+
+    /* Backlight on */
+    Thread::wait(200);
+    lcd_cntrst.write(1.0);
+
+    /* Wait for the threads to finish */
+    recognitionTask.join();
+    touchTask.join();
+}