Last active
April 15, 2024 10:31
-
-
Save sp5wwp/410988fd5816d0b83f465eb0e2539fc0 to your computer and use it in GitHub Desktop.
TYT MD-380 screen flip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(uint8_t y = startRow; y < endRow; y++) | |
{ | |
for(uint8_t x = 0; x < SCREEN_WIDTH; x++) | |
{ | |
if(y<SCREEN_HEIGHT/2) | |
{ | |
size_t pos1 = x + y * SCREEN_WIDTH; | |
size_t pos2 = x + (SCREEN_HEIGHT-1-y) * SCREEN_WIDTH; | |
uint16_t tmp = frameBuffer[pos1]; | |
frameBuffer[pos1] = __builtin_bswap16(frameBuffer[pos2]); | |
frameBuffer[pos2] = tmp; | |
} | |
else | |
{ | |
size_t pos = x + y * SCREEN_WIDTH; | |
frameBuffer[pos] = __builtin_bswap16(frameBuffer[pos]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment