diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-05-02 21:52:59 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-05-02 21:52:59 +1000 |
| commit | 26eb580043ad176bdc58d996f30d470e1073ef00 (patch) | |
| tree | e499b1115108effe91c961452c1ee101d07beeac /src/drivers/include/display.hpp | |
| parent | 7d7f7755d17e1e0a2348d75d797097f166b70471 (diff) | |
| download | tangara-fw-26eb580043ad176bdc58d996f30d470e1073ef00.tar.gz | |
move driver includes into a subdir as well
Diffstat (limited to 'src/drivers/include/display.hpp')
| -rw-r--r-- | src/drivers/include/display.hpp | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/src/drivers/include/display.hpp b/src/drivers/include/display.hpp deleted file mode 100644 index d2e18a5c..00000000 --- a/src/drivers/include/display.hpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2023 jacqueline <me@jacqueline.id.au> - * - * SPDX-License-Identifier: GPL-3.0-only - */ - -#pragma once - -#include <stdint.h> -#include <cstdint> -#include <memory> - -#include "driver/spi_master.h" -#include "lvgl/lvgl.h" -#include "result.hpp" -#include "tasks.hpp" - -#include "display_init.hpp" -#include "gpios.hpp" - -namespace drivers { - -/* - * LVGL display driver for ST77XX family displays. - */ -class Display { - public: - /* - * 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(IGpios& expander, - const displays::InitialisationData& init_data) -> Display*; - - Display(IGpios& gpio, spi_device_handle_t handle); - ~Display(); - - auto SetDisplayOn(bool) -> void; - auto SetBrightness(uint_fast8_t) -> void; - - /* 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); - - // Not copyable or movable. - Display(const Display&) = delete; - Display& operator=(const Display&) = delete; - - private: - IGpios& gpio_; - spi_device_handle_t handle_; - - bool first_flush_finished_; - bool display_on_; - uint_fast8_t brightness_; - - lv_disp_draw_buf_t buffers_; - lv_disp_drv_t driver_; - lv_disp_t* display_ = nullptr; - - enum TransactionType { - COMMAND = 0, - DATA = 1, - }; - - void SendInitialisationSequence(const uint8_t* data); - - 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 SendTransaction(TransactionType type, - const uint8_t* data, - size_t length); - - auto SetDutyCycle(uint_fast8_t, bool) -> void; -}; - -} // namespace drivers |
