#include class LGFX : public lgfx::LGFX_Device { lgfx::Panel_ST7796 _panel_instance; lgfx::Bus_SPI _bus_instance; lgfx::Light_PWM _light_instance; lgfx::Touch_XPT2046 _touch_instance; public: LGFX(void) { { auto cfg = _bus_instance.config(); // SPIバスの設定 cfg.spi_host = HSPI_HOST; cfg.spi_mode = 0; cfg.freq_write = 40000000; cfg.freq_read = 16000000; cfg.spi_3wire = false; // true x cfg.use_lock = true; cfg.dma_channel = SPI_DMA_CH_AUTO; cfg.pin_sclk = 14; // 変更 cfg.pin_mosi = 13; // 変更 cfg.pin_miso = 12; // 変更 cfg.pin_dc = 2; // 変更 _bus_instance.config(cfg); _panel_instance.setBus(&_bus_instance); } { auto cfg = _panel_instance.config(); cfg.pin_cs = 15; // 変更 cfg.pin_rst = -1; // 変更 cfg.pin_busy = -1; // 変更 cfg.panel_width = 320; cfg.panel_height = 480; cfg.offset_x = 0; cfg.offset_y = 0; cfg.offset_rotation = 0; cfg.dummy_read_pixel = 8; cfg.dummy_read_bits = 1; cfg.readable = true; cfg.invert = false; cfg.rgb_order = false; cfg.dlen_16bit = false; cfg.bus_shared = true; // False OK _panel_instance.config(cfg); } { auto cfg = _light_instance.config(); cfg.pin_bl = 27; // 変更 cfg.invert = false; cfg.freq = 1200; cfg.pwm_channel = 7; _light_instance.config(cfg); _panel_instance.setLight(&_light_instance); } { auto cfg = _touch_instance.config(); cfg.x_min = 3875; // 変更 cfg.x_max = 250; // 変更 cfg.y_min = 165; // 変更 cfg.y_max = 3943; // 変更 cfg.pin_int = -1; // 変更 cfg.bus_shared = true; // 変更 cfg.offset_rotation = 0; // 変更 cfg.spi_host = HSPI_HOST; // 変更 cfg.freq = 1000000; cfg.pin_sclk = 14; // 変更 cfg.pin_mosi = 13; // 変更 cfg.pin_miso = 12; // 変更 cfg.pin_cs = 33; // 変更 _touch_instance.config(cfg); _panel_instance.setTouch(&_touch_instance); } setPanel(&_panel_instance); } }; LGFX display;