Reworked the orientation of the screen depending on the defined platform in app_config.h

This commit is contained in:
anschrammh 2023-03-24 14:52:36 +01:00
parent f770a8e436
commit beec1570c0
2 changed files with 27 additions and 5 deletions

View File

@ -78,7 +78,11 @@ const uint8_t gc9a01_init_seq[] = {
0x02, 0, 0x8E, 0xFF,
0x02, 0, 0x8F, 0xFF,
0x03, 0, 0xB6, 0x00, 0x00,
#if HARDWARE_PLATFORM == SMART_WATCH_BREADBOARD
0x02, 0, 0x36, 0x88,
#elif HARDWARE_PLATFORM == SMART_WATCH_PCB
0x02, 0, 0x36, 0x48,
#endif
0x02, 0, 0x3A, 0x55,
0x05, 0, 0x90, 0x08, 0x08, 0x08, 0x08,
0x02, 0, 0xBD, 0x06,
@ -416,7 +420,7 @@ void lcd_sleep(LCDConfig_t *const LCDConfig, bool state)
lcd_set_data_command(LCDConfig, LCD_DATA);
}
void lcd_orientation(LCDConfig_t *const LCDConfig, LCDOrientation_t orientation)
void lcd_orientation(LCDConfig_t *const LCDConfig, LCDOrientation_e orientation)
{
if(!LCDConfig) return;
@ -434,6 +438,7 @@ void lcd_orientation(LCDConfig_t *const LCDConfig, LCDOrientation_t orientation)
switch(orientation)
{
#if HARDWARE_PLATFORM == SMART_WATCH_BREADBOARD
case LCD_ORIENTATION_90:
mmc_sdio_driver_write_one(0xE8);
break;
@ -445,6 +450,19 @@ void lcd_orientation(LCDConfig_t *const LCDConfig, LCDOrientation_t orientation)
break;
default: //Is default orientation eg : 0
mmc_sdio_driver_write_one(0x88);
#elif HARDWARE_PLATFORM == SMART_WATCH_PCB
case LCD_ORIENTATION_90:
mmc_sdio_driver_write_one(0x28);
break;
case LCD_ORIENTATION_180:
mmc_sdio_driver_write_one(0x88);
break;
case LCD_ORIENTATION_270:
mmc_sdio_driver_write_one(0xE8);
break;
default: //Is default orientation eg : 0
mmc_sdio_driver_write_one(0x48);
#endif
}
lcd_set_cs(LCDConfig, LCD_RELEASED);

View File

@ -46,7 +46,7 @@ typedef enum LCDOrientation
LCD_ORIENTATION_90,
LCD_ORIENTATION_180,
LCD_ORIENTATION_270,
} LCDOrientation_t;
} LCDOrientation_e;
/**
* @brief
@ -62,7 +62,7 @@ typedef struct LCDConfig
enum tls_io_name LCDResetPin;
DrawFinishedCb_t drawFinishedCb;
void *cbArg;
LCDOrientation_t LCDOrientation;
LCDOrientation_e LCDOrientation;
} LCDConfig_t;
/**
@ -139,8 +139,12 @@ void lcd_sleep(LCDConfig_t * const LCDConfig, bool state);
* @brief Sets the LCD orientation.
*
* @param LCDConfig a pointer to a user allocated LCDConfig_t structure
* @param orientation the value of the orientation to set
* @param orientation the value of the orientation to set :
* - LCD_ORIENTATION_DEFAULT or LCD_ORIENTATION_0
* - LCD_ORIENTATION_90
* - LCD_ORIENTATION_180
* - LCD_ORIENTATION_270
*/
void lcd_orientation(LCDConfig_t * const LCDConfig, LCDOrientation_t orientation);
void lcd_orientation(LCDConfig_t * const LCDConfig, LCDOrientation_e orientation);
#endif //LCD_H