/** * @brief Prepares the picture to be saved in microSD. * @param None * @retval None */ static void Prepare_Picture(void) { uint32_t x_counter = 0, y_counter = 0; uint32_t address = SRAM_DEVICE_ADDR; uint16_t tmp = 0; /* Bypass the bitmap header */ address += (((BSP_LCD_GetXSize() - 80) * (BSP_LCD_GetYSize() - 81)) * 2); BSP_SRAM_Init(); /* Prepare picture */ for(y_counter = 10; y_counter < (BSP_LCD_GetYSize() - 70); y_counter++) { for(x_counter = 70; x_counter < (BSP_LCD_GetXSize() - 10); x_counter++) { /* Write data to the SRAM memory */ tmp = BSP_LCD_ReadPixel(x_counter, y_counter); BSP_SRAM_WriteData(address, &tmp, 1); /* Increment the source and destination buffers */ address += 2; } address -= 4*(BSP_LCD_GetXSize() - 80); } }
/** * @brief Prepares the picture to be Saved in USB. * @param None * @retval None */ static void PicturePrepare(void) { uint32_t address = SRAM_DEVICE_ADDR; uint16_t x = 0; uint16_t y = 0; uint16_t tmp = 0; uint8_t aRGB[4]; /* Go to the address of the last line of BMP file */ address += ((BSP_LCD_GetXSize() * (BSP_LCD_GetYSize() - 1)) * 4); /* Read data from GRAM and swap it into SRAM */ for(y = 0; y < (BSP_LCD_GetYSize()); y++) { for(x = 0; x < (BSP_LCD_GetXSize()); x++) { /* Write data to the SRAM memory */ tmp = BSP_LCD_ReadPixel(x, y); aRGB[0] = RGB565_TO_R(tmp); aRGB[1] = RGB565_TO_G(tmp); aRGB[2] = RGB565_TO_B(tmp); aRGB[3] = 0xFF; if(BSP_SRAM_WriteData(address, (uint16_t *)aRGB, 2) != SRAM_OK) { Error_Handler(); } else { address += 4; } } address -= 8*BSP_LCD_GetXSize(); } }
uint32_t LCD_DISCO_F469NI::ReadPixel(uint16_t Xpos, uint16_t Ypos) { return BSP_LCD_ReadPixel(Xpos, Ypos); }