@@ -47,7 +47,8 @@ LOG_MODULE_REGISTER(ssd1363, CONFIG_DISPLAY_LOG_LEVEL);
47
47
#define SSD1363_SET_REMAP_VALUE 0xA0
48
48
#define SSD1363_SET_GRAY_ENHANCE 0xB4
49
49
50
- #define SSD1363_RESET_DELAY 100
50
+ #define SSD1363_RESET_DELAY 100
51
+ #define SSD1363_SET_LUT_COUNT 15
51
52
52
53
typedef int (* ssd1363_write_bus_cmd_fn )(const struct device * dev , const uint8_t cmd ,
53
54
const uint8_t * data , size_t len );
@@ -75,8 +76,7 @@ struct ssd1363_config {
75
76
uint8_t precharge_period ;
76
77
uint8_t precharge_config ;
77
78
uint16_t column_offset ;
78
- uint8_t grayscale_table [15 ];
79
- bool grayscale_table_present ;
79
+ const uint8_t * grayscale_table ;
80
80
bool color_inversion ;
81
81
bool grayscale_enhancement ;
82
82
uint8_t * conversion_buf ;
@@ -156,8 +156,9 @@ static inline int ssd1363_set_hardware_config(const struct device *dev)
156
156
if (err < 0 ) {
157
157
return err ;
158
158
}
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 );
161
162
if (err < 0 ) {
162
163
return err ;
163
164
}
@@ -462,17 +463,15 @@ static DEVICE_API(display, ssd1363_driver_api) = {
462
463
#define SSD1363_CONV_BUFFER_SIZE (node_id ) \
463
464
DIV_ROUND_UP(DT_PROP(node_id, width) * CONFIG_SSD1363_CONV_BUFFER_LINES, 1)
464
465
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
-
470
466
#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 ))
473
469
474
470
#define SSD1363_DEFINE_I2C (node_id ) \
475
471
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);), ()) \
476
475
static const struct ssd1363_config config##node_id = { \
477
476
.i2c = I2C_DT_SPEC_GET(node_id), \
478
477
.height = DT_PROP(node_id, height), \
@@ -503,6 +502,9 @@ static DEVICE_API(display, ssd1363_driver_api) = {
503
502
504
503
#define SSD1363_DEFINE_MIPI (node_id ) \
505
504
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);), ()) \
506
508
static const struct ssd1363_config config##node_id = { \
507
509
.mipi_dev = DEVICE_DT_GET(DT_PARENT(node_id)), \
508
510
.dbi_config = MIPI_DBI_CONFIG_DT( \
0 commit comments