Skip to content

Instantly share code, notes, and snippets.

@yamamaya
Created March 26, 2021 09:33
Show Gist options
  • Save yamamaya/abb2481f4cbbe2d54a6f624b1b8440f2 to your computer and use it in GitHub Desktop.
Save yamamaya/abb2481f4cbbe2d54a6f624b1b8440f2 to your computer and use it in GitHub Desktop.
WT32-SC01 with LovyanGFX
#include <LovyanGFX.hpp>
struct LGFX_Config {
static constexpr spi_host_device_t spi_host = HSPI_HOST;
static constexpr int dma_channel = 1;
static constexpr int spi_sclk = 14;
static constexpr int spi_mosi = 13;
static constexpr int spi_miso = -1;
static constexpr int spi_dlen = 8;
};
static lgfx::LGFX_SPI<LGFX_Config> lcd;
static lgfx::Panel_ST7796 panel;
void setup() {
panel.freq_write = 20000000;
panel.freq_fill = 27000000;
panel.freq_read = 16000000;
panel.spi_mode = 0;
panel.spi_mode_read = 0;
panel.len_dummy_read_pixel = 8;
panel.spi_read = false;
panel.spi_3wire = false;
panel.spi_cs = 15;
panel.spi_dc = 21;
panel.gpio_rst = 22;
panel.gpio_bl = 23;
panel.backlight_level = true;
panel.memory_width = 320;
panel.memory_height = 480;
panel.panel_width = 320;
panel.panel_height = 480;
panel.offset_x = 0;
panel.offset_y = 0;
panel.rotation = 1;
panel.offset_rotation = 0;
lcd.setPanel(&panel);
lcd.init();
lcd.clear( TFT_BLUE );
lcd.setCursor( 0, 0 );
lcd.setFont( &fonts::lgfxJapanGothic_20 );
lcd.print( "にゃーん" );
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment