Merge pull request #1685 from makermelissa/master
Added option to enable toggling CS between init commands
This commit is contained in:
commit
9ff54fdf72
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "shared-bindings/busio/SPI.h"
|
#include "shared-bindings/busio/SPI.h"
|
||||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||||
|
#include "shared-bindings/time/__init__.h"
|
||||||
|
|
||||||
#include "tick.h"
|
#include "tick.h"
|
||||||
|
|
||||||
|
@ -78,6 +79,11 @@ bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t obj) {
|
||||||
|
|
||||||
void common_hal_displayio_fourwire_send(mp_obj_t obj, bool command, uint8_t *data, uint32_t data_length) {
|
void common_hal_displayio_fourwire_send(mp_obj_t obj, bool command, uint8_t *data, uint32_t data_length) {
|
||||||
displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj);
|
displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj);
|
||||||
|
if (command) {
|
||||||
|
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
|
||||||
|
common_hal_time_delay_ms(1);
|
||||||
|
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
|
||||||
|
}
|
||||||
common_hal_digitalio_digitalinout_set_value(&self->command, !command);
|
common_hal_digitalio_digitalinout_set_value(&self->command, !command);
|
||||||
common_hal_busio_spi_write(self->bus, data, data_length);
|
common_hal_busio_spi_write(self->bus, data, data_length);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue