Rotation means clockwise 90 or 270 degrees.
Change the #define ROTATE accordingly
And also take care about the frame buffer base address, which is 0xd0000000 on my system.
Change it accordingly
#define ROTATE 90
/***** get_col_270 (...) *******************/
/*! @brief Copy all source column pixels into destination area
*
* @param[in] src The pixel source buffer
* @param[in] area The rectangle (x1, y1 -> x2, y2) within the destination buffer
* @param[in] x The x pos int source area
* @param[in] dest The destination buffer address
*
* We read from the source area the same x pos for every line
* and write to destination address sequentially in positiv direction
*
*/
void get_col_270 (const lv_color_t* src, const lv_area_t* area, lv_coord_t x, lv_color_t* dest)
{
lv_coord_t col;
lv_coord_t w = lv_area_get_width (area); // The width of the source area
lv_coord_t h = lv_area_get_height (area); // The height of the source area
for (col = 0; col < h; col++) { // all source column pixels (line in destination)
dest[col].full = src[x].full; // The x pos into source area
src += w; // Set for the next source line
}
}
/***** get_col_90 (...) *******************/
/*! @brief Copy all source column pixels into destination area
*
* @param[in] src The pixel source buffer
* @param[in] area The rectangle (x1, y1 -> x2, y2) within the destination buffer
* @param[in] x The x pos int source area
* @param[in] dest The destination buffer address
*
* We read from the source area the same x pos for every line
* and write to destination address sequentially in negative direction
*
*/
void get_col_90 (const lv_color_t* src, const lv_area_t* area, lv_coord_t x, lv_color_t* dest)
{
lv_coord_t col;
lv_coord_t w = lv_area_get_width (area); // The width of the source area
lv_coord_t h = lv_area_get_height (area); // The height of the source area
for (col = 0; col < h; col++) { // all source column pixels (line in destination)
dest[-col].full = src[x].full; // The -x pos into source area
src += w; // Set for the next source line
}
}
/***** monitor_flush (...) *******************/
void monitor_flush (lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p)
{
lv_coord_t x2 = area->x2;
if (x2 >= disp_drv->hor_res) {
x2 = disp_drv->hor_res - 1;
}
#if ROTATE == 270
lv_color_t* dest = (lv_color_t*) 0xd0000000; // monitor.tft_fb; // destination buffer base address
dest += disp_drv->ver_res * (disp_drv->hor_res - 1); // calculate the start of the very last line in destination buffer
dest -= disp_drv->ver_res * area->x1; // and go back to start address of line
lv_coord_t x;
for (x = area->x1; x <= x2; x++) { // For all source columns
get_col_270 (color_p, // The pixel source buffer
area, // The destination area we should write
(x - area->x1), // The x pos related to source area (is the y for destination)
dest + area->y1); // Destination buffer start address
dest -= disp_drv->ver_res; // Next destination buffer start address (runs bottom to top)
}
#elif ROTATE == 90
lv_color_t* dest = (lv_color_t*) 0xd0000000; // monitor.tft_fb; // destination buffer base address
dest += disp_drv->ver_res * area->x1; // Start address of line
lv_coord_t x;
for (x = area->x1; x <= x2; x++) { // For all source columns
get_col_90 (color_p, // The pixel source buffer
area, // The destination area we should write
(x - area->x1), // The x pos related to source area (is the y for destination)
dest + (disp_drv->ver_res - 1 - area->y1)); // Destination buffer start address
dest += disp_drv->ver_res; // Next destination buffer start address (runs top to bottom)
}
#endif
lv_disp_flush_ready (disp_drv); // IMPORTANT! It must be called to tell the system the flush is finished
}