Skip to content

Instantly share code, notes, and snippets.

@sp5wwp
Last active April 15, 2024 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sp5wwp/410988fd5816d0b83f465eb0e2539fc0 to your computer and use it in GitHub Desktop.
Save sp5wwp/410988fd5816d0b83f465eb0e2539fc0 to your computer and use it in GitHub Desktop.
TYT MD-380 screen flip
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