summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-09-25 15:22:37 +1000
committerjacqueline <me@jacqueline.id.au>2023-09-25 15:22:37 +1000
commit7ffeea4009357cbeed616d4236d57fd4dde12ba8 (patch)
treed65ec4461763f815a0747ea72990cf6870f6f392
parent41c4dce79aef47017c237b572a2d2eb85b78c028 (diff)
downloadtangara-fw-7ffeea4009357cbeed616d4236d57fd4dde12ba8.tar.gz
Don't acquire the spi bus in the display driver
Interrupt-based transactions don't need it, and it causes issues.
-rw-r--r--src/drivers/display.cpp15
1 files changed, 0 insertions, 15 deletions
diff --git a/src/drivers/display.cpp b/src/drivers/display.cpp
index b4889b4b..48310074 100644
--- a/src/drivers/display.cpp
+++ b/src/drivers/display.cpp
@@ -202,10 +202,6 @@ auto Display::SetDutyCycle(uint_fast8_t new_duty, bool fade) -> void {
}
void Display::SendInitialisationSequence(const uint8_t* data) {
- // Hold onto the bus for the entire sequence so that we're not interrupted
- // part way through.
- spi_device_acquire_bus(handle_, portMAX_DELAY);
-
// First byte of the data is the number of commands.
for (int i = *(data++); i > 0; i--) {
uint8_t command = *(data++);
@@ -222,14 +218,9 @@ void Display::SendInitialisationSequence(const uint8_t* data) {
sleep_duration_ms = 500;
}
- // Avoid hanging on to the bus whilst delaying.
- spi_device_release_bus(handle_);
vTaskDelay(pdMS_TO_TICKS(sleep_duration_ms));
- spi_device_acquire_bus(handle_, portMAX_DELAY);
}
}
-
- spi_device_release_bus(handle_);
}
void Display::SendCommandWithData(uint8_t command,
@@ -284,10 +275,6 @@ void Display::SendTransaction(TransactionType type,
void Display::OnLvglFlush(lv_disp_drv_t* disp_drv,
const lv_area_t* area,
lv_color_t* color_map) {
- // Ideally we want to complete a single flush as quickly as possible, so
- // grab the bus for this entire transaction sequence.
- spi_device_acquire_bus(handle_, portMAX_DELAY);
-
// First we need to specify the rectangle of the display we're writing into.
uint16_t data[2] = {0, 0};
@@ -306,8 +293,6 @@ void Display::OnLvglFlush(lv_disp_drv_t* disp_drv,
SendCommandWithData(displays::ST77XX_RAMWR,
reinterpret_cast<uint8_t*>(color_map), size * 2);
- spi_device_release_bus(handle_);
-
lv_disp_flush_ready(&driver_);
}