/** * @brief Select effect. * @param effect: Camera effect. * @retval None */ void CAMERA_SelectEffect(uint32_t effect) { switch (effect) { case 0: CAMERA_Set_ContrastBrightness(CameraSettings.b.contrast, CameraSettings.b.brightness); BSP_CAMERA_BlackWhiteConfig(CAMERA_BLACK_WHITE_NORMAL); break; case 1: BSP_CAMERA_BlackWhiteConfig(CAMERA_BLACK_WHITE_BW); break; case 2: BSP_CAMERA_BlackWhiteConfig(CAMERA_BLACK_WHITE_NEGATIVE); break; case 3: BSP_CAMERA_ColorEffectConfig(CAMERA_COLOR_EFFECT_ANTIQUE); break; case 4: BSP_CAMERA_ColorEffectConfig(CAMERA_COLOR_EFFECT_BLUE); break; case 5: BSP_CAMERA_ColorEffectConfig(CAMERA_COLOR_EFFECT_GREEN); break; case 6: BSP_CAMERA_ColorEffectConfig(CAMERA_COLOR_EFFECT_RED); break; } }
/** * @brief Camera demo * @param None * @retval None */ void Camera_demo (void) { uint8_t status = 0; uint32_t exit = 0; uint32_t camera_status = CAMERA_OK; uint32_t argb8888_Value = 0x00FF00FF; /* = 0xF81F in RGB565 format */ TS_StateTypeDef TS_State; uint32_t TS_command = TS_RESOLUTION; Camera_SetHint(); status = BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()); if (status != TS_OK) { BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - 95, (uint8_t *)"ERROR", CENTER_MODE); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - 80, (uint8_t *)"Touchscreen cannot be initialized", CENTER_MODE); } /*## Camera Initialization and start capture ############################*/ CameraResIndex = CAMERA_R160x120; /* Set QQVGA default resolution */ CameraResX = CAMERA_QQVGA_RES_X; CameraResY = CAMERA_QQVGA_RES_Y; /* Infinite loop */ while (exit == 0) { if (TS_command == TS_RESOLUTION) /* A camera change resolution has been asked */ { TS_command = TS_NO_COMMAND; BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)"Wait for camera initialization...", CENTER_MODE); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_BLUE); switch (CameraResIndex) { case CAMERA_R160x120: CameraResX = CAMERA_QQVGA_RES_X; CameraResY = CAMERA_QQVGA_RES_Y; /* Initialize the Camera */ camera_status = BSP_CAMERA_Init(RESOLUTION_R160x120); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" QQVGA camera stream ", CENTER_MODE); break; case CAMERA_R320x240: CameraResX = CAMERA_QVGA_RES_X; CameraResY = CAMERA_QVGA_RES_Y; /* Initialize the Camera */ camera_status = BSP_CAMERA_Init(RESOLUTION_R320x240); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" QVGA camera stream ", CENTER_MODE); break; case CAMERA_R480x272: CameraResX = CAMERA_480x272_RES_X; CameraResY = CAMERA_480x272_RES_Y; /* Initialize the Camera */ camera_status = BSP_CAMERA_Init(RESOLUTION_R480x272); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" 480x272 camera stream ", CENTER_MODE); break; case CAMERA_R640x480: CameraResX = CAMERA_VGA_RES_X; CameraResY = CAMERA_VGA_RES_Y; /* Initialize the Camera */ camera_status = BSP_CAMERA_Init(RESOLUTION_R640x480); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" VGA camera stream ", CENTER_MODE); break; default : break; } if (camera_status != CAMERA_OK) { BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS - 15, (uint8_t *)" CAMERA INIT ERROR ", CENTER_MODE); } else { offset_cam = 0; offset_lcd = 0; display_line_counter = 0; special_effect = CAMERA_BLACK_WHITE; /* No special effect applied */ color_effect = CAMERA_BLACK_WHITE_NORMAL; contrast = CAMERA_CONTRAST_LEVEL2; /* Mid-level brightness */ brightness = CAMERA_BRIGHTNESS_LEVEL2; /* Mid-level contrast */ CameraFrameBufferInitComplete = 0; CameraFrameBufferInitError = 0; /* Init or Re-Init Camera frame buffer by using DMA2D engine in mode Register to Memory */ camera_status = CameraFrameBufferRgb565_Init(CAMERA_VGA_RES_X, CAMERA_VGA_RES_Y, argb8888_Value); ASSERT(camera_status != CAMERA_OK); /* Wait end of DMA2D operation of error : via IT callback update */ while((CameraFrameBufferInitComplete == 0) && (CameraFrameBufferInitError == 0)) {;} /* Assert if error : no transfer complete */ ASSERT(CameraFrameBufferInitComplete != 1); /* Start / Restart camera stream */ BSP_CAMERA_ContinuousStart((uint8_t *)CAMERA_FRAME_BUFFER); /* Allow DMA2D copy from Camera frame buffer to LCD Frame buffer location */ Camera_AllowDma2dCopyCamFrmBuffToLcdFrmBuff = 1; } } /* (CameraResIndex != CameraCurrentResIndex) */ if (camera_status == CAMERA_OK) { /* Check in polling mode in touch screen the touch status and coordinates */ /* if touch occurred */ BSP_TS_GetState(&TS_State); if(TS_State.touchDetected >= 1) { /* Check touch position to apply brightness or contrast change */ if (TS_State.touchDetected == 1) { if ((TS_State.touchY[0] < 30) && (brightness < CAMERA_BRIGHTNESS_MAX)) { TS_command = TS_BRIGHTNESS_INC; brightness++; } else if ((TS_State.touchY[0] > (BSP_LCD_GetYSize() - 30)) && (brightness > CAMERA_BRIGHTNESS_MIN) ) { TS_command = TS_BRIGHTNESS_DEC; brightness--; } else if ((TS_State.touchX[0] < 30) && (contrast > CAMERA_CONTRAST_MIN)) { TS_command = TS_CONTRAST_DEC; contrast--; } else if ((TS_State.touchX[0] > (BSP_LCD_GetXSize() - 30)) && (contrast < CAMERA_CONTRAST_MAX)) { TS_command = TS_CONTRAST_INC; contrast++; } else { TS_command = TS_NO_COMMAND; } } /* Special effect change */ if (TS_State.touchDetected == 2) { TS_command = TS_EFFECT; switch (special_effect) { case CAMERA_BLACK_WHITE : if (color_effect < CAMERA_BLACK_WHITE_NORMAL) { /* From BW effect to another BW effect */ color_effect++; } else { /* From BW or none effect to color effect */ special_effect = CAMERA_COLOR_EFFECT; color_effect = CAMERA_COLOR_EFFECT_BLUE; } break; case CAMERA_COLOR_EFFECT : if (color_effect < CAMERA_COLOR_EFFECT_ANTIQUE) { /* From color effect to another color effect */ color_effect++; } else { /* From color effect to BW effect */ special_effect = CAMERA_BLACK_WHITE; color_effect = CAMERA_BLACK_WHITE_BW; } break; default : /* None effect */ special_effect = CAMERA_BLACK_WHITE; color_effect = CAMERA_BLACK_WHITE_NORMAL; break; } } if (TS_command == TS_NO_COMMAND) { BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" ", CENTER_MODE); } if ((TS_command == TS_BRIGHTNESS_INC) || (TS_command == TS_BRIGHTNESS_DEC) || (TS_command == TS_CONTRAST_INC) || (TS_command == TS_CONTRAST_DEC)) { /* A brightness change has been asked */ BSP_CAMERA_ContrastBrightnessConfig(contrast, brightness); if ((TS_command == TS_BRIGHTNESS_INC) || (TS_command == TS_BRIGHTNESS_DEC)) { BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Brightness change ", CENTER_MODE); } else { BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Contrast change ", CENTER_MODE); } } if (TS_command == TS_EFFECT) { /* A color effect change has been asked */ switch (special_effect) { case CAMERA_BLACK_WHITE : BSP_CAMERA_BlackWhiteConfig(color_effect); switch (color_effect) { case CAMERA_BLACK_WHITE_NORMAL : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" No effect applied ", CENTER_MODE); break; case CAMERA_BLACK_WHITE_BW : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Black and white effect applied ", CENTER_MODE); break; case CAMERA_BLACK_WHITE_NEGATIVE : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Negative effect applied ", CENTER_MODE); break; case CAMERA_BLACK_WHITE_BW_NEGATIVE : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" BW negative effect applied ", CENTER_MODE); break; } break; case CAMERA_COLOR_EFFECT : BSP_CAMERA_ColorEffectConfig(color_effect); switch (color_effect) { case CAMERA_COLOR_EFFECT_ANTIQUE : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Sepia color effect applied ", CENTER_MODE); break; case CAMERA_COLOR_EFFECT_BLUE : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Blue color effect applied ", CENTER_MODE); break; case CAMERA_COLOR_EFFECT_GREEN : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Green color effect applied ", CENTER_MODE); break; case CAMERA_COLOR_EFFECT_RED : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Red color effect applied ", CENTER_MODE); break; } break; } } if (TS_State.touchDetected >= 3) /* 3 or more fingers touch to change resolution */ { TS_command = TS_RESOLUTION; if (CameraResIndex < CAMERA_RES_INDEX_MAX) { CameraResIndex++; /* Switch to higher resolution */ } else { CameraResIndex = CAMERA_RES_INDEX_MIN; } /* Disallow DMA2D copy from Camera frame buffer to LCD Frame buffer location */ Camera_AllowDma2dCopyCamFrmBuffToLcdFrmBuff = 0; /* Insert 10 ms delay */ HAL_Delay(10); /* Stop camera stream */ camera_status = BSP_CAMERA_Stop(); ASSERT(camera_status != CAMERA_OK); /* Clear screen */ Camera_SetHint(); } /* Wait for touch screen no touch detected */ do { BSP_TS_GetState(&TS_State); }while(TS_State.touchDetected > 0); } } if (CheckForUserInput() > 0) { exit = 1; } } if (camera_status == CAMERA_OK) { /* Stop camera stream */ camera_status = BSP_CAMERA_Stop(); ASSERT(camera_status != CAMERA_OK); } /* End of camera demo */ }
/** * @brief Callback function of the Settings frame * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbSettingsDialog(WM_MESSAGE * pMsg) { int Id, NCode; WM_HWIN hItem; switch (pMsg->MsgId) { case WM_INIT_DIALOG: /* Settings frame initialization */ hItem = pMsg->hWin; FRAMEWIN_AddCloseButton(hItem, FRAMEWIN_BUTTON_RIGHT, 0); /* Create and attache the MULTIPAGE dialog windows */ hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIPAGE); hDialogCameraSettings = GUI_CreateDialogBox(_aDialogCameraSettings, GUI_COUNTOF(_aDialogCameraSettings), &_cbCameraSettings, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hItem, hDialogCameraSettings, "Camera Settings"); hDialogFileControl = GUI_CreateDialogBox(_aDialogFileControl, GUI_COUNTOF(_aDialogFileControl), &_cbFileControl, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hItem, hDialogFileControl, "File Settings"); MULTIPAGE_SelectPage(hItem, 0); /* 'OK' button initialization */ hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_OK); BUTTON_SetFont(hItem, GUI_FONT_13B_1); /* 'Cancel' button initialization */ hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CANCEL); BUTTON_SetFont(hItem, GUI_FONT_13B_1); break; case WM_DELETE: camera_disabled = 0; hSettings = 0; if(SD_Configured == 1) { BSP_CAMERA_Init(RESOLUTION_R160x120); CAMERA_Configured = 1; /* Apply new settings*/ SD_Configured = 0; } /* Delete choosfile window */ WM_DeleteWindow(chooser_select_folder); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch (Id) { case ID_BUTTON_OK: /* Notification sent by "OK" button */ switch (NCode) { case WM_NOTIFICATION_RELEASED: /* Save camera settings before delete settings frame */ hItem = WM_GetDialogItem(hDialogCameraSettings, ID_SLIDER_0); CameraSettings.b.brightness = SLIDER_GetValue(hItem); hItem = WM_GetDialogItem(hDialogCameraSettings, ID_SLIDER_1); CameraSettings.b.contrast = SLIDER_GetValue(hItem); /* Back to normal mode (no effects) */ hItem = WM_GetDialogItem(CAMERA_hWin, ID_RADIO); RADIO_SetValue(hItem, 0); if(CAMERA_GetState() != CAMERA_ERROR) { /* Apply new settings*/ CAMERA_Set_ContrastBrightness(CameraSettings.b.contrast, CameraSettings.b.brightness); BSP_CAMERA_BlackWhiteConfig(CAMERA_BLACK_WHITE_NORMAL); } GUI_EndDialog(pMsg->hWin, 0); break; } break; case ID_BUTTON_CANCEL: /* Notification sent by "Cancel" button */ switch (NCode) { case WM_NOTIFICATION_RELEASED: GUI_EndDialog(pMsg->hWin, 0); break; } break; } break; } }
/** * @brief Camera demo * @param None * @retval None */ void Camera_demo (void) { uint8_t status = 0; uint32_t exit = 0; uint32_t camera_status = CAMERA_OK; uint32_t argb8888_Value = 0x00556677; Camera_SetHint(); /* Activate joystick as used for contrast, brightness and visual effect settings */ /* on image from camera sensor */ status = BSP_JOY_Init(JOY_MODE_GPIO); if (status != IO_OK) { BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)"ERROR", CENTER_MODE); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS - 15, (uint8_t *)"Joystick cannot be initialized", CENTER_MODE); } /*## Camera Initialization and start capture ############################*/ BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)"Wait for camera initialization...", CENTER_MODE); CameraResIndex = CAMERA_R160x120; /* Set QQVGA default resolution */ CameraChangeResolutionAsked = 1; CameraResX = CAMERA_QQVGA_RES_X; CameraResY = CAMERA_QQVGA_RES_Y; /* Infinite loop */ while (exit == 0) { if (CameraChangeResolutionAsked) /* A camera change resolution has been asked */ { CameraChangeResolutionAsked = 0; if (CameraResIndex > CAMERA_R160x120) { /* If camera stream already started, it has to be stopped before reconfiguration */ /* Stop camera stream */ refresh_authorized = 0; camera_status = BSP_CAMERA_Stop(); BSP_TEST_APPLI_ASSERT(camera_status != CAMERA_OK); /* Clear screen */ Camera_SetHint(); BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)"Wait for camera initialization...", CENTER_MODE); } BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_BLUE); switch (CameraResIndex) { case CAMERA_R160x120: CameraResX = CAMERA_QQVGA_RES_X; CameraResY = CAMERA_QQVGA_RES_Y; /* Initialize the Camera */ camera_status = BSP_CAMERA_Init(RESOLUTION_R160x120); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" QQVGA camera stream ", CENTER_MODE); break; case CAMERA_R320x240: CameraResX = CAMERA_QVGA_RES_X; CameraResY = CAMERA_QVGA_RES_Y; /* Initialize the Camera */ camera_status = BSP_CAMERA_Init(RESOLUTION_R320x240); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" QVGA camera stream ", CENTER_MODE); break; case CAMERA_R480x272: CameraResX = CAMERA_480x272_RES_X; CameraResY = CAMERA_480x272_RES_Y; /* Initialize the Camera */ camera_status = BSP_CAMERA_Init(RESOLUTION_R480x272); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" 480x272 camera stream ", CENTER_MODE); break; case CAMERA_R640x480: CameraResX = CAMERA_VGA_RES_X; CameraResY = CAMERA_VGA_RES_Y; /* Initialize the Camera */ camera_status = BSP_CAMERA_Init(RESOLUTION_R640x480); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" VGA camera stream ", CENTER_MODE); break; default : break; } if (camera_status != CAMERA_OK) { BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS - 15, (uint8_t *)" CAMERA INIT ERROR ", CENTER_MODE); } offset_cam = 0; offset_lcd = 0; display_line_counter = 0; display_rotated_line_counter = 0; special_effect = CAMERA_BLACK_WHITE; /* No special effect applied */ color_effect = CAMERA_BLACK_WHITE_NORMAL; contrast = CAMERA_CONTRAST_LEVEL2; /* Mid-level brightness */ brightness = CAMERA_BRIGHTNESS_LEVEL2; /* Mid-level contrast */ refresh_authorized = 1; CameraFrameBufferInitComplete = 0; CameraFrameBufferInitError = 0; if(CameraResIndex == CAMERA_R640x480) { /* Clear first the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); } /* Init or Re-Init Camera frame buffer by using DMA2D engine in mode Register to Memory */ camera_status = CameraFrameBufferRgb565_Init(CAMERA_VGA_RES_X, CAMERA_VGA_RES_Y, argb8888_Value); BSP_TEST_APPLI_ASSERT(camera_status != CAMERA_OK); /* Wait end of DMA2D operation of error : via IT callback update */ while((CameraFrameBufferInitComplete == 0) && (CameraFrameBufferInitError == 0)) {;} /* Assert if error : no transfer complete */ BSP_TEST_APPLI_ASSERT(CameraFrameBufferInitComplete != 1); /* Start / Restart camera stream */ BSP_CAMERA_ContinuousStart((uint8_t *)CAMERA_FB_START_ADDR); /* Allow DMA2D copy from Camera frame buffer to LCD Frame buffer location */ Camera_AllowDma2dCopyCamFrmBuffToLcdFrmBuff = 1; } /* (CameraResIndex != CameraCurrentResIndex) */ /* Get the Joystick State */ JoyState = BSP_JOY_GetState(); switch (JoyState) { case JOY_UP: if (brightness < CAMERA_BRIGHTNESS_MAX) { brightness++; } else { JoyState = JOY_NONE; /* Cancel brightness change */ } break; case JOY_DOWN: if (brightness > CAMERA_BRIGHTNESS_MIN) { brightness--; } else { JoyState = JOY_NONE; /* Cancel brightness change */ } break; case JOY_LEFT: if (contrast > CAMERA_CONTRAST_MIN) { contrast--; } else { JoyState = JOY_NONE; /* Cancel contrast change */ } break; case JOY_RIGHT: if (contrast < CAMERA_CONTRAST_MAX) { contrast++; } else { JoyState = JOY_NONE; /* Cancel contrast change */ } break; case JOY_SEL: switch (special_effect) { case CAMERA_BLACK_WHITE : if (color_effect < CAMERA_BLACK_WHITE_NORMAL) { /* From BW effect to another BW effect */ color_effect++; } else { /* From BW or none effect to color effect */ special_effect = CAMERA_COLOR_EFFECT; color_effect = CAMERA_COLOR_EFFECT_ANTIQUE; } break; case CAMERA_COLOR_EFFECT : if (color_effect < CAMERA_COLOR_EFFECT_RED) { /* From color effect to another color effect */ color_effect++; } else { /* From color effect to BW effect */ special_effect = CAMERA_BLACK_WHITE; color_effect = CAMERA_BLACK_WHITE_BW; } break; default : /* None effect */ special_effect = CAMERA_BLACK_WHITE; color_effect = CAMERA_BLACK_WHITE_NORMAL; break; } break; default: break; } if ((JoyState == JOY_UP) || (JoyState == JOY_DOWN) || (JoyState == JOY_LEFT) || (JoyState == JOY_RIGHT)) { /* A brightness change has been asked */ BSP_CAMERA_ContrastBrightnessConfig(contrast, brightness); if ((JoyState == JOY_UP) || (JoyState == JOY_DOWN)) { BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Brightness change ", CENTER_MODE); } else { BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Contrast change ", CENTER_MODE); } } if (JoyState == JOY_SEL) { /* A color effect change has been asked */ switch (special_effect) { case CAMERA_BLACK_WHITE : BSP_CAMERA_BlackWhiteConfig(color_effect); switch (color_effect) { case CAMERA_BLACK_WHITE_NORMAL : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" No effect applied ", CENTER_MODE); break; case CAMERA_BLACK_WHITE_BW : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Black and white effect applied ", CENTER_MODE); break; case CAMERA_BLACK_WHITE_NEGATIVE : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Negative effect applied ", CENTER_MODE); break; case CAMERA_BLACK_WHITE_BW_NEGATIVE : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" BW negative effect applied ", CENTER_MODE); break; } break; case CAMERA_COLOR_EFFECT : BSP_CAMERA_ColorEffectConfig(color_effect); switch (color_effect) { case CAMERA_COLOR_EFFECT_ANTIQUE : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Sepia color effect applied ", CENTER_MODE); break; case CAMERA_COLOR_EFFECT_BLUE : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Blue color effect applied ", CENTER_MODE); break; case CAMERA_COLOR_EFFECT_GREEN : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Green color effect applied ", CENTER_MODE); break; case CAMERA_COLOR_EFFECT_RED : BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - CAMERA_STATUS_TEXT_POS, (uint8_t *)" Red color effect applied ", CENTER_MODE); break; } break; } } /* Toggle LED4 */ BSP_LED_Toggle(LED3); /* Insert 100 ms delay */ HAL_Delay(100); /* Toggle LED2 */ BSP_LED_Toggle(LED2); /* Insert 100 ms delay */ HAL_Delay(100); if (CheckForUserInput() > 0) { if (CameraResIndex < CAMERA_RES_INDEX_MAX) { CameraResIndex++; /* Switch to higher resolution */ CameraChangeResolutionAsked = 1; /* Disallow DMA2D copy from Camera frame buffer to LCD Frame buffer location */ Camera_AllowDma2dCopyCamFrmBuffToLcdFrmBuff = 0; /* Insert 10 ms delay */ HAL_Delay(10); } else { BSP_CAMERA_DeInit(); exit = 1; } } } /* Stop camera stream */ camera_status = BSP_CAMERA_Stop(); BSP_TEST_APPLI_ASSERT(camera_status != CAMERA_OK); /* End of camera demo */ }