LCOV - code coverage report
Current view: top level - src/Display - DisplayInterface.hpp (source / functions) Hit Total Coverage
Test: 3aaab29ec58d6e71a20fde08a40531cf32318591 Lines: 0 5 0.0 %
Date: 2024-05-18 12:29:05 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <AH/Containers/LinkedList.hpp>
       4             : #include <Def/Def.hpp>
       5             : #include <Print.h>
       6             : 
       7             : BEGIN_CS_NAMESPACE
       8             : 
       9             : /**
      10             :  * @brief   An interface for displays. 
      11             :  * 
      12             :  * Inspired by the Adafruit GFX library for easy compatibility.
      13             :  *
      14             :  * @ingroup DisplayElements
      15             :  */
      16             : class DisplayInterface : public Print {
      17             :   protected:
      18             :     DisplayInterface() = default;
      19             : 
      20             :   public:
      21             :     virtual ~DisplayInterface() = default;
      22             : 
      23             :     /// Initialize the display.
      24             :     virtual void begin();
      25             : 
      26             :     /// Clear the frame buffer or clear the display.
      27             :     virtual void clear() = 0;
      28             :     /// Draw a custom background.
      29           0 :     virtual void drawBackground() {}
      30             :     /// Write the frame buffer to the display. If your display library writes to
      31             :     /// the display directly, without a display buffer in RAM, you can leave
      32             :     /// this function empty.
      33             :     virtual void display() = 0;
      34             : 
      35             :     /// Paint a single pixel with the given color.
      36             :     virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
      37             : 
      38             :     /// Set the text color.
      39             :     virtual void setTextColor(uint16_t color) = 0;
      40             :     /// Set the text size.
      41             :     virtual void setTextSize(uint8_t size) = 0;
      42             :     /// Set the cursor position.
      43             :     virtual void setCursor(int16_t x, int16_t y) = 0;
      44             : 
      45             :     /**
      46             :      * @brief   Write a character to the display.
      47             :      * 
      48             :      * @see     setCursor
      49             :      * @see     setTextSize
      50             :      * @see     setTextColor
      51             :      */
      52             :     size_t write(uint8_t c) override = 0;
      53             : 
      54             :     /// Draw a line between two points.
      55             :     virtual void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
      56             :                           uint16_t color) = 0;
      57             :     /// Draw a vertical line.
      58             :     virtual void drawFastVLine(int16_t x, int16_t y, int16_t h,
      59             :                                uint16_t color) = 0;
      60             :     /// Draw a horizontal line.
      61             :     virtual void drawFastHLine(int16_t x, int16_t y, int16_t w,
      62             :                                uint16_t color) = 0;
      63             : 
      64             :     /// Draw a bitmap to the display.
      65             :     virtual void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
      66             :                              int16_t w, int16_t h, uint16_t color) = 0;
      67             : 
      68             :     /// Draw a filled rectangle.
      69             :     virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
      70             :                           uint16_t color);
      71             : 
      72             :     /// Draw a circle.
      73             :     virtual void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
      74             : 
      75             :     /// Draw a disk (filled circle).
      76             :     virtual void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
      77             : 
      78             :     /**
      79             :      * @brief   Clear the frame buffer, and draw the custom background.
      80             :      * @see    clear
      81             :      * @see    drawBackground
      82             :      */
      83           0 :     void clearAndDrawBackground() {
      84           0 :         clear();
      85           0 :         drawBackground();
      86           0 :     }
      87             : };
      88             : 
      89             : END_CS_NAMESPACE

Generated by: LCOV version 1.15