Advertisement
honey_the_codewitch

Lenna example

Mar 20th, 2022
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. #define LCD_WIDTH 135
  2. #define LCD_HEIGHT 240
  3. #define LCD_ROTATION 0
  4.  
  5. #define LCD_HOST    VSPI
  6. #define PIN_NUM_MISO -1
  7. #define PIN_NUM_MOSI 19
  8. #define PIN_NUM_CLK  18
  9. #define PIN_NUM_CS   5
  10.  
  11. #define PIN_NUM_DC   16
  12. #define PIN_NUM_RST  23
  13. #define PIN_NUM_BCKL 4
  14.  
  15. #include <Arduino.h>
  16. #include <tft_io.hpp>
  17. #include <st7789.hpp>
  18. #include <gfx_cpp14.hpp>
  19. #include "lenna.hpp"
  20. using namespace arduino;
  21. using namespace gfx;
  22.  
  23. using bus_type =tft_spi_ex<LCD_HOST,PIN_NUM_CS,PIN_NUM_MOSI,PIN_NUM_MISO,PIN_NUM_CLK,SPI_MODE0>;
  24. using lcd_type =st7789<LCD_WIDTH,LCD_HEIGHT,PIN_NUM_DC,PIN_NUM_RST,PIN_NUM_BCKL,bus_type,LCD_ROTATION,400,200>;
  25. lcd_type lcd;
  26. using colors = color<typename lcd_type::pixel_type>;
  27. void setup() {
  28.     Serial.begin(115200);
  29.     draw::filled_rectangle(lcd,(srect16)lcd.bounds(),colors::white);
  30.     Lenna_stream.seek(0); // not necessary, but if we loaded it twice it would be.
  31.     draw::image(lcd,(srect16)lcd.bounds(),&Lenna_stream);
  32.    
  33. }
  34. void loop() {
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement