add color swap BGR/RGB and generalize invert option

This commit is contained in:
philippe44
2022-02-27 14:34:11 -08:00
parent 54d7e222d0
commit dd519b9229
13 changed files with 87 additions and 54 deletions

View File

@@ -73,9 +73,10 @@ static void Update( struct GDS_Device* Device ) {
#endif
}
static void SetLayout( struct GDS_Device* Device, bool HFlip, bool VFlip, bool Rotate ) {
Device->WriteCommand( Device, HFlip ? 0xA1 : 0xA0 );
Device->WriteCommand( Device, VFlip ? 0xC8 : 0xC0 );
static void SetLayout( struct GDS_Device* Device, struct GDS_Layout *Layout ) {
Device->WriteCommand( Device, Layout->HFlip ? 0xA1 : 0xA0 );
Device->WriteCommand( Device, Layout->VFlip ? 0xC8 : 0xC0 );
Device->WriteCommand( Device, Layout->Invert ? 0xA7 : 0xA6 );
}
static void DisplayOn( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0xAF ); }
@@ -124,7 +125,8 @@ static bool Init( struct GDS_Device* Device ) {
Device->WriteCommand( Device, 0x40 + 0x00 );
Device->SetContrast( Device, 0x7F );
// set flip modes
Device->SetLayout( Device, false, false, false );
struct GDS_Layout Layout = { };
Device->SetLayout( Device, &Layout );
// no Display Inversion
Device->WriteCommand( Device, 0xA6 );
// set Clocks