aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/gfx/Gfx.h
diff options
context:
space:
mode:
authorJoaquim <joaquim.org@gmail.com>2021-04-26 21:29:48 +0100
committerJoaquim <joaquim.org@gmail.com>2021-04-26 21:29:48 +0100
commitcd0d85dff95bbc5f285d92eb78a642aab1ae4b8b (patch)
treefc568aa2516c8c64cc55eb0d08e9a929c11b454a /src/components/gfx/Gfx.h
parent5fc07a8df7d18d1fa9c4971f2c7b69ea68db559b (diff)
parenteedff2c06c292bda8dcb92fc04c67097fe72e22f (diff)
Merge branch 'develop' of
https://github.com/JF002/InfiniTime into StepsApp
Diffstat (limited to 'src/components/gfx/Gfx.h')
-rw-r--r--src/components/gfx/Gfx.h73
1 files changed, 36 insertions, 37 deletions
diff --git a/src/components/gfx/Gfx.h b/src/components/gfx/Gfx.h
index 4c0fc8ee..54c4a8b7 100644
--- a/src/components/gfx/Gfx.h
+++ b/src/components/gfx/Gfx.h
@@ -12,49 +12,48 @@ namespace Pinetime {
}
namespace Components {
class Gfx : public Pinetime::Drivers::BufferProvider {
- public:
- explicit Gfx(Drivers::St7789& lcd);
- void Init();
- void ClearScreen();
- void DrawString(uint8_t x, uint8_t y, uint16_t color, const char* text, const FONT_INFO *p_font, bool wrap);
- void DrawChar(const FONT_INFO *font, uint8_t c, uint8_t *x, uint8_t y, uint16_t color);
- void FillRectangle(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint16_t color);
- void FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t* b);
- void SetScrollArea(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines);
- void SetScrollStartLine(uint16_t line);
+ public:
+ explicit Gfx(Drivers::St7789& lcd);
+ void Init();
+ void ClearScreen();
+ void DrawString(uint8_t x, uint8_t y, uint16_t color, const char* text, const FONT_INFO* p_font, bool wrap);
+ void DrawChar(const FONT_INFO* font, uint8_t c, uint8_t* x, uint8_t y, uint16_t color);
+ void FillRectangle(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint16_t color);
+ void FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t* b);
+ void SetScrollArea(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines);
+ void SetScrollStartLine(uint16_t line);
+ void Sleep();
+ void Wakeup();
+ bool GetNextBuffer(uint8_t** buffer, size_t& size) override;
+ void pixel_draw(uint8_t x, uint8_t y, uint16_t color);
- void Sleep();
- void Wakeup();
- bool GetNextBuffer(uint8_t **buffer, size_t &size) override;
- void pixel_draw(uint8_t x, uint8_t y, uint16_t color);
+ 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 TaskHandle_t taskToNotify = nullptr;
+ };
- private:
- static constexpr uint8_t width = 240;
- static constexpr uint8_t height = 240;
+ volatile State state;
- 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 TaskHandle_t taskToNotify = nullptr;
- };
+ uint16_t buffer[width]; // 1 line buffer
+ Drivers::St7789& lcd;
- volatile State state;
-
- uint16_t buffer[width]; // 1 line buffer
- Drivers::St7789& lcd;
-
- void SetBackgroundColor(uint16_t color);
- void WaitTransferFinished() const;
- void NotifyEndOfTransfer(TaskHandle_t task);
+ void SetBackgroundColor(uint16_t color);
+ void WaitTransferFinished() const;
+ void NotifyEndOfTransfer(TaskHandle_t task);
};
}
}