This commit is contained in:
Zuckerberg 2023-11-13 22:07:23 -07:00
parent cbf2e228b8
commit 8aca70574f
4 changed files with 180 additions and 181 deletions

View File

@ -15,10 +15,10 @@ lib_dir = lib
platform = espressif32 platform = espressif32
board = tinypico board = tinypico
framework = arduino framework = arduino
build_flags = -DEPD7IN3F build_flags = -DCOLOR7 -DEPD7IN3F
[env:tinypico-16gray] [env:tinypico-16gray]
platform = espressif32 platform = espressif32
board = tinypico board = tinypico
framework = arduino framework = arduino
build_flags = -DIT8951 build_flags = -DGREY16

View File

@ -0,0 +1,70 @@
#ifdef COLOR7
#include "epd7in3f.h"
#define DISPLAY_WIDTH 800
#define DISPLAY_HEIGHT 480
#define BUSY_PIN 26
#define RST_PIN 27
#define DC_PIN 15
#define CS_PIN 14
const char *einkDisplayProperties = R"json(
{
"width": 800,
"height": 480,
"color_space": [
{
"rgb_color": [0, 0, 0],
"color_code": 0
},
{
"rgb_color": [1, 1, 1],
"color_code": 1
},
{
"rgb_color": [0.059, 0.329, 0.119],
"color_code": 2
},
{
"rgb_color": [0.061, 0.147, 0.336],
"color_code": 3
},
{
"rgb_color": [0.574, 0.066, 0.010],
"color_code": 4
},
{
"rgb_color": [0.982, 0.756, 0.004],
"color_code": 5
},
{
"rgb_color": [0.795, 0.255, 0.018],
"color_code": 6
}
]
}
)json";
Epd epd(DISPLAY_WIDTH, DISPLAY_HEIGHT, BUSY_PIN, RST_PIN, DC_PIN, CS_PIN);
void initDisplay()
{
if (epd.Init() != 0)
{
Serial.print("e-Paper init failed");
return;
}
}
void drawImage(uint8_t *image)
{
Serial.print("Wake up display\n");
epd.Reset();
Serial.print("Draw image\n");
epd.EPD_7IN3F_Display(image);
Serial.print("Put display to sleep\n");
epd.Sleep();
}
#endif

View File

@ -0,0 +1,106 @@
#ifdef GREY16
#define MISO 23
#define MOSI 19
#define SCK 18
#define CS 14
#define RESET 15
#define HRDY 27
#include "it8951.h"
#define DISPLAY_WIDTH 1872
#define DISPLAY_HEIGHT 1404
const char *einkDisplayProperties = R"json(
{
"width": 1872,
"height": 1404,
"flip_horizonal": true,
"color_space": [
{
"color_code": 0,
"rgb_color": [0.0, 0.0, 0.0]
},
{
"color_code": 1,
"rgb_color": [0.06666666666666667, 0.06666666666666667, 0.06666666666666667]
},
{
"color_code": 2,
"rgb_color": [0.13333333333333333, 0.13333333333333333, 0.13333333333333333]
},
{
"color_code": 3,
"rgb_color": [0.2, 0.2, 0.2]
},
{
"color_code": 4,
"rgb_color": [0.26666666666666666, 0.26666666666666666, 0.26666666666666666]
},
{
"color_code": 5,
"rgb_color": [0.3333333333333333, 0.3333333333333333, 0.3333333333333333]
},
{
"color_code": 6,
"rgb_color": [0.4, 0.4, 0.4]
},
{
"color_code": 7,
"rgb_color": [0.4666666666666667, 0.4666666666666667, 0.4666666666666667]
},
{
"color_code": 8,
"rgb_color": [0.5333333333333333, 0.5333333333333333, 0.5333333333333333]
},
{
"color_code": 9,
"rgb_color": [0.6, 0.6, 0.6]
},
{
"color_code": 10,
"rgb_color": [0.6666666666666666, 0.6666666666666666, 0.6666666666666666]
},
{
"color_code": 11,
"rgb_color": [0.7333333333333333, 0.7333333333333333, 0.7333333333333333]
},
{
"color_code": 12,
"rgb_color": [0.8, 0.8, 0.8]
},
{
"color_code": 13,
"rgb_color": [0.8666666666666667, 0.8666666666666667, 0.8666666666666667]
},
{
"color_code": 14,
"rgb_color": [0.9333333333333333, 0.9333333333333333, 0.9333333333333333]
},
{
"color_code": 15,
"rgb_color": [1.0, 1.0, 1.0]
}
]
}
)json";
void initDisplay()
{
IT8951_Init();
}
void drawImage(uint8_t *image)
{
gpFrameBuf = image;
Serial.println("Sending image");
IT8951_BMP_Example(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT);
Serial.println("Displaying image");
IT8951DisplayArea(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT, 2);
Serial.println("Waiting for display ...");
LCDWaitForReady();
Serial.println("done");
}
#endif

View File

@ -1,181 +1,4 @@
#include <Arduino.h> #include <Arduino.h>
#ifdef EPD7IN3F #include "displays/grey16.h"
#include "displays/color7.h"
#include "epd7in3f.h"
#define DISPLAY_WIDTH 800
#define DISPLAY_HEIGHT 480
#define BUSY_PIN 26
#define RST_PIN 27
#define DC_PIN 15
#define CS_PIN 14
const char *einkDisplayProperties = R"json(
{
"width": 800,
"height": 480,
"color_space": [
{
"rgb_color": [0, 0, 0],
"color_code": 0
},
{
"rgb_color": [1, 1, 1],
"color_code": 1
},
{
"rgb_color": [0.059, 0.329, 0.119],
"color_code": 2
},
{
"rgb_color": [0.061, 0.147, 0.336],
"color_code": 3
},
{
"rgb_color": [0.574, 0.066, 0.010],
"color_code": 4
},
{
"rgb_color": [0.982, 0.756, 0.004],
"color_code": 5
},
{
"rgb_color": [0.795, 0.255, 0.018],
"color_code": 6
}
]
}
)json";
Epd epd(DISPLAY_WIDTH, DISPLAY_HEIGHT, BUSY_PIN, RST_PIN, DC_PIN, CS_PIN);
void initDisplay()
{
if (epd.Init() != 0)
{
Serial.print("e-Paper init failed");
return;
}
}
void drawImage(uint8_t *image)
{
// Serial.print("Wake up display\n");
// epd.Reset();
// Serial.print("Clear display\n");
// epd.Clear(EPD_7IN3F_WHITE);
Serial.print("Draw image\n");
epd.EPD_7IN3F_Display(image);
Serial.print("Put display to sleep\n");
epd.Sleep();
}
#endif
#ifdef IT8951
#define MISO 23
#define MOSI 19
#define SCK 18
#define CS 14
#define RESET 15
#define HRDY 27
#include "it8951.h"
#define DISPLAY_WIDTH 1872
#define DISPLAY_HEIGHT 1404
const char *einkDisplayProperties = R"json(
{
"width": 1872,
"height": 1404,
"flip_horizonal": true,
"color_space": [
{
"color_code": 0,
"rgb_color": [0.0, 0.0, 0.0]
},
{
"color_code": 1,
"rgb_color": [0.06666666666666667, 0.06666666666666667, 0.06666666666666667]
},
{
"color_code": 2,
"rgb_color": [0.13333333333333333, 0.13333333333333333, 0.13333333333333333]
},
{
"color_code": 3,
"rgb_color": [0.2, 0.2, 0.2]
},
{
"color_code": 4,
"rgb_color": [0.26666666666666666, 0.26666666666666666, 0.26666666666666666]
},
{
"color_code": 5,
"rgb_color": [0.3333333333333333, 0.3333333333333333, 0.3333333333333333]
},
{
"color_code": 6,
"rgb_color": [0.4, 0.4, 0.4]
},
{
"color_code": 7,
"rgb_color": [0.4666666666666667, 0.4666666666666667, 0.4666666666666667]
},
{
"color_code": 8,
"rgb_color": [0.5333333333333333, 0.5333333333333333, 0.5333333333333333]
},
{
"color_code": 9,
"rgb_color": [0.6, 0.6, 0.6]
},
{
"color_code": 10,
"rgb_color": [0.6666666666666666, 0.6666666666666666, 0.6666666666666666]
},
{
"color_code": 11,
"rgb_color": [0.7333333333333333, 0.7333333333333333, 0.7333333333333333]
},
{
"color_code": 12,
"rgb_color": [0.8, 0.8, 0.8]
},
{
"color_code": 13,
"rgb_color": [0.8666666666666667, 0.8666666666666667, 0.8666666666666667]
},
{
"color_code": 14,
"rgb_color": [0.9333333333333333, 0.9333333333333333, 0.9333333333333333]
},
{
"color_code": 15,
"rgb_color": [1.0, 1.0, 1.0]
}
]
}
)json";
void initDisplay()
{
IT8951_Init();
}
void drawImage(uint8_t *image)
{
gpFrameBuf = image;
Serial.println("Sending image");
IT8951_BMP_Example(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT);
Serial.println("Displaying image");
IT8951DisplayArea(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT, 2);
Serial.println("Waiting for display ...");
LCDWaitForReady();
Serial.println("done");
}
#endif