2020.05.22
This commit is contained in:
parent
8973995e53
commit
853a3a4632
224 changed files with 26246 additions and 3145 deletions
|
|
@ -1,32 +1,92 @@
|
|||
#include <SPI.h>
|
||||
#include "epd1in54_V2.h"
|
||||
#include "imagedata.h"
|
||||
#include "epdpaint.h"
|
||||
#include <stdio.h>
|
||||
|
||||
Epd epd;
|
||||
unsigned char image[1024];
|
||||
Paint paint(image, 0, 0);
|
||||
|
||||
unsigned long time_start_ms;
|
||||
unsigned long time_now_s;
|
||||
#define COLORED 0
|
||||
#define UNCOLORED 1
|
||||
|
||||
void setup()
|
||||
{
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(9600);
|
||||
if (epd.Init() != 0) {
|
||||
Serial.println("e-Paper init failed");
|
||||
return;
|
||||
}
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(9600);
|
||||
Serial.println("e-Paper init and clear");
|
||||
epd.LDirInit();
|
||||
epd.Clear();
|
||||
|
||||
Serial.println("e-Paper clear");
|
||||
epd.Clear();
|
||||
paint.SetWidth(200);
|
||||
paint.SetHeight(24);
|
||||
|
||||
Serial.println("e-Paper show pic");
|
||||
epd.Display(IMAGE_DATA);
|
||||
Serial.println("e-Paper paint");
|
||||
paint.Clear(COLORED);
|
||||
paint.DrawStringAt(30, 4, "Hello world!", &Font16, UNCOLORED);
|
||||
epd.SetFrameMemory(paint.GetImage(), 0, 10, paint.GetWidth(), paint.GetHeight());
|
||||
|
||||
Serial.println("e-Paper clear and sleep");
|
||||
epd.Clear();
|
||||
epd.Sleep();
|
||||
paint.Clear(UNCOLORED);
|
||||
paint.DrawStringAt(30, 4, "e-Paper Demo", &Font16, COLORED);
|
||||
epd.SetFrameMemory(paint.GetImage(), 0, 30, paint.GetWidth(), paint.GetHeight());
|
||||
|
||||
paint.SetWidth(64);
|
||||
paint.SetHeight(64);
|
||||
|
||||
paint.Clear(UNCOLORED);
|
||||
paint.DrawRectangle(0, 0, 40, 50, COLORED);
|
||||
paint.DrawLine(0, 0, 40, 50, COLORED);
|
||||
paint.DrawLine(40, 0, 0, 50, COLORED);
|
||||
epd.SetFrameMemory(paint.GetImage(), 16, 60, paint.GetWidth(), paint.GetHeight());
|
||||
|
||||
paint.Clear(UNCOLORED);
|
||||
paint.DrawCircle(32, 32, 30, COLORED);
|
||||
epd.SetFrameMemory(paint.GetImage(), 120, 60, paint.GetWidth(), paint.GetHeight());
|
||||
|
||||
paint.Clear(UNCOLORED);
|
||||
paint.DrawFilledRectangle(0, 0, 40, 50, COLORED);
|
||||
epd.SetFrameMemory(paint.GetImage(), 16, 130, paint.GetWidth(), paint.GetHeight());
|
||||
|
||||
paint.Clear(UNCOLORED);
|
||||
paint.DrawFilledCircle(32, 32, 30, COLORED);
|
||||
epd.SetFrameMemory(paint.GetImage(), 120, 130, paint.GetWidth(), paint.GetHeight());
|
||||
epd.DisplayFrame();
|
||||
delay(2000);
|
||||
|
||||
Serial.println("e-Paper show pic");
|
||||
epd.HDirInit();
|
||||
epd.Display(IMAGE_DATA);
|
||||
|
||||
//Part display
|
||||
epd.HDirInit();
|
||||
epd.Clear();
|
||||
epd.DisplayPartBaseWhiteImage();
|
||||
|
||||
//paint.SetRotate(90);
|
||||
paint.SetWidth(200);
|
||||
paint.SetHeight(20);
|
||||
paint.Clear(UNCOLORED);
|
||||
|
||||
char i = 0;
|
||||
char str[10][10] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
|
||||
for (i = 0; i < 10; i++) {
|
||||
paint.Clear(UNCOLORED);
|
||||
paint.DrawStringAt(0, 0, str[i], &Font24, COLORED);
|
||||
epd.SetFrameMemory(paint.GetImage(), 20, 20, paint.GetWidth(), paint.GetHeight());
|
||||
epd.DisplayPartFrame();
|
||||
delay(200);
|
||||
}
|
||||
|
||||
Serial.println("e-Paper clear and goto sleep");
|
||||
epd.HDirInit();
|
||||
epd.Clear();
|
||||
epd.Sleep();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue