diff options
| author | JF <jf@codingfield.com> | 2020-01-26 12:37:10 (GMT) |
|---|---|---|
| committer | JF <jf@codingfield.com> | 2020-01-26 12:37:10 (GMT) |
| commit | 5fa4f5abe0b752bb2d990378e02d6424a1d1b661 (patch) | |
| tree | bc2e731c488573d678aec1d388a00f754b24fb02 /src/Components/Gfx/Gfx.h | |
| parent | eb7a1b3ac9cbacb74afb7fcd1d40c51a18c90060 (diff) | |
Better integration of SPI with DMA and IRQ. Using only 'End' IRQ. Perf could be improved by using 'Started' IRQ to prepare the next buffer while the current one is beeing sent.
Diffstat (limited to 'src/Components/Gfx/Gfx.h')
| -rw-r--r-- | src/Components/Gfx/Gfx.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/Components/Gfx/Gfx.h b/src/Components/Gfx/Gfx.h index d872870..81c5f38 100644 --- a/src/Components/Gfx/Gfx.h +++ b/src/Components/Gfx/Gfx.h @@ -1,6 +1,7 @@ #pragma once #include <cstdint> #include <nrf_font.h> +#include <drivers/BufferProvider.h> namespace Pinetime { @@ -8,7 +9,7 @@ namespace Pinetime { class St7789; } namespace Components { - class Gfx { + class Gfx : public Pinetime::Drivers::BufferProvider { public: explicit Gfx(Drivers::St7789& lcd); void Init(); @@ -19,11 +20,26 @@ namespace Pinetime { void Sleep(); void Wakeup(); + bool GetNextBuffer(uint8_t **buffer, size_t &size) override; private: static constexpr uint8_t width = 240; static constexpr uint8_t height = 240; + enum class Action { None, FillRectangle, DrawChar}; + struct State { + State() : busy{false}, action{Action::None}, remainingIterations{0}, currentIteration{0} {} + volatile bool busy; + volatile Action action; + volatile uint16_t remainingIterations; + volatile uint16_t currentIteration; + volatile FONT_INFO *font; + volatile uint16_t color; + volatile uint8_t character; + }; + + volatile State state; + uint16_t buffer[width]; // 1 line buffer Drivers::St7789& lcd; |
