SHARE
TWEET

Untitled

a guest Oct 19th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma once
  2.  
  3. #include "display_st7789v_constants.hpp"
  4.  
  5. #include <array>
  6. #include <utility>
  7. #include <cstddef>
  8. #include <memory>
  9.  
  10. namespace FrameBuffer
  11. {
  12.     using RowType = std::array<DisplayDriver::EncodedColor,120 >;
  13.     using FrameBufferType = std::array<RowType,120>;
  14.  
  15. class DisplayBuffer
  16. {
  17.  
  18.  
  19. public:
  20.  
  21.     using CoordsPair = std::pair<std::uint8_t,std::uint8_t>;
  22.  
  23.     static CoordsPair getFrameBufferCoords( std::uint16_t _realDisplayX, std::uint16_t _realDisplayY );
  24.  
  25. public:
  26.  
  27.     void drawPixel(
  28.             std::uint8_t _x
  29.         ,   std::uint8_t _y
  30.         ,   DisplayDriver::Colors _color
  31.     );
  32.  
  33.     void fillColor( DisplayDriver::Colors _color );
  34.  
  35.     void fillRectangle(
  36.             std::uint8_t _x
  37.         ,   std::uint8_t _y
  38.         ,   std::uint8_t _width
  39.         ,   std::uint8_t _height
  40.         ,   DisplayDriver::Colors _color
  41.     );
  42.  
  43. public:
  44.  
  45.     const RowType& getNextTransmissionRow();
  46.  
  47.     bool isAllBufferTransmitted();
  48.  
  49. private:
  50.  
  51.     static constexpr std::uint8_t RowRepeatsCount = 4; // Number of repeating bufferTransmissions;
  52.  
  53.     std::uint8_t getTranmissionRowIndex();
  54.  
  55. private:
  56.  
  57.     static FrameBufferType DisplayFrameBuffer;
  58.  
  59.     std::uint8_t m_changedRowsBegin;
  60.     std::uint8_t m_changedRowsEnd;
  61.  
  62.     std::uint8_t m_rowTranmisionsCount;
  63. };
  64.  
  65. std::unique_ptr<DisplayBuffer> createFrameBuffer();
  66.  
  67. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top