GR-MANGO sample using mbed-os library from my repository.

Dependencies:   mbed-http

Committer:
RyoheiHagimoto
Date:
Mon Oct 12 02:25:49 2020 +0000
Revision:
0:b4c1e32627f2
replaced mbed-os library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RyoheiHagimoto 0:b4c1e32627f2 1 /*******************************************************************************
RyoheiHagimoto 0:b4c1e32627f2 2 * DISCLAIMER
RyoheiHagimoto 0:b4c1e32627f2 3 * This software is supplied by Renesas Electronics Corporation and is only
RyoheiHagimoto 0:b4c1e32627f2 4 * intended for use with Renesas products. No other uses are authorized. This
RyoheiHagimoto 0:b4c1e32627f2 5 * software is owned by Renesas Electronics Corporation and is protected under
RyoheiHagimoto 0:b4c1e32627f2 6 * all applicable laws, including copyright laws.
RyoheiHagimoto 0:b4c1e32627f2 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
RyoheiHagimoto 0:b4c1e32627f2 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
RyoheiHagimoto 0:b4c1e32627f2 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
RyoheiHagimoto 0:b4c1e32627f2 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
RyoheiHagimoto 0:b4c1e32627f2 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
RyoheiHagimoto 0:b4c1e32627f2 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
RyoheiHagimoto 0:b4c1e32627f2 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
RyoheiHagimoto 0:b4c1e32627f2 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
RyoheiHagimoto 0:b4c1e32627f2 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
RyoheiHagimoto 0:b4c1e32627f2 16 * Renesas reserves the right, without notice, to make changes to this software
RyoheiHagimoto 0:b4c1e32627f2 17 * and to discontinue the availability of this software. By using this software,
RyoheiHagimoto 0:b4c1e32627f2 18 * you agree to the additional terms and conditions found by accessing the
RyoheiHagimoto 0:b4c1e32627f2 19 * following link:
RyoheiHagimoto 0:b4c1e32627f2 20 * http://www.renesas.com/disclaimer
RyoheiHagimoto 0:b4c1e32627f2 21 *
RyoheiHagimoto 0:b4c1e32627f2 22 * Copyright (C) 2019 Renesas Electronics Corporation. All rights reserved.
RyoheiHagimoto 0:b4c1e32627f2 23 *******************************************************************************/
RyoheiHagimoto 0:b4c1e32627f2 24 #include "sample_select.h"
RyoheiHagimoto 0:b4c1e32627f2 25
RyoheiHagimoto 0:b4c1e32627f2 26 #if (SAMPLE_PROGRAM_NO == 18)
RyoheiHagimoto 0:b4c1e32627f2 27 // SAMPLE_PROGRAM_NO 18 : MIPI, DRP and LCD sample
RyoheiHagimoto 0:b4c1e32627f2 28 // If you want to know more about SimpleIsp, please refer to: https://github.com/d-kato/RZ_A2M_WebCamera_MIPI
RyoheiHagimoto 0:b4c1e32627f2 29 //
RyoheiHagimoto 0:b4c1e32627f2 30 // Converts the input image from MIPI camera to YUV image using DRP and outputs to display.
RyoheiHagimoto 0:b4c1e32627f2 31 // Please refer to the document for details. (RZ_A2M_Mbed\drp-for-mbed\r_drp\doc),
RyoheiHagimoto 0:b4c1e32627f2 32 //
RyoheiHagimoto 0:b4c1e32627f2 33 // Please set the value of "camera-type" in "mbed_app.json" to null or "CAMERA_RASPBERRY_PI".
RyoheiHagimoto 0:b4c1e32627f2 34 //
RyoheiHagimoto 0:b4c1e32627f2 35 // "camera-type":{
RyoheiHagimoto 0:b4c1e32627f2 36 // "help": "Please see EasyAttach_CameraAndLCD/README.md",
RyoheiHagimoto 0:b4c1e32627f2 37 // "value": null
RyoheiHagimoto 0:b4c1e32627f2 38 // },
RyoheiHagimoto 0:b4c1e32627f2 39 //
RyoheiHagimoto 0:b4c1e32627f2 40 // or
RyoheiHagimoto 0:b4c1e32627f2 41 //
RyoheiHagimoto 0:b4c1e32627f2 42 // "camera-type":{
RyoheiHagimoto 0:b4c1e32627f2 43 // "help": "Please see EasyAttach_CameraAndLCD/README.md",
RyoheiHagimoto 0:b4c1e32627f2 44 // "value": "CAMERA_RASPBERRY_PI"
RyoheiHagimoto 0:b4c1e32627f2 45 // },
RyoheiHagimoto 0:b4c1e32627f2 46 //
RyoheiHagimoto 0:b4c1e32627f2 47 // Requirements
RyoheiHagimoto 0:b4c1e32627f2 48 // RZ/A2M Evaluation Board Kit : Display Output Board
RyoheiHagimoto 0:b4c1e32627f2 49 // SBEV-RZ/A2M : LVDS To HDMI Board
RyoheiHagimoto 0:b4c1e32627f2 50 // SEMB1402 : LVDS To HDMI Board
RyoheiHagimoto 0:b4c1e32627f2 51
RyoheiHagimoto 0:b4c1e32627f2 52 #if !defined(TARGET_RZ_A2XX)
RyoheiHagimoto 0:b4c1e32627f2 53 #error "DRP and MIPI are not supported."
RyoheiHagimoto 0:b4c1e32627f2 54 #endif
RyoheiHagimoto 0:b4c1e32627f2 55 #if MBED_CONF_APP_CAMERA_TYPE != CAMERA_RASPBERRY_PI
RyoheiHagimoto 0:b4c1e32627f2 56 #error Please set the value of "camera-type" in "mbed_app.json" to "CAMERA_RASPBERRY_PI" and build.
RyoheiHagimoto 0:b4c1e32627f2 57 #endif
RyoheiHagimoto 0:b4c1e32627f2 58
RyoheiHagimoto 0:b4c1e32627f2 59 #include "mbed.h"
RyoheiHagimoto 0:b4c1e32627f2 60 #include "EasyAttach_CameraAndLCD.h"
RyoheiHagimoto 0:b4c1e32627f2 61 #include "AsciiFont.h"
RyoheiHagimoto 0:b4c1e32627f2 62 #include "r_dk2_if.h"
RyoheiHagimoto 0:b4c1e32627f2 63 #include "r_drp_simple_isp.h"
RyoheiHagimoto 0:b4c1e32627f2 64
RyoheiHagimoto 0:b4c1e32627f2 65 /*! Frame buffer stride: Frame buffer stride should be set to a multiple of 32 or 128
RyoheiHagimoto 0:b4c1e32627f2 66 in accordance with the frame buffer burst transfer mode. */
RyoheiHagimoto 0:b4c1e32627f2 67 #define VIDEO_PIXEL_HW LCD_PIXEL_WIDTH
RyoheiHagimoto 0:b4c1e32627f2 68 #define VIDEO_PIXEL_VW LCD_PIXEL_HEIGHT
RyoheiHagimoto 0:b4c1e32627f2 69
RyoheiHagimoto 0:b4c1e32627f2 70 #define FRAME_BUFFER_STRIDE (((VIDEO_PIXEL_HW * 1) + 31u) & ~31u)
RyoheiHagimoto 0:b4c1e32627f2 71 #define FRAME_BUFFER_STRIDE_2 (((VIDEO_PIXEL_HW * 2) + 31u) & ~31u)
RyoheiHagimoto 0:b4c1e32627f2 72 #define FRAME_BUFFER_HEIGHT (VIDEO_PIXEL_VW)
RyoheiHagimoto 0:b4c1e32627f2 73
RyoheiHagimoto 0:b4c1e32627f2 74 #define OVL_WIDTH (AsciiFont::CHAR_PIX_WIDTH * 2 * 11)
RyoheiHagimoto 0:b4c1e32627f2 75 #define OVL_STRIDE (((OVL_WIDTH * 1) + 31u) & ~31u)
RyoheiHagimoto 0:b4c1e32627f2 76 #define OVL_HEIGHT (AsciiFont::CHAR_PIX_HEIGHT * 2)
RyoheiHagimoto 0:b4c1e32627f2 77
RyoheiHagimoto 0:b4c1e32627f2 78 #define DRP_FLG_CAMER_IN (0x00000100)
RyoheiHagimoto 0:b4c1e32627f2 79
RyoheiHagimoto 0:b4c1e32627f2 80 #define WB_DAYLIGHT (0)
RyoheiHagimoto 0:b4c1e32627f2 81 #define WB_CLOUDY (1)
RyoheiHagimoto 0:b4c1e32627f2 82 #define WB_FLUORESCENT (2)
RyoheiHagimoto 0:b4c1e32627f2 83 #define WB_TUNGSTEN (3)
RyoheiHagimoto 0:b4c1e32627f2 84
RyoheiHagimoto 0:b4c1e32627f2 85 static DisplayBase Display;
RyoheiHagimoto 0:b4c1e32627f2 86 static uint8_t fbuf_bayer[FRAME_BUFFER_STRIDE * FRAME_BUFFER_HEIGHT]__attribute((aligned(128)));
RyoheiHagimoto 0:b4c1e32627f2 87 static uint8_t fbuf_yuv[FRAME_BUFFER_STRIDE_2 * FRAME_BUFFER_HEIGHT]__attribute((aligned(32)));
RyoheiHagimoto 0:b4c1e32627f2 88 static uint8_t fbuf_overlay[OVL_STRIDE * OVL_HEIGHT]__attribute((section("NC_BSS"),aligned(32)));
RyoheiHagimoto 0:b4c1e32627f2 89
RyoheiHagimoto 0:b4c1e32627f2 90 static r_drp_simple_isp_t param_isp __attribute((section("NC_BSS")));
RyoheiHagimoto 0:b4c1e32627f2 91 static uint8_t drp_lib_id[R_DK2_TILE_NUM] = {0};
RyoheiHagimoto 0:b4c1e32627f2 92 static Thread drpTask(osPriorityHigh);
RyoheiHagimoto 0:b4c1e32627f2 93 static uint32_t isp_wb_mode_req;
RyoheiHagimoto 0:b4c1e32627f2 94 static uint32_t isp_wb_mode;
RyoheiHagimoto 0:b4c1e32627f2 95
RyoheiHagimoto 0:b4c1e32627f2 96 static const uint32_t clut_data_resut[] = {0x00000000, 0xff00ff00}; // ARGB8888
RyoheiHagimoto 0:b4c1e32627f2 97
RyoheiHagimoto 0:b4c1e32627f2 98 static void IntCallbackFunc_Vfield(DisplayBase::int_type_t int_type) {
RyoheiHagimoto 0:b4c1e32627f2 99 drpTask.flags_set(DRP_FLG_CAMER_IN);
RyoheiHagimoto 0:b4c1e32627f2 100 }
RyoheiHagimoto 0:b4c1e32627f2 101
RyoheiHagimoto 0:b4c1e32627f2 102 static void cb_drp_finish(uint8_t id) {
RyoheiHagimoto 0:b4c1e32627f2 103 // do nothing
RyoheiHagimoto 0:b4c1e32627f2 104 }
RyoheiHagimoto 0:b4c1e32627f2 105
RyoheiHagimoto 0:b4c1e32627f2 106 static void Start_Video_Camera(void) {
RyoheiHagimoto 0:b4c1e32627f2 107 // Video capture setting (progressive form fixed)
RyoheiHagimoto 0:b4c1e32627f2 108 Display.Video_Write_Setting(
RyoheiHagimoto 0:b4c1e32627f2 109 DisplayBase::VIDEO_INPUT_CHANNEL_0,
RyoheiHagimoto 0:b4c1e32627f2 110 DisplayBase::COL_SYS_NTSC_358,
RyoheiHagimoto 0:b4c1e32627f2 111 (void *)fbuf_bayer,
RyoheiHagimoto 0:b4c1e32627f2 112 FRAME_BUFFER_STRIDE,
RyoheiHagimoto 0:b4c1e32627f2 113 DisplayBase::VIDEO_FORMAT_RAW8,
RyoheiHagimoto 0:b4c1e32627f2 114 DisplayBase::WR_RD_WRSWA_NON,
RyoheiHagimoto 0:b4c1e32627f2 115 VIDEO_PIXEL_VW,
RyoheiHagimoto 0:b4c1e32627f2 116 VIDEO_PIXEL_HW
RyoheiHagimoto 0:b4c1e32627f2 117 );
RyoheiHagimoto 0:b4c1e32627f2 118 EasyAttach_CameraStart(Display, DisplayBase::VIDEO_INPUT_CHANNEL_0);
RyoheiHagimoto 0:b4c1e32627f2 119 }
RyoheiHagimoto 0:b4c1e32627f2 120
RyoheiHagimoto 0:b4c1e32627f2 121 static void Start_LCD_Display(void) {
RyoheiHagimoto 0:b4c1e32627f2 122 DisplayBase::rect_t rect;
RyoheiHagimoto 0:b4c1e32627f2 123 DisplayBase::clut_t clut_param;
RyoheiHagimoto 0:b4c1e32627f2 124
RyoheiHagimoto 0:b4c1e32627f2 125 rect.vs = 0;
RyoheiHagimoto 0:b4c1e32627f2 126 rect.vw = VIDEO_PIXEL_VW;
RyoheiHagimoto 0:b4c1e32627f2 127 rect.hs = 0;
RyoheiHagimoto 0:b4c1e32627f2 128 rect.hw = VIDEO_PIXEL_HW;
RyoheiHagimoto 0:b4c1e32627f2 129 Display.Graphics_Read_Setting(
RyoheiHagimoto 0:b4c1e32627f2 130 DisplayBase::GRAPHICS_LAYER_0,
RyoheiHagimoto 0:b4c1e32627f2 131 (void *)fbuf_yuv,
RyoheiHagimoto 0:b4c1e32627f2 132 FRAME_BUFFER_STRIDE_2,
RyoheiHagimoto 0:b4c1e32627f2 133 DisplayBase::GRAPHICS_FORMAT_YCBCR422,
RyoheiHagimoto 0:b4c1e32627f2 134 DisplayBase::WR_RD_WRSWA_32_16_8BIT,
RyoheiHagimoto 0:b4c1e32627f2 135 &rect
RyoheiHagimoto 0:b4c1e32627f2 136 );
RyoheiHagimoto 0:b4c1e32627f2 137 Display.Graphics_Start(DisplayBase::GRAPHICS_LAYER_0);
RyoheiHagimoto 0:b4c1e32627f2 138
RyoheiHagimoto 0:b4c1e32627f2 139 memset(fbuf_overlay, 0, sizeof(fbuf_overlay));
RyoheiHagimoto 0:b4c1e32627f2 140 clut_param.color_num = sizeof(clut_data_resut) / sizeof(uint32_t);
RyoheiHagimoto 0:b4c1e32627f2 141 clut_param.clut = clut_data_resut;
RyoheiHagimoto 0:b4c1e32627f2 142
RyoheiHagimoto 0:b4c1e32627f2 143 rect.vs = 5;
RyoheiHagimoto 0:b4c1e32627f2 144 rect.vw = OVL_HEIGHT;
RyoheiHagimoto 0:b4c1e32627f2 145 rect.hs = 5;
RyoheiHagimoto 0:b4c1e32627f2 146 rect.hw = OVL_WIDTH;
RyoheiHagimoto 0:b4c1e32627f2 147 Display.Graphics_Read_Setting(
RyoheiHagimoto 0:b4c1e32627f2 148 DisplayBase::GRAPHICS_LAYER_2,
RyoheiHagimoto 0:b4c1e32627f2 149 (void *)fbuf_overlay,
RyoheiHagimoto 0:b4c1e32627f2 150 OVL_STRIDE,
RyoheiHagimoto 0:b4c1e32627f2 151 DisplayBase::GRAPHICS_FORMAT_CLUT8,
RyoheiHagimoto 0:b4c1e32627f2 152 DisplayBase::WR_RD_WRSWA_32_16_8BIT,
RyoheiHagimoto 0:b4c1e32627f2 153 &rect,
RyoheiHagimoto 0:b4c1e32627f2 154 &clut_param
RyoheiHagimoto 0:b4c1e32627f2 155 );
RyoheiHagimoto 0:b4c1e32627f2 156 Display.Graphics_Start(DisplayBase::GRAPHICS_LAYER_2);
RyoheiHagimoto 0:b4c1e32627f2 157
RyoheiHagimoto 0:b4c1e32627f2 158 ThisThread::sleep_for(50);
RyoheiHagimoto 0:b4c1e32627f2 159 EasyAttach_LcdBacklight(true);
RyoheiHagimoto 0:b4c1e32627f2 160 }
RyoheiHagimoto 0:b4c1e32627f2 161
RyoheiHagimoto 0:b4c1e32627f2 162 static void button_fall(void) {
RyoheiHagimoto 0:b4c1e32627f2 163 if (isp_wb_mode_req < WB_TUNGSTEN) {
RyoheiHagimoto 0:b4c1e32627f2 164 isp_wb_mode_req++;
RyoheiHagimoto 0:b4c1e32627f2 165 } else {
RyoheiHagimoto 0:b4c1e32627f2 166 isp_wb_mode_req = WB_DAYLIGHT;
RyoheiHagimoto 0:b4c1e32627f2 167 }
RyoheiHagimoto 0:b4c1e32627f2 168 }
RyoheiHagimoto 0:b4c1e32627f2 169
RyoheiHagimoto 0:b4c1e32627f2 170 static void drp_task(void) {
RyoheiHagimoto 0:b4c1e32627f2 171 AsciiFont ascii_font(fbuf_overlay, OVL_WIDTH, OVL_HEIGHT, OVL_STRIDE, 1);
RyoheiHagimoto 0:b4c1e32627f2 172 char str[64];
RyoheiHagimoto 0:b4c1e32627f2 173
RyoheiHagimoto 0:b4c1e32627f2 174 EasyAttach_Init(Display);
RyoheiHagimoto 0:b4c1e32627f2 175 Start_LCD_Display();
RyoheiHagimoto 0:b4c1e32627f2 176 // Interrupt callback function setting (Field end signal for recording function in scaler 0)
RyoheiHagimoto 0:b4c1e32627f2 177 Display.Graphics_Irq_Handler_Set(DisplayBase::INT_TYPE_S0_VFIELD, 0, IntCallbackFunc_Vfield);
RyoheiHagimoto 0:b4c1e32627f2 178 Start_Video_Camera();
RyoheiHagimoto 0:b4c1e32627f2 179
RyoheiHagimoto 0:b4c1e32627f2 180 R_DK2_Initialize();
RyoheiHagimoto 0:b4c1e32627f2 181
RyoheiHagimoto 0:b4c1e32627f2 182 /* Load DRP Library */
RyoheiHagimoto 0:b4c1e32627f2 183 /* +-----------------------+ */
RyoheiHagimoto 0:b4c1e32627f2 184 /* tile 0 | | */
RyoheiHagimoto 0:b4c1e32627f2 185 /* + + */
RyoheiHagimoto 0:b4c1e32627f2 186 /* tile 1 | | */
RyoheiHagimoto 0:b4c1e32627f2 187 /* + + */
RyoheiHagimoto 0:b4c1e32627f2 188 /* tile 2 | | */
RyoheiHagimoto 0:b4c1e32627f2 189 /* + SimpleIsp bayer2yuv_6 + */
RyoheiHagimoto 0:b4c1e32627f2 190 /* tile 3 | | */
RyoheiHagimoto 0:b4c1e32627f2 191 /* + + */
RyoheiHagimoto 0:b4c1e32627f2 192 /* tile 4 | | */
RyoheiHagimoto 0:b4c1e32627f2 193 /* + + */
RyoheiHagimoto 0:b4c1e32627f2 194 /* tile 5 | | */
RyoheiHagimoto 0:b4c1e32627f2 195 /* +-----------------------+ */
RyoheiHagimoto 0:b4c1e32627f2 196 R_DK2_Load(g_drp_lib_simple_isp_bayer2yuv_6,
RyoheiHagimoto 0:b4c1e32627f2 197 R_DK2_TILE_0,
RyoheiHagimoto 0:b4c1e32627f2 198 R_DK2_TILE_PATTERN_6, NULL, &cb_drp_finish, drp_lib_id);
RyoheiHagimoto 0:b4c1e32627f2 199 R_DK2_Activate(0, 0);
RyoheiHagimoto 0:b4c1e32627f2 200
RyoheiHagimoto 0:b4c1e32627f2 201 memset(&param_isp, 0, sizeof(param_isp));
RyoheiHagimoto 0:b4c1e32627f2 202 param_isp.src = (uint32_t)fbuf_bayer;
RyoheiHagimoto 0:b4c1e32627f2 203 param_isp.dst = (uint32_t)fbuf_yuv;
RyoheiHagimoto 0:b4c1e32627f2 204 param_isp.width = VIDEO_PIXEL_HW;
RyoheiHagimoto 0:b4c1e32627f2 205 param_isp.height = VIDEO_PIXEL_VW;
RyoheiHagimoto 0:b4c1e32627f2 206 param_isp.gain_r = 0x1266;
RyoheiHagimoto 0:b4c1e32627f2 207 param_isp.gain_g = 0x0CB0;
RyoheiHagimoto 0:b4c1e32627f2 208 param_isp.gain_b = 0x1359;
RyoheiHagimoto 0:b4c1e32627f2 209
RyoheiHagimoto 0:b4c1e32627f2 210 isp_wb_mode_req = WB_DAYLIGHT;
RyoheiHagimoto 0:b4c1e32627f2 211 isp_wb_mode = WB_DAYLIGHT;
RyoheiHagimoto 0:b4c1e32627f2 212 sprintf(str, "Daylight");
RyoheiHagimoto 0:b4c1e32627f2 213 ascii_font.DrawStr(str, 0, 0 + (AsciiFont::CHAR_PIX_HEIGHT + 1) * 0, 1, 2);
RyoheiHagimoto 0:b4c1e32627f2 214
RyoheiHagimoto 0:b4c1e32627f2 215 InterruptIn button(USER_BUTTON0);
RyoheiHagimoto 0:b4c1e32627f2 216 button.fall(&button_fall);
RyoheiHagimoto 0:b4c1e32627f2 217
RyoheiHagimoto 0:b4c1e32627f2 218 while (true) {
RyoheiHagimoto 0:b4c1e32627f2 219 ThisThread::flags_wait_all(DRP_FLG_CAMER_IN);
RyoheiHagimoto 0:b4c1e32627f2 220 if (isp_wb_mode_req != isp_wb_mode) {
RyoheiHagimoto 0:b4c1e32627f2 221 isp_wb_mode = isp_wb_mode_req;
RyoheiHagimoto 0:b4c1e32627f2 222 switch (isp_wb_mode) {
RyoheiHagimoto 0:b4c1e32627f2 223 case WB_DAYLIGHT:
RyoheiHagimoto 0:b4c1e32627f2 224 param_isp.gain_r = 0x1266;
RyoheiHagimoto 0:b4c1e32627f2 225 param_isp.gain_g = 0x0CB0;
RyoheiHagimoto 0:b4c1e32627f2 226 param_isp.gain_b = 0x1359;
RyoheiHagimoto 0:b4c1e32627f2 227 sprintf(str, "Daylight");
RyoheiHagimoto 0:b4c1e32627f2 228 break;
RyoheiHagimoto 0:b4c1e32627f2 229 case WB_CLOUDY:
RyoheiHagimoto 0:b4c1e32627f2 230 param_isp.gain_r = 0x1400;
RyoheiHagimoto 0:b4c1e32627f2 231 param_isp.gain_g = 0x0CB0;
RyoheiHagimoto 0:b4c1e32627f2 232 param_isp.gain_b = 0x11CA;
RyoheiHagimoto 0:b4c1e32627f2 233 sprintf(str, "Cloudy");
RyoheiHagimoto 0:b4c1e32627f2 234 break;
RyoheiHagimoto 0:b4c1e32627f2 235 case WB_FLUORESCENT:
RyoheiHagimoto 0:b4c1e32627f2 236 param_isp.gain_r = 0x1000;
RyoheiHagimoto 0:b4c1e32627f2 237 param_isp.gain_g = 0x0CB0;
RyoheiHagimoto 0:b4c1e32627f2 238 param_isp.gain_b = 0x163D;
RyoheiHagimoto 0:b4c1e32627f2 239 sprintf(str, "Fluorescent");
RyoheiHagimoto 0:b4c1e32627f2 240 break;
RyoheiHagimoto 0:b4c1e32627f2 241 case WB_TUNGSTEN:
RyoheiHagimoto 0:b4c1e32627f2 242 param_isp.gain_r = 0x0E66;
RyoheiHagimoto 0:b4c1e32627f2 243 param_isp.gain_g = 0x0CB0;
RyoheiHagimoto 0:b4c1e32627f2 244 param_isp.gain_b = 0x1876;
RyoheiHagimoto 0:b4c1e32627f2 245 sprintf(str, "Tungsten");
RyoheiHagimoto 0:b4c1e32627f2 246 break;
RyoheiHagimoto 0:b4c1e32627f2 247 }
RyoheiHagimoto 0:b4c1e32627f2 248 memset(fbuf_overlay, 0, sizeof(fbuf_overlay));
RyoheiHagimoto 0:b4c1e32627f2 249 ascii_font.DrawStr(str, 0, 0 + (AsciiFont::CHAR_PIX_HEIGHT + 1) * 0, 1, 2);
RyoheiHagimoto 0:b4c1e32627f2 250 }
RyoheiHagimoto 0:b4c1e32627f2 251 R_DK2_Start(drp_lib_id[0], (void *)&param_isp, sizeof(r_drp_simple_isp_t));
RyoheiHagimoto 0:b4c1e32627f2 252 }
RyoheiHagimoto 0:b4c1e32627f2 253 }
RyoheiHagimoto 0:b4c1e32627f2 254
RyoheiHagimoto 0:b4c1e32627f2 255 int main(void) {
RyoheiHagimoto 0:b4c1e32627f2 256 // Start DRP task
RyoheiHagimoto 0:b4c1e32627f2 257 drpTask.start(callback(drp_task));
RyoheiHagimoto 0:b4c1e32627f2 258
RyoheiHagimoto 0:b4c1e32627f2 259 ThisThread::sleep_for(osWaitForever);
RyoheiHagimoto 0:b4c1e32627f2 260 }
RyoheiHagimoto 0:b4c1e32627f2 261
RyoheiHagimoto 0:b4c1e32627f2 262 #endif