Merge pull request #1685 from makermelissa/master

Added option to enable toggling CS between init commands
This commit is contained in:
Scott Shawcroft 2019-03-28 09:45:01 -07:00 committed by GitHub
commit 9ff54fdf72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,7 @@
#include "shared-bindings/busio/SPI.h"
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/time/__init__.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) {
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_busio_spi_write(self->bus, data, data_length);
}