27-10-2023, 09:37
To ja już nie wiem co zle robie....
Kod:
#include"Arduino.h"
#include <GxEPD2_BW.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include "bitmaps/Bitmaps400x300.h"
#define ENABLE_GxEPD2_GFX 0
#define MAX_DISPLAY_BUFFER_SIZE 131072ul // e.g. half of available ram
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))
// Raspberry Pico W, pins:
static const uint8_t EPD_MISO = 19;
static const uint8_t EPD_DC = 16;
static const uint8_t EPD_CS = 17;
static const uint8_t EPD_SCK = 18;
static const uint8_t EPD_MOSI = 4; //gnd
static const uint8_t EPD_RST = 20;
static const uint8_t EPD_BUSY = 21;
#if defined(ARDUINO_ARCH_RP2040) && defined(ARDUINO_RASPBERRY_PI_PICO)
// SPI pins used by GoodDisplay DESPI-PICO. note: steals standard I2C pins PIN_WIRE_SDA (6), PIN_WIRE_SCL (7)
// uncomment next line for use with GoodDisplay DESPI-PICO. // MbedSPI(int miso, int mosi, int sck);
arduino::MbedSPI SPI0(EPD_MISO, EPD_MOSI, EPD_SCK); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
#endif
GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(EPD_CS, EPD_DC, EPD_RST, EPD_BUSY));
//#define GxEPD2_DRIVER_CLASS GxEPD2_420 // GDEW042T2 400x300, UC8176 (IL0398), (WFT042CZ15)
//#define GxEPD2_DRIVER_CLASS GxEPD2_420_M01 // GDEW042M01 400x300, UC8176 (IL0398), (WFT042CZ15)
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println("setup");
delay(100);
#if defined(ARDUINO_ARCH_RP2040) && defined(ARDUINO_RASPBERRY_PI_PICO)
// uncomment next line for use with GoodDisplay DESPI-PICO, or use the extended init method
display.epd2.selectSPI(SPI0, SPISettings(4000000, MSBFIRST, SPI_MODE0));
// uncomment next 2 lines to allow recovery from configuration failures
pinMode(15, INPUT_PULLUP); // safety pin
while (!digitalRead(15)) delay(100); // check safety pin for fail recovery
#endif
//display.init(115200); // default 10ms reset pulse, e.g. for bare panels with DESPI-C02
display.init(115200, true, 2, false); // USE THIS for Waveshare boards with "clever" reset circuit, 2ms reset pulse
//display.init(115200, true, 10, false, SPI0, SPISettings(4000000, MSBFIRST, SPI_MODE0)); // extended init method with SPI channel and/or settings selection
// first update should be full refresh
display.fillScreen(GxEPD_BLACK);
// display.setFullWindow();
// display.drawCircle(EPD_SCK, 14, 2, GxEPD_BLACK);
// display.display(false);
}
void loop(){
}