test public

Dependencies:   HttpServer_snapshot_mbed-os

Committer:
anhtran
Date:
Fri Oct 18 03:09:43 2019 +0000
Revision:
0:e9fd5575b10e
abc

Who changed what in which revision?

UserRevisionLine numberNew contents of line
anhtran 0:e9fd5575b10e 1 /* Copyright (c) 2017 dkato
anhtran 0:e9fd5575b10e 2 * SPDX-License-Identifier: Apache-2.0
anhtran 0:e9fd5575b10e 3 *
anhtran 0:e9fd5575b10e 4 * Licensed under the Apache License, Version 2.0 (the "License");
anhtran 0:e9fd5575b10e 5 * you may not use this file except in compliance with the License.
anhtran 0:e9fd5575b10e 6 * You may obtain a copy of the License at
anhtran 0:e9fd5575b10e 7 *
anhtran 0:e9fd5575b10e 8 * http://www.apache.org/licenses/LICENSE-2.0
anhtran 0:e9fd5575b10e 9 *
anhtran 0:e9fd5575b10e 10 * Unless required by applicable law or agreed to in writing, software
anhtran 0:e9fd5575b10e 11 * distributed under the License is distributed on an "AS IS" BASIS,
anhtran 0:e9fd5575b10e 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
anhtran 0:e9fd5575b10e 13 * See the License for the specific language governing permissions and
anhtran 0:e9fd5575b10e 14 * limitations under the License.
anhtran 0:e9fd5575b10e 15 */
anhtran 0:e9fd5575b10e 16 #include "mbed.h"
anhtran 0:e9fd5575b10e 17 #include "rtos.h"
anhtran 0:e9fd5575b10e 18 #include "EasyAttach_CameraAndLCD.h"
anhtran 0:e9fd5575b10e 19
anhtran 0:e9fd5575b10e 20 #if MBED_CONF_APP_LCD
anhtran 0:e9fd5575b10e 21 #if ((MBED_CONF_APP_LCD_TYPE & 0xFF00) == 0x0000) /* GR-PEACH LVDS */
anhtran 0:e9fd5575b10e 22 static DigitalOut lcd_cntrst(P8_15);
anhtran 0:e9fd5575b10e 23 #elif ((MBED_CONF_APP_LCD_TYPE & 0xFF00) == 0x1000) /* GR-LYCHEE */
anhtran 0:e9fd5575b10e 24 static PwmOut lcd_cntrst(P3_12);
anhtran 0:e9fd5575b10e 25 #elif (MBED_CONF_APP_LCD_TYPE == RZ_A2M_EVB_RSK_TFT) /* RZ/A2M */
anhtran 0:e9fd5575b10e 26 static PwmOut lcd_cntrst(P7_6);
anhtran 0:e9fd5575b10e 27 #endif
anhtran 0:e9fd5575b10e 28 #define MAX_BACKLIGHT_VOL (33.0f)
anhtran 0:e9fd5575b10e 29 #ifndef TYPICAL_BACKLIGHT_VOL
anhtran 0:e9fd5575b10e 30 #define TYPICAL_BACKLIGHT_VOL (33.0f)
anhtran 0:e9fd5575b10e 31 #endif
anhtran 0:e9fd5575b10e 32 static float voltage_adjust = (TYPICAL_BACKLIGHT_VOL / MAX_BACKLIGHT_VOL);
anhtran 0:e9fd5575b10e 33 #endif
anhtran 0:e9fd5575b10e 34
anhtran 0:e9fd5575b10e 35 static const DisplayBase::lcd_config_t * lcd_port_init(DisplayBase& Display) {
anhtran 0:e9fd5575b10e 36 #if MBED_CONF_APP_LCD
anhtran 0:e9fd5575b10e 37 #if ((MBED_CONF_APP_LCD_TYPE & 0xFF00) == 0x0000) /* GR-PEACH LVDS */
anhtran 0:e9fd5575b10e 38 PinName lvds_pin[8] = {
anhtran 0:e9fd5575b10e 39 /* data pin */
anhtran 0:e9fd5575b10e 40 P5_7, P5_6, P5_5, P5_4, P5_3, P5_2, P5_1, P5_0
anhtran 0:e9fd5575b10e 41 };
anhtran 0:e9fd5575b10e 42 Display.Graphics_Lvds_Port_Init(lvds_pin, 8);
anhtran 0:e9fd5575b10e 43
anhtran 0:e9fd5575b10e 44 DigitalOut lcd_pwon(P7_15);
anhtran 0:e9fd5575b10e 45 DigitalOut lcd_blon(P8_1);
anhtran 0:e9fd5575b10e 46 lcd_pwon = 0;
anhtran 0:e9fd5575b10e 47 lcd_blon = 0;
anhtran 0:e9fd5575b10e 48 ThisThread::sleep_for(100);
anhtran 0:e9fd5575b10e 49 lcd_pwon = 1;
anhtran 0:e9fd5575b10e 50 lcd_blon = 1;
anhtran 0:e9fd5575b10e 51 #elif ((MBED_CONF_APP_LCD_TYPE & 0xFF00) == 0x0100) /* GR-PEACH RGB */
anhtran 0:e9fd5575b10e 52 PinName lcd_pin[28] = {
anhtran 0:e9fd5575b10e 53 /* data pin */
anhtran 0:e9fd5575b10e 54 P11_15, P11_14, P11_13, P11_12, P5_7, P5_6, P5_5, P5_4, P5_3, P5_2, P5_1, P5_0,
anhtran 0:e9fd5575b10e 55 P4_7, P4_6, P4_5, P4_4, P10_12, P10_13, P10_14, P10_15, P3_15, P3_14, P3_13,
anhtran 0:e9fd5575b10e 56 P3_12, P3_11, P3_10, P3_9, P3_8
anhtran 0:e9fd5575b10e 57 };
anhtran 0:e9fd5575b10e 58 Display.Graphics_Lcd_Port_Init(lcd_pin, 28);
anhtran 0:e9fd5575b10e 59 #elif ((MBED_CONF_APP_LCD_TYPE & 0xFF00) == 0x1000) /* GR-LYCHEE */
anhtran 0:e9fd5575b10e 60 PinName lcd_pin[28] = {
anhtran 0:e9fd5575b10e 61 /* data pin */
anhtran 0:e9fd5575b10e 62 P6_15, P6_14, P6_13, P6_12, P6_11, P6_10, P6_9, P6_8, P6_7, P6_6, P6_5, P6_4,
anhtran 0:e9fd5575b10e 63 P6_3, P6_2, P6_1, P6_0, P3_7, P3_6, P3_5, P3_4, P3_3, P3_2, P3_1, P3_0, P5_2,
anhtran 0:e9fd5575b10e 64 P5_1, P5_0, P7_4,
anhtran 0:e9fd5575b10e 65 };
anhtran 0:e9fd5575b10e 66 Display.Graphics_Lcd_Port_Init(lcd_pin, 28);
anhtran 0:e9fd5575b10e 67
anhtran 0:e9fd5575b10e 68 DigitalOut lcd_pwon(P5_12);
anhtran 0:e9fd5575b10e 69 lcd_pwon = 0;
anhtran 0:e9fd5575b10e 70 lcd_cntrst.period_us(500);
anhtran 0:e9fd5575b10e 71 ThisThread::sleep_for(100);
anhtran 0:e9fd5575b10e 72 lcd_pwon = 1;
anhtran 0:e9fd5575b10e 73 #elif ((MBED_CONF_APP_LCD_TYPE & 0xFF00) == 0x2000) /* RZ/A2M LVDS */
anhtran 0:e9fd5575b10e 74 PinName lvds_pin[8] = {
anhtran 0:e9fd5575b10e 75 /* data pin */
anhtran 0:e9fd5575b10e 76 P4_0, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7
anhtran 0:e9fd5575b10e 77 };
anhtran 0:e9fd5575b10e 78 Display.Graphics_Lvds_Port_Init(lvds_pin, 8);
anhtran 0:e9fd5575b10e 79 #elif ((MBED_CONF_APP_LCD_TYPE & 0xFF00) == 0x2100) /* RZ/A2M RGB */
anhtran 0:e9fd5575b10e 80 PinName lcd_pin[28] = {
anhtran 0:e9fd5575b10e 81 /* data pin */
anhtran 0:e9fd5575b10e 82 PB_5, PB_4, PB_3, PB_2, PB_1, PB_0, PA_7, PA_6, PA_5, PA_4, PA_3, PA_2, PA_1, PA_0,
anhtran 0:e9fd5575b10e 83 P8_0, PF_0, PF_1, PF_2, PF_3, PF_4, PF_5, PF_6, PH_2, PF_7, PC_3, PC_4, P7_7, PJ_6
anhtran 0:e9fd5575b10e 84 };
anhtran 0:e9fd5575b10e 85 Display.Graphics_Lcd_Port_Init(lcd_pin, 28);
anhtran 0:e9fd5575b10e 86 #if MBED_CONF_APP_LCD_TYPE == RZ_A2M_DVI_STICK
anhtran 0:e9fd5575b10e 87 const char send_cmd[3] = {0x08u, 0xbfu, 0x70u};
anhtran 0:e9fd5575b10e 88 #if defined(TARGET_RZ_A2M_SBEV) || defined(TARGET_SEMB1402)
anhtran 0:e9fd5575b10e 89 I2C mI2c_(PD_5, PD_4);
anhtran 0:e9fd5575b10e 90 #else
anhtran 0:e9fd5575b10e 91 I2C mI2c_(I2C_SDA, I2C_SCL);
anhtran 0:e9fd5575b10e 92 #endif
anhtran 0:e9fd5575b10e 93 mI2c_.write(0x78, send_cmd, 3);
anhtran 0:e9fd5575b10e 94 #elif MBED_CONF_APP_LCD_TYPE == RZ_A2M_EVB_RSK_TFT
anhtran 0:e9fd5575b10e 95 lcd_cntrst.period_us(500);
anhtran 0:e9fd5575b10e 96 #endif
anhtran 0:e9fd5575b10e 97 #endif
anhtran 0:e9fd5575b10e 98 return &LcdCfgTbl_LCD_shield;
anhtran 0:e9fd5575b10e 99 #else
anhtran 0:e9fd5575b10e 100 return NULL;
anhtran 0:e9fd5575b10e 101 #endif
anhtran 0:e9fd5575b10e 102 }
anhtran 0:e9fd5575b10e 103
anhtran 0:e9fd5575b10e 104 static DisplayBase::graphics_error_t camera_init(DisplayBase& Display, uint16_t cap_width, uint16_t cap_height) {
anhtran 0:e9fd5575b10e 105 #if MBED_CONF_APP_CAMERA
anhtran 0:e9fd5575b10e 106 #if MBED_CONF_APP_CAMERA_TYPE == CAMERA_CVBS
anhtran 0:e9fd5575b10e 107 DisplayBase::graphics_error_t error;
anhtran 0:e9fd5575b10e 108 error = Display.Graphics_Video_init(DisplayBase::INPUT_SEL_VDEC, NULL);
anhtran 0:e9fd5575b10e 109 if( error != DisplayBase::GRAPHICS_OK ) {
anhtran 0:e9fd5575b10e 110 printf("Line %d, error %d\n", __LINE__, error);
anhtran 0:e9fd5575b10e 111 return error;
anhtran 0:e9fd5575b10e 112 }
anhtran 0:e9fd5575b10e 113
anhtran 0:e9fd5575b10e 114 return DisplayBase::GRAPHICS_OK;
anhtran 0:e9fd5575b10e 115 #else
anhtran 0:e9fd5575b10e 116 DisplayBase::graphics_error_t error;
anhtran 0:e9fd5575b10e 117 DisplayBase::video_input_sel_t video_input_sel;
anhtran 0:e9fd5575b10e 118
anhtran 0:e9fd5575b10e 119 #if CAMERA_MODULE == MODULE_MIPI
anhtran 0:e9fd5575b10e 120 // do nothing
anhtran 0:e9fd5575b10e 121 #elif defined(TARGET_RZ_A1H)
anhtran 0:e9fd5575b10e 122 PinName cmos_camera_pin[11] = {
anhtran 0:e9fd5575b10e 123 /* data pin */
anhtran 0:e9fd5575b10e 124 P2_7, P2_6, P2_5, P2_4, P2_3, P2_2, P2_1, P2_0,
anhtran 0:e9fd5575b10e 125 /* control pin */
anhtran 0:e9fd5575b10e 126 P10_0, /* DV0_CLK */
anhtran 0:e9fd5575b10e 127 P1_0, /* DV0_Vsync */
anhtran 0:e9fd5575b10e 128 P1_1 /* DV0_Hsync */
anhtran 0:e9fd5575b10e 129 };
anhtran 0:e9fd5575b10e 130 #if MBED_CONF_APP_SHIELD_TYPE == SHIELD_AUDIO_CAMERA
anhtran 0:e9fd5575b10e 131 DigitalOut pwdn(P3_12);
anhtran 0:e9fd5575b10e 132 pwdn = 0;
anhtran 0:e9fd5575b10e 133 ThisThread::sleep_for(1 + 1);
anhtran 0:e9fd5575b10e 134 #elif MBED_CONF_APP_SHIELD_TYPE == SHIELD_WIRELESS_CAMERA
anhtran 0:e9fd5575b10e 135 DigitalOut pwdn(P3_15);
anhtran 0:e9fd5575b10e 136 DigitalOut rstb(P3_14);
anhtran 0:e9fd5575b10e 137 pwdn = 0;
anhtran 0:e9fd5575b10e 138 rstb = 0;
anhtran 0:e9fd5575b10e 139 ThisThread::sleep_for(10 + 1);
anhtran 0:e9fd5575b10e 140 rstb = 1;
anhtran 0:e9fd5575b10e 141 ThisThread::sleep_for(1 + 1);
anhtran 0:e9fd5575b10e 142 #endif
anhtran 0:e9fd5575b10e 143 #elif defined(TARGET_GR_LYCHEE)
anhtran 0:e9fd5575b10e 144 PinName cmos_camera_pin[11] = {
anhtran 0:e9fd5575b10e 145 /* data pin */
anhtran 0:e9fd5575b10e 146 P1_0, P1_1, P1_2, P1_3, P1_8, P1_9, P1_10, P1_11,
anhtran 0:e9fd5575b10e 147 /* control pin */
anhtran 0:e9fd5575b10e 148 P7_8, /* DV0_CLK */
anhtran 0:e9fd5575b10e 149 P7_9, /* DV0_Vsync */
anhtran 0:e9fd5575b10e 150 P7_10 /* DV0_Hsync */
anhtran 0:e9fd5575b10e 151 };
anhtran 0:e9fd5575b10e 152 DigitalOut pwdn(P7_11);
anhtran 0:e9fd5575b10e 153 DigitalOut rstb(P2_3);
anhtran 0:e9fd5575b10e 154
anhtran 0:e9fd5575b10e 155 pwdn = 0;
anhtran 0:e9fd5575b10e 156 rstb = 0;
anhtran 0:e9fd5575b10e 157 ThisThread::sleep_for(10 + 1);
anhtran 0:e9fd5575b10e 158 rstb = 1;
anhtran 0:e9fd5575b10e 159 ThisThread::sleep_for(1 + 1);
anhtran 0:e9fd5575b10e 160 #elif defined(TARGET_RZ_A2M_EVB) || defined(TARGET_RZ_A2M_EVB_HF) || defined(TARGET_RZ_A2M_SBEV) || defined(TARGET_SEMB1402)
anhtran 0:e9fd5575b10e 161 PinName cmos_camera_pin[11] = {
anhtran 0:e9fd5575b10e 162 /* data pin */
anhtran 0:e9fd5575b10e 163 PE_1, PE_2, PE_3, PE_4, PE_5, PE_6, PH_0, PH_1,
anhtran 0:e9fd5575b10e 164 /* control pin */
anhtran 0:e9fd5575b10e 165 P6_1, /* VIO_CLK */
anhtran 0:e9fd5575b10e 166 P6_2, /* VIO_VD */
anhtran 0:e9fd5575b10e 167 P6_3 /* VIO_HD */
anhtran 0:e9fd5575b10e 168 };
anhtran 0:e9fd5575b10e 169 DigitalOut camera_stby(PE_0);
anhtran 0:e9fd5575b10e 170 camera_stby = 0;
anhtran 0:e9fd5575b10e 171 ThisThread::sleep_for(1 + 1);
anhtran 0:e9fd5575b10e 172 #endif
anhtran 0:e9fd5575b10e 173
anhtran 0:e9fd5575b10e 174 /* camera input port setting */
anhtran 0:e9fd5575b10e 175 #if CAMERA_MODULE == MODULE_VDC
anhtran 0:e9fd5575b10e 176 video_input_sel = DisplayBase::INPUT_SEL_EXT;
anhtran 0:e9fd5575b10e 177 error = Display.Graphics_Dvinput_Port_Init(cmos_camera_pin, 11);
anhtran 0:e9fd5575b10e 178 #elif CAMERA_MODULE == MODULE_CEU
anhtran 0:e9fd5575b10e 179 video_input_sel = DisplayBase::INPUT_SEL_CEU;
anhtran 0:e9fd5575b10e 180 error = Display.Graphics_Ceu_Port_Init(cmos_camera_pin, 11);
anhtran 0:e9fd5575b10e 181 #else
anhtran 0:e9fd5575b10e 182 video_input_sel = DisplayBase::INPUT_SEL_MIPI;
anhtran 0:e9fd5575b10e 183 error = DisplayBase::GRAPHICS_OK;
anhtran 0:e9fd5575b10e 184 #endif
anhtran 0:e9fd5575b10e 185 if( error != DisplayBase::GRAPHICS_OK) {
anhtran 0:e9fd5575b10e 186 printf("Line %d, error %d\n", __LINE__, error);
anhtran 0:e9fd5575b10e 187 return error;
anhtran 0:e9fd5575b10e 188 }
anhtran 0:e9fd5575b10e 189
anhtran 0:e9fd5575b10e 190 #if MBED_CONF_APP_CAMERA_TYPE == CAMERA_MT9V111
anhtran 0:e9fd5575b10e 191 MT9V111_config camera_cfg;
anhtran 0:e9fd5575b10e 192 #elif MBED_CONF_APP_CAMERA_TYPE == CAMERA_OV7725
anhtran 0:e9fd5575b10e 193 OV7725_config camera_cfg;
anhtran 0:e9fd5575b10e 194 #elif MBED_CONF_APP_CAMERA_TYPE == CAMERA_OV5642
anhtran 0:e9fd5575b10e 195 OV5642_config camera_cfg;
anhtran 0:e9fd5575b10e 196 #elif MBED_CONF_APP_CAMERA_TYPE == CAMERA_RASPBERRY_PI
anhtran 0:e9fd5575b10e 197 RaspberryPi_config camera_cfg;
anhtran 0:e9fd5575b10e 198 #else
anhtran 0:e9fd5575b10e 199 #error "No camera chosen. Please add 'config.camera-type.value' to your mbed_app.json (see README.md for more information)."
anhtran 0:e9fd5575b10e 200 #endif
anhtran 0:e9fd5575b10e 201
anhtran 0:e9fd5575b10e 202 #if CAMERA_MODULE == MODULE_MIPI
anhtran 0:e9fd5575b10e 203 DisplayBase::video_mipi_param_t mipi_config;
anhtran 0:e9fd5575b10e 204 DisplayBase::video_vin_setup_t vin_setup;
anhtran 0:e9fd5575b10e 205
anhtran 0:e9fd5575b10e 206 camera_cfg.Initialise();
anhtran 0:e9fd5575b10e 207 camera_cfg.SetMipiConfig(&mipi_config);
anhtran 0:e9fd5575b10e 208 camera_cfg.SetVinSetup(&vin_setup);
anhtran 0:e9fd5575b10e 209 error = Display.Graphics_Video_init(video_input_sel, &mipi_config, &vin_setup);
anhtran 0:e9fd5575b10e 210 #else
anhtran 0:e9fd5575b10e 211 DisplayBase::video_ext_in_config_t ext_in_config;
anhtran 0:e9fd5575b10e 212
anhtran 0:e9fd5575b10e 213 camera_cfg.Initialise();
anhtran 0:e9fd5575b10e 214 camera_cfg.SetExtInConfig(&ext_in_config);
anhtran 0:e9fd5575b10e 215 if (cap_width != 0) {
anhtran 0:e9fd5575b10e 216 ext_in_config.cap_width = cap_width; /* Capture width */
anhtran 0:e9fd5575b10e 217 }
anhtran 0:e9fd5575b10e 218 if (cap_height != 0) {
anhtran 0:e9fd5575b10e 219 ext_in_config.cap_height = cap_height; /* Capture heigh */
anhtran 0:e9fd5575b10e 220 }
anhtran 0:e9fd5575b10e 221
anhtran 0:e9fd5575b10e 222 error = Display.Graphics_Video_init(video_input_sel, &ext_in_config);
anhtran 0:e9fd5575b10e 223 #endif
anhtran 0:e9fd5575b10e 224 if( error != DisplayBase::GRAPHICS_OK ) {
anhtran 0:e9fd5575b10e 225 printf("Line %d, error %d\n", __LINE__, error);
anhtran 0:e9fd5575b10e 226 return error;
anhtran 0:e9fd5575b10e 227 }
anhtran 0:e9fd5575b10e 228
anhtran 0:e9fd5575b10e 229 return DisplayBase::GRAPHICS_OK;
anhtran 0:e9fd5575b10e 230 #endif
anhtran 0:e9fd5575b10e 231 #else
anhtran 0:e9fd5575b10e 232 return DisplayBase::GRAPHICS_OK;
anhtran 0:e9fd5575b10e 233 #endif
anhtran 0:e9fd5575b10e 234 }
anhtran 0:e9fd5575b10e 235
anhtran 0:e9fd5575b10e 236 DisplayBase::graphics_error_t EasyAttach_Init(DisplayBase& Display, uint16_t cap_width, uint16_t cap_height) {
anhtran 0:e9fd5575b10e 237 DisplayBase::graphics_error_t error;
anhtran 0:e9fd5575b10e 238 const DisplayBase::lcd_config_t * lcd_config = lcd_port_init(Display);
anhtran 0:e9fd5575b10e 239
anhtran 0:e9fd5575b10e 240 error = Display.Graphics_init(lcd_config);
anhtran 0:e9fd5575b10e 241 if (error != DisplayBase::GRAPHICS_OK) {
anhtran 0:e9fd5575b10e 242 printf("Line %d, error %d\n", __LINE__, error);
anhtran 0:e9fd5575b10e 243 return error;
anhtran 0:e9fd5575b10e 244 }
anhtran 0:e9fd5575b10e 245 return camera_init(Display, cap_width, cap_height);
anhtran 0:e9fd5575b10e 246 }
anhtran 0:e9fd5575b10e 247
anhtran 0:e9fd5575b10e 248 void EasyAttach_SetTypicalBacklightVol(float typ_vol) {
anhtran 0:e9fd5575b10e 249 #if MBED_CONF_APP_LCD
anhtran 0:e9fd5575b10e 250 if (typ_vol > MAX_BACKLIGHT_VOL) {
anhtran 0:e9fd5575b10e 251 voltage_adjust = 1.0f;
anhtran 0:e9fd5575b10e 252 } else {
anhtran 0:e9fd5575b10e 253 voltage_adjust = (typ_vol / MAX_BACKLIGHT_VOL);
anhtran 0:e9fd5575b10e 254 }
anhtran 0:e9fd5575b10e 255 #endif
anhtran 0:e9fd5575b10e 256 }
anhtran 0:e9fd5575b10e 257
anhtran 0:e9fd5575b10e 258 void EasyAttach_LcdBacklight(bool type) {
anhtran 0:e9fd5575b10e 259 #if MBED_CONF_APP_LCD
anhtran 0:e9fd5575b10e 260 if (type) {
anhtran 0:e9fd5575b10e 261 EasyAttach_LcdBacklight(1.0f);
anhtran 0:e9fd5575b10e 262 } else {
anhtran 0:e9fd5575b10e 263 EasyAttach_LcdBacklight(0.0f);
anhtran 0:e9fd5575b10e 264 }
anhtran 0:e9fd5575b10e 265 #endif
anhtran 0:e9fd5575b10e 266 }
anhtran 0:e9fd5575b10e 267
anhtran 0:e9fd5575b10e 268 void EasyAttach_LcdBacklight(float value) {
anhtran 0:e9fd5575b10e 269 #if MBED_CONF_APP_LCD
anhtran 0:e9fd5575b10e 270 #if ((MBED_CONF_APP_LCD_TYPE & 0xFF00) == 0x0000) || ((MBED_CONF_APP_LCD_TYPE & 0xFF00) == 0x1000) || (MBED_CONF_APP_LCD_TYPE == RZ_A2M_EVB_RSK_TFT)
anhtran 0:e9fd5575b10e 271 lcd_cntrst = (value * voltage_adjust);
anhtran 0:e9fd5575b10e 272 #endif
anhtran 0:e9fd5575b10e 273 #endif
anhtran 0:e9fd5575b10e 274 }
anhtran 0:e9fd5575b10e 275
anhtran 0:e9fd5575b10e 276 DisplayBase::graphics_error_t EasyAttach_CameraStart(DisplayBase& Display, DisplayBase::video_input_channel_t channel) {
anhtran 0:e9fd5575b10e 277 #if MBED_CONF_APP_CAMERA
anhtran 0:e9fd5575b10e 278 DisplayBase::graphics_error_t error;
anhtran 0:e9fd5575b10e 279
anhtran 0:e9fd5575b10e 280 /* Video write process start */
anhtran 0:e9fd5575b10e 281 error = Display.Video_Start(channel);
anhtran 0:e9fd5575b10e 282 if (error != DisplayBase::GRAPHICS_OK) {
anhtran 0:e9fd5575b10e 283 printf("Line %d, error %d\n", __LINE__, error);
anhtran 0:e9fd5575b10e 284 return error;
anhtran 0:e9fd5575b10e 285 }
anhtran 0:e9fd5575b10e 286
anhtran 0:e9fd5575b10e 287 #if CAMERA_MODULE == MODULE_VDC
anhtran 0:e9fd5575b10e 288 /* Video write process stop */
anhtran 0:e9fd5575b10e 289 error = Display.Video_Stop(channel);
anhtran 0:e9fd5575b10e 290 if (error != DisplayBase::GRAPHICS_OK) {
anhtran 0:e9fd5575b10e 291 printf("Line %d, error %d\n", __LINE__, error);
anhtran 0:e9fd5575b10e 292 return error;
anhtran 0:e9fd5575b10e 293 }
anhtran 0:e9fd5575b10e 294
anhtran 0:e9fd5575b10e 295 /* Video write process start */
anhtran 0:e9fd5575b10e 296 error = Display.Video_Start(channel);
anhtran 0:e9fd5575b10e 297 if (error != DisplayBase::GRAPHICS_OK) {
anhtran 0:e9fd5575b10e 298 printf("Line %d, error %d\n", __LINE__, error);
anhtran 0:e9fd5575b10e 299 return error;
anhtran 0:e9fd5575b10e 300 }
anhtran 0:e9fd5575b10e 301 #endif
anhtran 0:e9fd5575b10e 302 #endif
anhtran 0:e9fd5575b10e 303
anhtran 0:e9fd5575b10e 304 return DisplayBase::GRAPHICS_OK;
anhtran 0:e9fd5575b10e 305 }