Function:
Initialize the E-INK screen driver
Syntax:
bool isInit()
Function:
Clear all display content on the ink screen
Syntax:
int clear(int mode = INK_CLENR_MODE0)
Example:
#include "M5CoreInk.h"
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
}
Before using the E-Ink screen operation function, you need to create an instance and pass in the screen driver address. Need to call M5.M5Ink.isInit()
to initialize with M5.M5Ink.clear()
.
Function:
Create an image area, configure whether to obtain image data buff from the screen driver (the default is to save true)
Syntax:
int creatSprite(uint16_t posX, uint16_t posY, uint16_t width = 200, uint16_t height = 200, bool copyFromMem = true);
The x
coordinate of the created image area must be an integer multiple of 8 (eg:0, 8, 16...). Otherwise, the display will be abnormal
Example:
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
//creat ink refresh Sprite
if( InkPageSprite.creatSprite(0,0,200,200,true) != 0 ){
Serial.printf("Ink Sprite creat faild");
}else{
Serial.printf("creatSprite success\n");
}
}
Function:
Push the edited image data to the image area
Syntax:
int pushSprite()
After using the drawing API operation, you need to push to refresh the screen, otherwise it will not be displayed
Example:
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
//creat ink refresh Sprite
if( InkPageSprite.creatSprite(0,0,200,200,true) != 0 ){
Serial.printf("Ink Sprite creat faild");
}else{
Serial.printf("creatSprite success\n");
InkPageSprite.drawString(35,50,"creatSprite success");
InkPageSprite.pushSprite();
}
}
Function:
Draw a single pixel at (x,y)
Syntax:
void drawPix(uint16_t posX,uint16_t posY,uint8_t pixBit)
The parameter pixBit is black when 0 is passed in, and white when 1 is passed in
Example:
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
InkPageSprite.creatSprite(0,0,200,200,true);
InkPageSprite.drawPix(100,100,0);
InkPageSprite.pushSprite();
}
Function:
Draw a single character at (x,y)
Syntax:
void drawChar(uint16_t posX, uint16_t posY, char charData, Ink_eSPI_font_t* fontPtr)
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
//creat ink refresh Sprite
InkPageSprite.creatSprite(0,0,200,200,true);
Serial.printf("Ink Sprite creat faild");
InkPageSprite.drawChar(35,50,'M');
InkPageSprite.pushSprite();
}
Function:
Draw the drawn string at (x,y)
Syntax:
void drawString(uint16_t posX, uint16_t posY, const char* charData, Ink_eSPI_font_t* fontPtr = &AsciiFont8x16)
Example:
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
//creat ink refresh Sprite
InkPageSprite.creatSprite(0,0,200,200,true);
InkPageSprite.drawString(35,50,"Hello E-INK");
InkPageSprite.pushSprite();
}
Function:
Draw a rectangle with width and height at (x,y)
Syntax:
void FillRect(uint16_t posX, uint16_t posY, uint16_t width, uint16_t height, uint8_t pixBit)
The parameter pixBit is black when 0 is passed in, and white when 1 is passed in
Example:
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
InkPageSprite.creatSprite(0,0,200,200,true);
InkPageSprite.FillRect(0,0,100,100,0);
InkPageSprite.pushSprite();
}
Function:
To draw the entire page, you need to pass in the full page Buff
Syntax:
void drawFullBuff(uint8_t* buff, bool bitMode = true)
void drawBuff(uint16_t posX,uint16_t posY,uint16_t width,uint16_t height,uint8_t* imageDataptr)
Function:
Clear the contents of the image area
Syntax:
void clear(int cleanFlag = CLEAR_DRAWBUFF)
cleanFlag value | Function |
---|---|
CLEAR_DRAWBUFF | Clear image data that has not been Pushed |
CLEAR_LASTBUFF | Clear the cache area of the image data refreshed last time, and the screen will be fully refreshed when pushed again |
Example:
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
InkPageSprite.creatSprite(0,0,200,200,true);
InkPageSprite.FillRect(0,0,100,100,0);
InkPageSprite.pushSprite();
delay(2000);
InkPageSprite.clear();
InkPageSprite.pushSprite();
}
Function:
Release the created image area
Syntax:
int deleteSprite()
Example:
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
if( InkPageSprite.creatSprite(0,0,200,200,true) != 0 ){
Serial.printf("Ink Sprite creat faild");
}else{
Serial.printf("creat Sprite success\n");
}
if(InkPageSprite.deleteSprite()!= 0){
Serial.printf("Sprite delete faild");
}else{
Serial.printf("delete Sprite success\n");
}
}
Function:
Get image buff data
Syntax:
uint8_t* getSpritePtr(){ return _spriteBuff;}
Function:
Get image width
Syntax:
uint16_t width()
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
InkPageSprite.creatSprite(0,0,200,200,true);
Serial.printf("width:%d",InkPageSprite.width());
}
Function:
Get image height
Syntax:
uint16_t height()
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
InkPageSprite.creatSprite(0,0,200,200,true);
Serial.printf("height:%d",InkPageSprite.height());
}
Function:
Get the X coordinate of the image
Syntax:
uint16_t posX()
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
InkPageSprite.creatSprite(0,0,200,200,true);
Serial.printf("posX:%d",InkPageSprite.posX());
}
Function:
Get the Y coordinate of the image
Syntax:
uint16_t posY()
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
InkPageSprite.creatSprite(0,0,200,200,true);
Serial.printf("posY:%d",InkPageSprite.posY());
}