8000 Simplified into fourwire only · mimoccc/circuitpython@f3ec051 · GitHub
[go: up one dir, main page]

Skip to content

Commit f3ec051

Browse files
author
Melissa LeBlanc-Williams
committed
Simplified into fourwire only
1 parent 2f7b338 commit f3ec051

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

shared-bindings/displayio/FourWire.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,4 @@ void common_hal_displayio_fourwire_send(mp_obj_t self, bool command, uint8_t *da
4747

4848
void common_hal_displayio_fourwire_end_transaction(mp_obj_t self);
4949

50-
void common_hal_displayio_fourwire_set_cs(mp_obj_t self, bool high);
51-
5250
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_FOURWIRE_H

shared-module/displayio/Display.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,10 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
5959
self->begin_transaction = common_hal_displayio_parallelbus_begin_transaction;
6060
self->send = common_hal_displayio_parallelbus_send;
6161
self->end_transaction = common_hal_displayio_parallelbus_end_transaction;
62-
self->set_cs = NULL;
6362
} else if (MP_OBJ_IS_TYPE(bus, &displayio_fourwire_type)) {
6463
self->begin_transaction = common_hal_displayio_fourwire_begin_transaction;
6564
self->send = common_hal_displayio_fourwire_send;
6665
self->end_transaction = common_hal_displayio_fourwire_end_transaction;
67-
self->set_cs = common_hal_displayio_fourwire_set_cs;
6866
} else {
6967
mp_raise_ValueError(translate("Unsupported display bus type"));
7068
}
@@ -82,11 +80,6 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
8280
bool delay = (data_size & DELAY) != 0;
8381
data_size &= ~DELAY;
8482
uint8_t *data = cmd + 2;
85-
if (self->set_cs != NULL) {
86-
self->set_cs(self->bus, true);
87-
common_hal_time_delay_ms(1);
88-
self->set_cs(self->bus, false);
89-
}
9083
self->send(self->bus, true, cmd, 1);
9184
self->send(self->bus, false, data, data_size);
9285
uint16_t delay_length_ms = 10;

shared-module/displayio/Display.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
typedef bool (*display_bus_begin_transaction)(mp_obj_t bus);
3535
typedef void (*display_bus_send)(mp_obj_t bus, bool command, uint8_t *data, uint32_t data_length);
3636
typedef void (*display_bus_end_transaction)(mp_obj_t bus);
37-
typedef void (*display_bus_set_cs)(mp_obj_t bus, bool high);
3837

3938
typedef struct {
4039
mp_obj_base_t base;
@@ -53,7 +52,6 @@ typedef struct {
5352
display_bus_begin_transaction begin_transaction;
5453
display_bus_send send;
5554
display_bus_end_transaction end_transaction;
56-
display_bus_set_cs set_cs;
5755
union {
5856
digitalio_digitalinout_obj_t backlight_inout;
5957
pulseio_pwmout_obj_t backlight_pwm;

shared-module/displayio/FourWire.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include "shared-bindings/busio/SPI.h"
3232
#include "shared-bindings/digitalio/DigitalInOut.h"
33+
#include "shared-bindings/time/__init__.h"
3334

3435
#include "tick.h"
3536

@@ -78,6 +79,11 @@ bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t obj) {
7879

7980
void common_hal_displayio_fourwire_send(mp_obj_t obj, bool command, uint8_t *data, uint32_t data_length) {
8081
displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj);
82+
if (command) {
83+
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
84+
common_hal_time_delay_ms(1);
85+
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
86+
}
8187
common_hal_digitalio_digitalinout_set_value(&self->command, !command);
8288
common_hal_busio_spi_write(self->bus, data, data_length);
8389
}
@@ -87,8 +93,3 @@ void common_hal_displayio_fourwire_end_transaction(mp_obj_t obj) {
8793
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
8894
common_hal_busio_spi_unlock(self->bus);
8995
}
90-
91-
void common_hal_displayio_fourwire_set_cs(mp_obj_t obj, bool high) {
92-
displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj);
93-
common_hal_digitalio_digitalinout_set_value(&self->chip_select, high);
94-
}

0 commit comments

Comments
 (0)
0