Skip to content

Commit 8adfab2

Browse files
committed
Combine two flags into one argument
.. a third will be added soon. Passing 4 arguments in registers is more efficient in ARM than having 5 arguments anyway. (saves ~80 bytes flash) and is either tied or a hair faster at redraw than the previous ref
1 parent e51e02a commit 8adfab2

File tree

17 files changed

+64
-65
lines changed

17 files changed

+64
-65
lines changed

ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
132132
return true;
133133
}
134134

135-
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
136-
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
135+
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_write_mode_t mode,
136+
const uint8_t *data, uint32_t data_length) {
137137
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
138-
common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA);
138+
common_hal_digitalio_digitalinout_set_value(&self->command, (mode & MASK_DISPLAY) == DISPLAY_DATA);
139139
uint32_t *clear_write = (uint32_t *)&self->write_group->OUTCLR.reg;
140140
uint32_t *set_write = (uint32_t *)&self->write_group->OUTSET.reg;
141141
uint32_t mask = self->write_mask;

ports/espressif/common-hal/paralleldisplay/ParallelBus.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
172172
return r;
173173
}
174174

175-
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
176-
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
175+
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_write_mode_t mode,
176+
const uint8_t *data, uint32_t data_length) {
177177
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
178178
if (data_length) {
179-
gpio_set_level(self->config.pin_num_rs, byte_type == DISPLAY_DATA);
179+
gpio_set_level(self->config.pin_num_rs, (mode & MASK_DISPLAY) == DISPLAY_DATA);
180180
i2s_lcd_write(self->handle, data, data_length);
181181
}
182182
}

ports/nrf/common-hal/paralleldisplay/ParallelBus.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
141141
}
142142

143143
// This ignores chip_select behaviour because data is clocked in by the write line toggling.
144-
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
145-
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
144+
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_write_mode_t mode,
145+
const uint8_t *data, uint32_t data_length) {
146146
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
147-
common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA);
147+
common_hal_digitalio_digitalinout_set_value(&self->command, (mode & MODE_DISPLAY) == DISPLAY_DATA);
148148
uint32_t *clear_write = (uint32_t *)&self->write_group->OUTCLR;
149149
uint32_t *set_write = (uint32_t *)&self->write_group->OUTSET;
150150
uint32_t mask = self->write_mask;

ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
155155
return true;
156156
}
157157

158-
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
159-
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
158+
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_write_mode_t mode,
159+
const uint8_t *data, uint32_t data_length) {
160160

161161
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
162162

163-
common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA);
163+
common_hal_digitalio_digitalinout_set_value(&self->command, mode & DISPLAY_DATA);
164164
common_hal_rp2pio_statemachine_write(&self->state_machine, data, data_length, 1, false);
165165
}
166166

shared-bindings/displayio/FourWire.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ STATIC mp_obj_t displayio_fourwire_obj_send(size_t n_args, const mp_obj_t *pos_a
148148
while (!common_hal_displayio_fourwire_begin_transaction(self)) {
149149
RUN_BACKGROUND_TASKS;
150150
}
151-
display_chip_select_behavior_t chip_select = CHIP_SELECT_UNTOUCHED;
151+
display_write_mode_t chip_select = CHIP_SELECT_UNTOUCHED;
152152
if (args[ARG_toggle_every_byte].u_bool) {
153153
chip_select = CHIP_SELECT_TOGGLE_EVERY_BYTE;
154154
}
155-
common_hal_displayio_fourwire_send(self, DISPLAY_COMMAND, chip_select, &command, 1);
156-
common_hal_displayio_fourwire_send(self, DISPLAY_DATA, chip_select, ((uint8_t *)bufinfo.buf), bufinfo.len);
155+
common_hal_displayio_fourwire_send(self, DISPLAY_COMMAND | chip_select, &command, 1);
156+
common_hal_displayio_fourwire_send(self, DISPLAY_DATA | chip_select, ((uint8_t *)bufinfo.buf), bufinfo.len);
157157
common_hal_displayio_fourwire_end_transaction(self);
158158

159159
return mp_const_none;

shared-bindings/displayio/FourWire.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ bool common_hal_displayio_fourwire_bus_free(mp_obj_t self);
4848

4949
bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t self);
5050

51-
void common_hal_displayio_fourwire_send(mp_obj_t self, display_byte_type_t byte_type,
52-
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length);
51+
void common_hal_displayio_fourwire_send(mp_obj_t self, display_write_mode_t mode,
52+
const uint8_t *data, uint32_t data_length);
5353

5454
void common_hal_displayio_fourwire_end_transaction(mp_obj_t self);
5555

shared-bindings/displayio/I2CDisplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ STATIC mp_obj_t displayio_i2cdisplay_obj_send(mp_obj_t self, mp_obj_t command_ob
116116
uint8_t full_command[bufinfo.len + 1];
117117
full_command[0] = command;
118118
memcpy(full_command + 1, ((uint8_t *)bufinfo.buf), bufinfo.len);
119-
common_hal_displayio_i2cdisplay_send(self, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, full_command, bufinfo.len + 1);
119+
common_hal_displayio_i2cdisplay_send(self, DISPLAY_COMMAND | CHIP_SELECT_UNTOUCHED, full_command, bufinfo.len + 1);
120120
common_hal_displayio_i2cdisplay_end_transaction(self);
121121

122122
return mp_const_none;

shared-bindings/displayio/I2CDisplay.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t self);
4444

4545
bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t self);
4646

47-
void common_hal_displayio_i2cdisplay_send(mp_obj_t self, display_byte_type_t byte_type,
48-
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length);
47+
void common_hal_displayio_i2cdisplay_send(mp_obj_t self, display_write_mode_t mode,
48+
const uint8_t *data, uint32_t data_length);
4949

5050
void common_hal_displayio_i2cdisplay_end_transaction(mp_obj_t self);
5151

shared-bindings/displayio/__init__.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
#include "py/obj.h"
3232

3333
typedef enum {
34-
DISPLAY_COMMAND,
35-
DISPLAY_DATA
36-
} display_byte_type_t;
34+
DISPLAY_COMMAND = 0,
35+
DISPLAY_DATA = 1,
36+
MASK_DISPLAY = DISPLAY_DATA,
3737

38-
typedef enum {
39-
CHIP_SELECT_UNTOUCHED,
40-
CHIP_SELECT_TOGGLE_EVERY_BYTE
41-
} display_chip_select_behavior_t;
38+
CHIP_SELECT_UNTOUCHED = 0,
39+
CHIP_SELECT_TOGGLE_EVERY_BYTE = 2,
40+
MASK_CHIP_SELECT = CHIP_SELECT_TOGGLE_EVERY_BYTE,
41+
} display_write_mode_t;
4242

4343
typedef enum displayio_colorspace {
4444
DISPLAYIO_COLORSPACE_RGB888,
@@ -56,8 +56,7 @@ typedef enum displayio_colorspace {
5656
typedef bool (*display_bus_bus_reset)(mp_obj_t bus);
5757
typedef bool (*display_bus_bus_free)(mp_obj_t bus);
5858
typedef bool (*display_bus_begin_transaction)(mp_obj_t bus);
59-
typedef void (*display_bus_send)(mp_obj_t bus, display_byte_type_t byte_type,
60-
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length);
59+
typedef void (*display_bus_send)(mp_obj_t bus, display_write_mode_t mode, const uint8_t *data, uint32_t data_length);
6160
typedef void (*display_bus_end_transaction)(mp_obj_t bus);
6261

6362
void common_hal_displayio_release_displays(void);

shared-bindings/paralleldisplay/ParallelBus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ STATIC mp_obj_t paralleldisplay_parallelbus_obj_send(mp_obj_t self, mp_obj_t com
144144
while (!common_hal_paralleldisplay_parallelbus_begin_transaction(self)) {
145145
RUN_BACKGROUND_TASKS;
146146
}
147-
common_hal_paralleldisplay_parallelbus_send(self, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, &command, 1);
148-
common_hal_paralleldisplay_parallelbus_send(self, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t *)bufinfo.buf), bufinfo.len);
147+
common_hal_paralleldisplay_parallelbus_send(self, DISPLAY_COMMAND | CHIP_SELECT_UNTOUCHED, &command, 1);
148+
common_hal_paralleldisplay_parallelbus_send(self, DISPLAY_DATA | CHIP_SELECT_UNTOUCHED, ((uint8_t *)bufinfo.buf), bufinfo.len);
149149
common_hal_paralleldisplay_parallelbus_end_transaction(self);
150150

151151
return mp_const_none;

shared-bindings/paralleldisplay/ParallelBus.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t self);
4949

5050
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t self);
5151

52-
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t self, display_byte_type_t byte_type,
53-
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length);
52+
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t self, display_write_mode_t mode,
53+
const uint8_t *data, uint32_t data_length);
5454

5555
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t self);

shared-module/displayio/Display.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
9292
uint8_t full_command[data_size + 1];
9393
full_command[0] = cmd[0];
9494
memcpy(full_command + 1, data, data_size);
95-
self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, full_command, data_size + 1);
95+
self->core.send(self->core.bus, DISPLAY_COMMAND | CHIP_SELECT_TOGGLE_EVERY_BYTE, full_command, data_size + 1);
9696
} else {
97-
self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, cmd, 1);
98-
self->core.send(self->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, data, data_size);
97+
self->core.send(self->core.bus, DISPLAY_COMMAND | CHIP_SELECT_TOGGLE_EVERY_BYTE, cmd, 1);
98+
self->core.send(self->core.bus, DISPLAY_DATA | CHIP_SELECT_UNTOUCHED, data, data_size);
9999
}
100100
displayio_display_core_end_transaction(&self->core);
101101
uint16_t delay_length_ms = 10;
@@ -184,12 +184,12 @@ bool common_hal_displayio_display_set_brightness(displayio_display_obj_t *self,
184184
if (ok) {
185185
if (self->data_as_commands) {
186186
uint8_t set_brightness[2] = {self->brightness_command, (uint8_t)(0xff * brightness)};
187-
self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, set_brightness, 2);
187+
self->core.send(self->core.bus, DISPLAY_COMMAND | CHIP_SELECT_TOGGLE_EVERY_BYTE, set_brightness, 2);
188188
} else {
189189
uint8_t command = self->brightness_command;
190190
uint8_t hex_brightness = 0xff * brightness;
191-
self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, &command, 1);
192-
self->core.send(self->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, &hex_brightness, 1);
191+
self->core.send(self->core.bus, DISPLAY_COMMAND | CHIP_SELECT_TOGGLE_EVERY_BYTE, &command, 1);
192+
self->core.send(self->core.bus, DISPLAY_DATA | CHIP_SELECT_UNTOUCHED, &hex_brightness, 1);
193193
}
194194
displayio_display_core_end_transaction(&self->core);
195195
}
@@ -221,9 +221,9 @@ STATIC const displayio_area_t *_get_refresh_areas(displayio_display_obj_t *self)
221221

222222
STATIC void _send_pixels(displayio_display_obj_t *self, uint8_t *pixels, uint32_t length) {
223223
if (!self->data_as_commands) {
224-
self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, &self->write_ram_command, 1);
224+
self->core.send(self->core.bus, DISPLAY_COMMAND | CHIP_SELECT_TOGGLE_EVERY_BYTE, &self->write_ram_command, 1);
225225
}
226-
self->core.send(self->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, pixels, length);
226+
self->core.send(self->core.bus, DISPLAY_DATA | CHIP_SELECT_UNTOUCHED, pixels, length);
227227
}
228228

229229
STATIC bool _refresh_area(displayio_display_obj_t *self, const displayio_area_t *area) {

shared-module/displayio/EPaperDisplay.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ STATIC void send_command_sequence(displayio_epaperdisplay_obj_t *self,
153153
data = cmd + 3;
154154
}
155155
displayio_display_core_begin_transaction(&self->core);
156-
self->core.send(self->core.bus, DISPLAY_COMMAND, self->chip_select, cmd, 1);
157-
self->core.send(self->core.bus, DISPLAY_DATA, self->chip_select, data, data_size);
156+
self->core.send(self->core.bus, DISPLAY_COMMAND | self->chip_select, cmd, 1);
157+
self->core.send(self->core.bus, DISPLAY_DATA | self->chip_select, data, data_size);
158158
displayio_display_core_end_transaction(&self->core);
159159
uint16_t delay_length_ms = 0;
160160
if (delay) {
@@ -205,7 +205,7 @@ uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaper
205205
STATIC void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t *self) {
206206
// Actually refresh the display now that all pixel RAM has been updated.
207207
displayio_display_core_begin_transaction(&self->core);
208-
self->core.send(self->core.bus, DISPLAY_COMMAND, self->chip_select, &self->refresh_display_command, 1);
208+
self->core.send(self->core.bus, DISPLAY_COMMAND | self->chip_select, &self->refresh_display_command, 1);
209209
displayio_display_core_end_transaction(&self->core);
210210
supervisor_enable_tick();
211211
self->refreshing = true;
@@ -292,7 +292,7 @@ STATIC bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t *
292292
write_command = self->write_color_ram_command;
293293
}
294294
displayio_display_core_begin_transaction(&self->core);
295-
self->core.send(self->core.bus, DISPLAY_COMMAND, self->chip_select, &write_command, 1);
295+
self->core.send(self->core.bus, DISPLAY_COMMAND | self->chip_select, &write_command, 1);
296296
displayio_display_core_end_transaction(&self->core);
297297

298298
for (uint16_t j = 0; j < subrectangles; j++) {
@@ -339,7 +339,7 @@ STATIC bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t *
339339
// Can't acquire display bus; skip the rest of the data. Try next display.
340340
return false;
341341
}
342-
self->core.send(self->core.bus, DISPLAY_DATA, self->chip_select, (uint8_t *)buffer, subrectangle_size_bytes);
342+
self->core.send(self->core.bus, DISPLAY_DATA | self->chip_select, (uint8_t *)buffer, subrectangle_size_bytes);
343343
displayio_display_core_end_transaction(&self->core);
344344

345345
// TODO(tannewt): Make refresh displays faster so we don't starve other

shared-module/displayio/EPaperDisplay.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ typedef struct {
5656
bool color_bits_inverted;
5757
bool refreshing;
5858
bool grayscale;
59-
display_chip_select_behavior_t chip_select;
59+
display_write_mode_t chip_select;
6060
bool two_byte_sequence_length;
6161
} displayio_epaperdisplay_obj_t;
6262

shared-module/displayio/FourWire.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t obj) {
115115
return true;
116116
}
117117

118-
void common_hal_displayio_fourwire_send(mp_obj_t obj, display_byte_type_t data_type,
119-
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
118+
void common_hal_displayio_fourwire_send(mp_obj_t obj, display_write_mode_t mode, const uint8_t *data, uint32_t data_length) {
120119
displayio_fourwire_obj_t *self = MP_OBJ_TO_PTR(obj);
121120
if (self->command.base.type == &mp_type_NoneType) {
122121
// When the data/command pin is not specified, we simulate a 9-bit SPI mode, by
@@ -126,7 +125,7 @@ void common_hal_displayio_fourwire_send(mp_obj_t obj, display_byte_type_t data_t
126125
// transmission. We toggle the CS pin to make the receiver discard them.
127126
uint8_t buffer = 0;
128127
uint8_t bits = 0;
129-
uint8_t dc = (data_type == DISPLAY_DATA);
128+
uint8_t dc = mode & DISPLAY_DATA;
130129

131130
for (size_t i = 0; i < data_length; i++) {
132131
bits = (bits + 1) % 8;
@@ -156,8 +155,8 @@ void common_hal_displayio_fourwire_send(mp_obj_t obj, display_byte_type_t data_t
156155
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
157156
}
158157
} else {
159-
common_hal_digitalio_digitalinout_set_value(&self->command, data_type == DISPLAY_DATA);
160-
if (chip_select == CHIP_SELECT_TOGGLE_EVERY_BYTE) {
158+
common_hal_digitalio_digitalinout_set_value(&self->command, mode & DISPLAY_DATA);
159+
if (mode & CHIP_SELECT_TOGGLE_EVERY_BYTE) {
161160
// Toggle chip select after each command byte in case the display driver
162161
// IC latches commands based on it.
163162
for (size_t i = 0; i < data_length; i++) {

shared-module/displayio/I2CDisplay.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,11 @@ bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t obj) {
103103
return common_hal_busio_i2c_try_lock(self->bus);
104104
}
105105

106-
void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, display_byte_type_t data_type,
107-
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
106+
void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, display_write_mode_t mode,
107+
const uint8_t *data, uint32_t data_length) {
108108
displayio_i2cdisplay_obj_t *self = MP_OBJ_TO_PTR(obj);
109-
if (data_type == DISPLAY_COMMAND) {
109+
110+
if ((mode & MASK_DISPLAY) == DISPLAY_COMMAND) {
110111
uint8_t command_bytes[2 * data_length];
111112
for (uint32_t i = 0; i < data_length; i++) {
112113
command_bytes[2 * i] = 0x80;

shared-module/displayio/display_core.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self,
245245
x2 -= 1;
246246
y2 -= 1;
247247

248-
display_chip_select_behavior_t chip_select = CHIP_SELECT_UNTOUCHED;
248+
display_write_mode_t chip_select = CHIP_SELECT_UNTOUCHED;
249249
if (always_toggle_chip_select || data_as_commands) {
250250
chip_select = CHIP_SELECT_TOGGLE_EVERY_BYTE;
251251
}
@@ -255,9 +255,9 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self,
255255
uint8_t data[5];
256256
data[0] = column_command;
257257
uint8_t data_length = 1;
258-
display_byte_type_t data_type = DISPLAY_DATA;
258+
display_write_mode_t data_type = DISPLAY_DATA;
259259
if (!data_as_commands) {
260-
self->send(self->bus, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, data, 1);
260+
self->send(self->bus, DISPLAY_COMMAND | CHIP_SELECT_UNTOUCHED, data, 1);
261261
data_length = 0;
262262
} else {
263263
data_type = DISPLAY_COMMAND;
@@ -281,14 +281,14 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self,
281281
data_length = 2;
282282
}
283283

284-
self->send(self->bus, data_type, chip_select, data, data_length);
284+
self->send(self->bus, data_type | chip_select, data, data_length);
285285
displayio_display_core_end_transaction(self);
286286

287287
if (set_current_column_command != NO_COMMAND) {
288288
uint8_t command = set_current_column_command;
289289
displayio_display_core_begin_transaction(self);
290-
self->send(self->bus, DISPLAY_COMMAND, chip_select, &command, 1);
291-
self->send(self->bus, DISPLAY_DATA, chip_select, data, data_length / 2);
290+
self->send(self->bus, DISPLAY_COMMAND | chip_select, &command, 1);
291+
self->send(self->bus, DISPLAY_DATA | chip_select, data, data_length / 2);
292292
displayio_display_core_end_transaction(self);
293293
}
294294

@@ -298,7 +298,7 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self,
298298
data[0] = row_command;
299299
data_length = 1;
300300
if (!data_as_commands) {
301-
self->send(self->bus, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, data, 1);
301+
self->send(self->bus, DISPLAY_COMMAND | CHIP_SELECT_UNTOUCHED, data, 1);
302302
data_length = 0;
303303
}
304304

@@ -320,14 +320,14 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self,
320320
data_length = 1;
321321
}
322322

323-
self->send(self->bus, data_type, chip_select, data, data_length);
323+
self->send(self->bus, data_type | chip_select, data, data_length);
324324
displayio_display_core_end_transaction(self);
325325

326326
if (set_current_row_command != NO_COMMAND) {
327327
uint8_t command = set_current_row_command;
328328
displayio_display_core_begin_transaction(self);
329-
self->send(self->bus, DISPLAY_COMMAND, chip_select, &command, 1);
330-
self->send(self->bus, DISPLAY_DATA, chip_select, data, data_length / 2);
329+
self->send(self->bus, DISPLAY_COMMAND | chip_select, &command, 1);
330+
self->send(self->bus, DISPLAY_DATA | chip_select, data, data_length / 2);
331331
displayio_display_core_end_transaction(self);
332332
}
333333
}

0 commit comments

Comments
 (0)