Skip to content

Commit

Permalink
Fix warning for unsigned comparison to 0, group CASET/RASET/MADCTL to…
Browse files Browse the repository at this point in the history
…gether
  • Loading branch information
calc84maniac committed Jun 10, 2024
1 parent 25ed7fb commit eaffbca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
9 changes: 4 additions & 5 deletions core/panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ static void panel_reset_mem_ptr(panel_mem_ptr_t *memPtr);
.V57 = 44-v57, .V59 = 34-v59, .V61 = 64-v61, .V62 = 64-v62 }

static const panel_params_t panel_reset_params = {
.CASET = { .XS = 0, .XE = PANEL_LAST_COL },
.RASET = { .YS = 0, .YE = PANEL_LAST_ROW },
.PTLAR = { .PSL = 0, .PEL = PANEL_LAST_ROW },
.VSCRDEF = { .TFA = 0, .VSA = PANEL_NUM_ROWS, .BFA = 0 },
.VSCRSADD = { .VSP = 0 },
.TESCAN = { .N = 0 },
.CASET = {.XS = 0, .XE = PANEL_LAST_COL },
.RASET = {.YS = 0, .YE = PANEL_LAST_ROW },
.MADCTL = { .MH = 0, .RGB = 0, .ML = 0, .MV = 0, .MX = 0, .MY = 0 },
.COLMOD = { .MCU = 6, .RGB = 6 },
.DISBV = { .DBV = 0 },
Expand Down Expand Up @@ -1181,9 +1181,8 @@ static void panel_write_param(uint8_t value) {
index ^= (index < offsetof(panel_params_t, MADCTL));
uint8_t oldValue = ((uint8_t*)&panel.params)[index];
((uint8_t*)&panel.params)[index] = value;
if (index >= offsetof(panel_params_t, CASET) && index < offsetof(panel_params_t, RASET) + sizeof(panel.params.RASET)) {
panel_update_write_pixel_bounds();
} else if (index == offsetof(panel_params_t, MADCTL)) {
if (index >= offsetof(panel_params_t, CASET) && index < offsetof(panel_params_t, COLMOD)) {
/* CASET, RASET, MADCTL */
panel_update_write_pixel_bounds();
} else if (index == offsetof(panel_params_t, COLMOD)) {
panel_update_rgb_clock_method();
Expand Down
16 changes: 8 additions & 8 deletions core/panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ typedef struct panel_gamma {

typedef struct panel_params {
/* Word params */
struct {
uint16_t XS;
uint16_t XE;
} CASET;
struct {
uint16_t YS;
uint16_t YE;
} RASET;
struct {
uint16_t PSL;
uint16_t PEL;
Expand All @@ -121,6 +113,14 @@ typedef struct panel_params {
struct {
uint16_t N;
} TESCAN;
struct {
uint16_t XS;
uint16_t XE;
} CASET;
struct {
uint16_t YS;
uint16_t YE;
} RASET;
/* Byte params */
struct {
uint8_t : 2;
Expand Down

0 comments on commit eaffbca

Please sign in to comment.