test public

Dependencies:   HttpServer_snapshot_mbed-os

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers EasyAttach_CameraAndLCD.h Source File

EasyAttach_CameraAndLCD.h

00001 /* Copyright (c) 2017 dkato
00002  * SPDX-License-Identifier: Apache-2.0
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef EASY_ATTACH_CAMERA_AND_LCD_H
00017 #define EASY_ATTACH_CAMERA_AND_LCD_H
00018 
00019 #include "DisplayBace.h"
00020 
00021 // camera
00022 #if MBED_CONF_APP_CAMERA
00023   // camera-type
00024   #define CAMERA_CVBS                 0x0001
00025   #define CAMERA_MT9V111              0x0002
00026   #define CAMERA_OV7725               0x0003
00027   #define CAMERA_OV5642               0x0004
00028   #define CAMERA_WIRELESS_CAMERA      0x0083
00029   #define CAMERA_RASPBERRY_PI         0x2000
00030 
00031   // shield-type
00032   #define SHIELD_AUDIO_CAMERA         1
00033   #define SHIELD_WIRELESS_CAMERA      2
00034 
00035   // camera module
00036   #define MODULE_VDC                  0
00037   #define MODULE_CEU                  1
00038   #define MODULE_MIPI                 2
00039 
00040   #ifndef MBED_CONF_APP_SHIELD_TYPE
00041     #if defined(TARGET_RZ_A1H)
00042       #if (MBED_CONF_APP_CAMERA_TYPE == CAMERA_WIRELESS_CAMERA)
00043         #define MBED_CONF_APP_SHIELD_TYPE  SHIELD_WIRELESS_CAMERA
00044         #undef  MBED_CONF_APP_CAMERA_TYPE
00045         #define MBED_CONF_APP_CAMERA_TYPE  CAMERA_OV7725
00046       #else
00047         #define MBED_CONF_APP_SHIELD_TYPE  SHIELD_AUDIO_CAMERA
00048       #endif
00049     #endif
00050   #endif
00051 
00052   #ifndef MBED_CONF_APP_CAMERA_TYPE
00053     #if defined(TARGET_GR_LYCHEE)
00054       #define MBED_CONF_APP_CAMERA_TYPE    CAMERA_OV7725
00055     #elif defined(TARGET_RZ_A2M_EVB) || defined(TARGET_RZ_A2M_EVB_HF) || defined(TARGET_RZ_A2M_SBEV) || defined(TARGET_SEMB1402)
00056       #define MBED_CONF_APP_CAMERA_TYPE    CAMERA_RASPBERRY_PI
00057     #else
00058       #define MBED_CONF_APP_CAMERA_TYPE    CAMERA_MT9V111
00059     #endif
00060   #endif
00061 
00062   #if (MBED_CONF_APP_CAMERA_TYPE == CAMERA_CVBS) && defined(TARGET_GR_LYCHEE)
00063     #error "MBED_CONF_APP_CAMERA_TYPE is not supported in this target."
00064   #endif
00065 
00066   #if ((MBED_CONF_APP_CAMERA_TYPE & 0x2000) != 0)
00067     #define CAMERA_MODULE             MODULE_MIPI
00068   #elif defined(TARGET_RZ_A2M_EVB) || defined(TARGET_RZ_A2M_EVB_HF) || defined(TARGET_RZ_A2M_SBEV) || defined(TARGET_SEMB1402)
00069     #define CAMERA_MODULE             MODULE_CEU
00070   #else
00071     #define CAMERA_MODULE             MODULE_VDC
00072   #endif
00073 
00074   #if MBED_CONF_APP_CAMERA_TYPE == CAMERA_MT9V111
00075     #include "MT9V111_config.h"
00076   #elif MBED_CONF_APP_CAMERA_TYPE == CAMERA_OV7725
00077     #include "OV7725_config.h"
00078   #elif MBED_CONF_APP_CAMERA_TYPE == CAMERA_OV5642
00079     #include "OV5642_config.h"
00080   #elif MBED_CONF_APP_CAMERA_TYPE == CAMERA_RASPBERRY_PI
00081     #include "RaspberryPi_config.h"
00082   #endif
00083 #endif
00084 
00085 // lcd
00086 #if MBED_CONF_APP_LCD
00087   // lcd-type
00088   #define GR_PEACH_4_3INCH_SHIELD     0x0000
00089   #define GR_PEACH_7_1INCH_SHIELD     0x0001
00090   #define GR_PEACH_RSK_TFT            0x0002
00091   #define GR_PEACH_DISPLAY_SHIELD     0x0100
00092   #define GR_LYCHEE_TF043HV001A0      0x1000
00093   #define GR_LYCHEE_ATM0430D25        0x1001
00094   #define GR_LYCHEE_FG040346DSSWBG03  0x1002
00095   #define RZ_A2M_LVDS_TO_HDMI         0x2000
00096   #define RZ_A2M_EVB_RSK_TFT          0x2100
00097   #define RZ_A2M_DVI_STICK            0x2101
00098 
00099   #define GR_LYCHEE_LCD               GR_LYCHEE_TF043HV001A0
00100 
00101   #ifndef MBED_CONF_APP_LCD_TYPE
00102     #if defined(TARGET_RZ_A1H)
00103       #define MBED_CONF_APP_LCD_TYPE    GR_PEACH_4_3INCH_SHIELD
00104     #elif defined(TARGET_GR_LYCHEE)
00105       #define MBED_CONF_APP_LCD_TYPE    GR_LYCHEE_LCD
00106     #elif defined(TARGET_RZ_A2M_EVB) || defined(TARGET_RZ_A2M_EVB_HF)
00107       #define MBED_CONF_APP_LCD_TYPE    RZ_A2M_DVI_STICK
00108     #elif defined(TARGET_RZ_A2M_SBEV) || defined(TARGET_SEMB1402)
00109       #define MBED_CONF_APP_LCD_TYPE    RZ_A2M_LVDS_TO_HDMI
00110     #endif
00111   #endif
00112 
00113   #if defined(TARGET_RZ_A1H) && ((MBED_CONF_APP_LCD_TYPE & 0xF000) != 0x0000)
00114     #error "MBED_CONF_APP_LCD_TYPE is not supported in this target."
00115   #endif
00116   #if defined(TARGET_GR_LYCHEE) && ((MBED_CONF_APP_LCD_TYPE & 0xF000) != 0x1000)
00117     #error "MBED_CONF_APP_LCD_TYPE is not supported in this target."
00118   #endif
00119 
00120   #if MBED_CONF_APP_LCD_TYPE == GR_PEACH_4_3INCH_SHIELD
00121     #include "LCD_shield_config_4_3inch.h"
00122   #elif MBED_CONF_APP_LCD_TYPE == GR_PEACH_7_1INCH_SHIELD
00123     #include "LCD_shield_config_7_1inch.h"
00124   #elif MBED_CONF_APP_LCD_TYPE == GR_PEACH_RSK_TFT
00125     #include "LCD_shield_config_RSK_TFT.h"
00126   #elif MBED_CONF_APP_LCD_TYPE == GR_PEACH_DISPLAY_SHIELD
00127     #include "Display_shield_config.h"
00128   #elif MBED_CONF_APP_LCD_TYPE == GR_LYCHEE_TF043HV001A0
00129     #include "LCD_config_TF043HV001A0.h"
00130   #elif MBED_CONF_APP_LCD_TYPE == GR_LYCHEE_ATM0430D25
00131     #include "LCD_config_ATM0430D25.h"
00132   #elif MBED_CONF_APP_LCD_TYPE == GR_LYCHEE_FG040346DSSWBG03
00133     #include "LCD_config_FG040346DSSWBG03.h"
00134   #elif MBED_CONF_APP_LCD_TYPE == RZ_A2M_LVDS_TO_HDMI
00135     #include "LCD_config_lvds_to_hdmi.h"
00136   #elif MBED_CONF_APP_LCD_TYPE == RZ_A2M_EVB_RSK_TFT
00137     #include "LCD_config_RSK_TFT.h"
00138   #elif MBED_CONF_APP_LCD_TYPE == RZ_A2M_DVI_STICK
00139     #include "LCD_config_DVI_Stick.h"
00140   #else
00141     #error "No lcd chosen. Please add 'config.lcd-type.value' to your mbed_app.json (see README.md for more information)."
00142   #endif
00143 #endif
00144 
00145 extern DisplayBase::graphics_error_t EasyAttach_Init(
00146     DisplayBase& Display,
00147     uint16_t cap_width = 0,
00148     uint16_t cap_height = 0
00149 );
00150 
00151 extern DisplayBase::graphics_error_t EasyAttach_CameraStart(
00152     DisplayBase& Display,
00153     DisplayBase::video_input_channel_t channel = DisplayBase::VIDEO_INPUT_CHANNEL_0 
00154 );
00155 
00156 extern void EasyAttach_SetTypicalBacklightVol(float typ_vol);
00157 
00158 extern void EasyAttach_LcdBacklight(bool type = true);
00159 
00160 extern void EasyAttach_LcdBacklight(float value);
00161 
00162 #endif