Example #1
0
/**
  * @brief  Copy a Camera frame buffer line in RGB565 and convert it to LCD Frame buffer line in ARGB8888 format.
  *         This process uses the DMA2D and its integrated Pixel Format Converter (PFC).
  */
static void CopyCameraFrameBufferLineToLcdFrameBufferLine(void)
{
    if ((offset_lcd == 0) && (CameraResX <= LcdResX) && (CameraResY <= LcdResY))
    {
      /* If Camera resolution is lower than LCD resolution, set display in the middle of the screen */
      offset_lcd =   ((((LcdResY - CameraResY) / 2) * LcdResX)   /* Middle of the screen on Y axis */
                      +   ((LcdResX - CameraResX) / 2))             /* Middle of the screen on X axis */
                     * sizeof(uint32_t);
    }

    if (display_line_counter < CameraResY)
    {
      if (display_line_counter < LcdResY)
      {
        if (CameraResX < LcdResX)
        {
          LCD_LL_ConvertLineToARGB8888((uint32_t *)(CAMERA_FRAME_BUFFER + offset_cam),
                                         (uint32_t *)(LCD_FRAME_BUFFER + offset_lcd),
                                         CameraResX);
        }
        else
        {
          LCD_LL_ConvertLineToARGB8888((uint32_t *)(CAMERA_FRAME_BUFFER + offset_cam),
                                         (uint32_t *)(LCD_FRAME_BUFFER + offset_lcd),
                                         LcdResX);
        }

        offset_cam  = offset_cam + (CameraResX * sizeof(uint16_t)); /* RGB565 2 bytes per pixel   */
        offset_lcd  = offset_lcd + (LcdResX * sizeof(uint32_t));    /* ARGB8888 4 bytes per pixel */
      }

      display_line_counter++;
    }
    else
    {
      offset_cam = 0;
      offset_lcd = 0;
      display_line_counter = 0;
    }
}
Example #2
0
/**
  * @brief  Line event callback.
  * @param  None
  * @retval None
  */
void BSP_CAMERA_LineEventCallback(void)
{
  static uint32_t camera_datapointer, lcd_datapointer, line_number;
  
  if(BSP_LCD_GetYSize() > line_number)
  {
    LCD_LL_ConvertLineToARGB8888((uint32_t *)(CAMERA_FRAME_BUFFER + camera_datapointer), (uint32_t *)(LCD_FRAME_BUFFER + lcd_datapointer));
    camera_datapointer = camera_datapointer + BSP_LCD_GetXSize() * (sizeof(uint16_t)); 
    lcd_datapointer = lcd_datapointer + BSP_LCD_GetXSize() * (sizeof(uint32_t));
    line_number++;
  }
  else
  {
    camera_datapointer = 0;
    lcd_datapointer = 0;
    line_number = 0;
  }
}
/**
  * @brief  Camera line evnet callback
  * @param  None
  * @retval None
  */
void BSP_CAMERA_LineEventCallback(void)
{
  static uint32_t tmp, tmp2, counter;
  
  if(BSP_LCD_GetYSize() > counter)
  {
    LCD_LL_ConvertLineToARGB8888((uint32_t *)(CAMERA_FRAME_BUFFER + tmp), (uint32_t *)(LCD_FRAME_BUFFER + tmp2));
    tmp  = tmp + BSP_LCD_GetXSize()*sizeof(uint16_t); 
    tmp2 = tmp2 + BSP_LCD_GetXSize()*sizeof(uint32_t);
    counter++;
  }
  else
  {
    tmp = 0;
    tmp2 = 0;
    counter = 0;
  }
}
Example #4
0
/**
  * @brief  Line event callback.
  * @param  None
  * @retval None
  */
void BSP_CAMERA_LineEventCallback(void)
{
  static uint32_t camera_datapointer;
  static uint32_t line_number;

  if(line_number < CameraResY)
  {
    LCD_LL_ConvertLineToARGB8888((uint32_t *)(CAMERA_FRAME_BUFFER + camera_datapointer), (uint32_t *)(LCD_BG_LAYER_ADDRESS + lcd_datapointer));
    camera_datapointer = camera_datapointer + (CameraResX * RGB565_BYTE_PER_PIXEL);
    lcd_datapointer = lcd_datapointer + (LcdResX * ARGB8888_BYTE_PER_PIXEL);
    line_number++;
  }
  else
  {
    camera_datapointer = 0;
    lcd_datapointer = offset_address_area_cam_in_lcd_buffer;
    line_number = 0;
  }
}