diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-02-22 10:28:11 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-02-22 10:28:11 +1100 |
| commit | fed7b450b36d0d0ce8c270127f9e9c3a22f1b699 (patch) | |
| tree | dc5f7e304ccaa707c8520eeda6d55da4e525b46e /src/drivers/include/display.hpp | |
| parent | 47ae601d417d0ef99eb6fe433ef695614d8d2786 (diff) | |
| download | tangara-fw-fed7b450b36d0d0ce8c270127f9e9c3a22f1b699.tar.gz | |
Fix up display artficacts and clean up unused features
Diffstat (limited to 'src/drivers/include/display.hpp')
| -rw-r--r-- | src/drivers/include/display.hpp | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/src/drivers/include/display.hpp b/src/drivers/include/display.hpp index 5f6d6f58..8157c3a5 100644 --- a/src/drivers/include/display.hpp +++ b/src/drivers/include/display.hpp @@ -1,6 +1,7 @@ #pragma once #include <cstdint> +#include <memory> #include "driver/spi_master.h" #include "lvgl/lvgl.h" @@ -8,32 +9,30 @@ #include "display_init.hpp" #include "gpio_expander.hpp" -#include "sys/_stdint.h" namespace drivers { /* - * Display driver for LVGL. + * LVGL display driver for ST77XX family displays. */ class Display { public: - enum Error {}; + /* + * Creates the display driver, and resets and reinitialises the display + * over SPI. This never fails, since unfortunately these display don't give + * us back any kind of signal to tell us we're actually using them correctly. + */ static auto create(GpioExpander* expander, const displays::InitialisationData& init_data) - -> cpp::result<std::unique_ptr<Display>, Error>; + -> std::unique_ptr<Display>; Display(GpioExpander* gpio, spi_device_handle_t handle); ~Display(); - void WriteData(); - - void Flush(lv_disp_drv_t* disp_drv, - const lv_area_t* area, - lv_color_t* color_map); - - void IRAM_ATTR PostTransaction(const spi_transaction_t& transaction); - - void ServiceTransactions(); + /* Driver callback invoked by LVGL when there is new data to display. */ + void OnLvglFlush(lv_disp_drv_t* disp_drv, + const lv_area_t* area, + lv_color_t* color_map); private: GpioExpander* gpio_; @@ -48,23 +47,15 @@ class Display { DATA = 1, }; - enum TransactionFlags { - LVGL_FLUSH = 1, - }; - void SendInitialisationSequence(const uint8_t* data); - void SendCommandWithData(uint8_t command, - const uint8_t* data, - size_t length, - uintptr_t flags = 0); + void SendCommandWithData(uint8_t command, const uint8_t* data, size_t length); + void SendCmd(const uint8_t* data, size_t length); + void SendData(const uint8_t* data, size_t length); - void SendCmd(const uint8_t* data, size_t length, uintptr_t flags = 0); - void SendData(const uint8_t* data, size_t length, uintptr_t flags = 0); void SendTransaction(TransactionType type, const uint8_t* data, - size_t length, - uint32_t flags = 0); + size_t length); }; } // namespace drivers |
