Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduino.h>
- #include <tft_io.hpp>
- #include <ili9341.hpp>
- #include <gfx_cpp14.hpp>
- using namespace arduino;
- using namespace gfx;
- #define LCD_HOST VSPI
- #define PIN_NUM_MISO 25
- #define PIN_NUM_MOSI 23
- #define PIN_NUM_CLK 19
- #define PIN_NUM_CS 22
- #define PIN_NUM_DC 21
- #define PIN_NUM_RST 18
- #define PIN_NUM_BCKL 5
- using bus_t = tft_spi_ex<VSPI,PIN_NUM_CS,PIN_NUM_MOSI,PIN_NUM_MISO,PIN_NUM_CLK,SPI_MODE0,false,320*240*2+8,2>;
- using lcd_t = ili9341<PIN_NUM_DC,PIN_NUM_RST,PIN_NUM_BCKL,bus_t,1,false,400,200>;
- lcd_t lcd;
- float hue;
- void setup() {
- Serial.begin(115200);
- hue = 0.0;
- }
- void loop() {
- hsv_pixel<24> px(true,hue,1,1);
- auto px2 = px;
- // batching is the fastest way
- auto ba = draw::batch_async(lcd,lcd.bounds());
- for(int y = 0;y<lcd.dimensions().height;++y) {
- px2.template channelr<channel_name::S>(((double)y)/lcd.bounds().y2);
- for(int x = 0;x<lcd.dimensions().width;++x) {
- px2.template channelr<channel_name::V>(((double)x)/lcd.bounds().x2);
- ba.write(px2);
- }
- }
- // commit what we wrote
- ba.commit();
- hue+=.1;
- if(hue>1.0) {
- hue = 0.0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement