@@ -47,7 +47,8 @@ LOG_MODULE_REGISTER(ssd1363, CONFIG_DISPLAY_LOG_LEVEL);
4747#define SSD1363_SET_REMAP_VALUE 0xA0
4848#define SSD1363_SET_GRAY_ENHANCE 0xB4
4949
50- #define SSD1363_RESET_DELAY 100
50+ #define SSD1363_RESET_DELAY 100
51+ #define SSD1363_SET_LUT_COUNT 15
5152
5253typedef int (* ssd1363_write_bus_cmd_fn )(const struct device * dev , const uint8_t cmd ,
5354 const uint8_t * data , size_t len );
@@ -75,8 +76,7 @@ struct ssd1363_config {
7576 uint8_t precharge_period ;
7677 uint8_t precharge_config ;
7778 uint16_t column_offset ;
78- uint8_t grayscale_table [15 ];
79- bool grayscale_table_present ;
79+ const uint8_t * grayscale_table ;
8080 bool color_inversion ;
8181 bool grayscale_enhancement ;
8282 uint8_t * conversion_buf ;
@@ -156,8 +156,9 @@ static inline int ssd1363_set_hardware_config(const struct device *dev)
156156 if (err < 0 ) {
157157 return err ;
158158 }
159- if (config -> grayscale_table_present ) {
160- err = config -> write_cmd (dev , SSD1363_SET_LUT , config -> grayscale_table , 15 );
159+ if (config -> grayscale_table != NULL ) {
160+ err = config -> write_cmd (dev , SSD1363_SET_LUT , config -> grayscale_table ,
161+ SSD1363_SET_LUT_COUNT );
161162 if (err < 0 ) {
162163 return err ;
163164 }
@@ -462,17 +463,15 @@ static DEVICE_API(display, ssd1363_driver_api) = {
462463#define SSD1363_CONV_BUFFER_SIZE (node_id ) \
463464 DIV_ROUND_UP(DT_PROP(node_id, width) * CONFIG_SSD1363_CONV_BUFFER_LINES, 1)
464465
465- #define SSD1363_GRAYSCALE_TABLE_YES (node_id ) \
466- .grayscale_table = DT_PROP(node_id, grayscale_table), .grayscale_table_present = true
467-
468- #define SSD1363_GRAYSCALE_TABLE_NO (node_id ) .grayscale_table_present = false
469-
470466#define SSD1363_GRAYSCALE_TABLE (node_id ) \
471- COND_CODE_1(DT_NODE_HAS_PROP(node_id, grayscale_table), \
472- (SSD1363_GRAYSCALE_TABLE_YES( node_id)) , (SSD1363_GRAYSCALE_TABLE_NO(node_id) ))
467+ .grayscale_table = COND_CODE_1(DT_NODE_HAS_PROP(node_id, grayscale_table), \
468+ (ssd1363_grayscale_table_## node_id), (NULL ))
473469
474470#define SSD1363_DEFINE_I2C (node_id ) \
475471 static uint8_t conversion_buf##node_id[SSD1363_CONV_BUFFER_SIZE(node_id)]; \
472+ COND_CODE_1(DT_NODE_HAS_PROP(node_id, grayscale_table), ( \
473+ static const uint8_t ssd1363_grayscale_table_##node_id[SSD1363_SET_LUT_COUNT] = \
474+ DT_PROP(node_id, grayscale_table);), ()) \
476475 static const struct ssd1363_config config##node_id = { \
477476 .i2c = I2C_DT_SPEC_GET(node_id), \
478477 .height = DT_PROP(node_id, height), \
@@ -503,6 +502,9 @@ static DEVICE_API(display, ssd1363_driver_api) = {
503502
504503#define SSD1363_DEFINE_MIPI (node_id ) \
505504 static uint8_t conversion_buf##node_id[SSD1363_CONV_BUFFER_SIZE(node_id)]; \
505+ COND_CODE_1(DT_NODE_HAS_PROP(node_id, grayscale_table), ( \
506+ static const uint8_t ssd1363_grayscale_table_##node_id[SSD1363_SET_LUT_COUNT] = \
507+ DT_PROP(node_id, grayscale_table);), ()) \
506508 static const struct ssd1363_config config##node_id = { \
507509 .mipi_dev = DEVICE_DT_GET(DT_PARENT(node_id)), \
508510 .dbi_config = MIPI_DBI_CONFIG_DT( \
0 commit comments