Function:
Initializes the E-INK screen driver.
Syntax:
bool isInit()
Function:
Clears all display content on the e-ink screen.
Syntax:
int clear(int mode = INK_CLEAR_MODE0)
Example:
#include "M5CoreInk.h"
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
}
M5.M5Ink.isInit()
, and M5.M5Ink.clear()
for initialization.Function:
Creates an image area, configuring whether to get image data buffer from the screen driver (default is true).
Syntax:
int createSprite(uint16_t posX, uint16_t posY, uint16_t width = 200, uint16_t height = 200, bool copyFromMem = true);
The x
coordinate of the image area to be created must be a multiple of 8 (e.g., 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);
//create ink refresh Sprite
if(InkPageSprite.createSprite(0,0,200,200,true) != 0 ){
Serial.printf("Ink Sprite create failed");
}else{
Serial.printf("createSprite success\n");
}
}
Function:
Pushes 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 display.
Example:
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
//create ink refresh Sprite
if(InkPageSprite.createSprite(0,0,200,200,true) != 0 ){
Serial.printf("Ink Sprite create failed");
}else{
Serial.printf("createSprite success\n");
InkPageSprite.drawString(35,50,"createSprite success");
InkPageSprite.pushSprite();
}
}
Function:
Draws a single pixel at (x,y).
Syntax:
void drawPix(uint16_t posX, uint16_t posY, uint8_t pixBit)
When passing 0 for the pixBit parameter, it's black; when passing 1, it's white.
Example:
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
InkPageSprite.createSprite(0,0,200,200,true);
InkPageSprite.drawPix(100,100,0);
InkPageSprite.pushSprite();
}
Function:
Draws 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);
//create ink refresh Sprite
InkPageSprite.createSprite(0,0,200,200,true);
Serial.printf("Ink Sprite create failed");
InkPageSprite.drawChar(35,50,'M');
InkPageSprite.pushSprite();
}
Function:
Draws a 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);
//create ink refresh Sprite
InkPageSprite.createSprite(0,0,200,200,true);
InkPageSprite.drawString(35,50,"Hello E-INK");
InkPageSprite.pushSprite();
}
Function:
Draws a rectangle at (x,y) with the specified width and height.
Syntax:
void FillRect(uint16_t posX, uint16_t posY, uint16_t width, uint16_t height, uint8_t pixBit)
When the pixBit parameter is 0, it is black; when it is 1, it is white.
Example:
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
InkPageSprite.createSprite(0,0,200,200,true);
InkPageSprite.FillRect(0,0,100,100,0);
InkPageSprite.pushSprite();
}
Function:
Draws the entire page, requiring a complete page buffer.
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:
Clears the image area content.
Syntax:
void clear(int cleanFlag = CLEAR_DRAWBUFF)
cleanFlag Value | Function |
---|---|
CLEAR_DRAWBUFF | Clears the image data that has not yet been pushed. |
CLEAR_LASTBUFF | Clears the cache area of the last refreshed image data, so that when pushing again, the screen will be fully refreshed. |
Example:
#include "M5CoreInk.h"
Ink_Sprite InkPageSprite(&M5.M5Ink);
void setup() {
M5.begin();
M5.M5Ink.isInit();
M5.M5Ink.clear();
delay(1000);
InkPageSprite.createSprite(0,0,200,200,true);
InkPageSprite.FillRect(0,0,100,100,0);
InkPageSprite.pushSprite();
delay(2000);
InkPageSprite.clear();
InkPageSprite.pushSprite();
}
Function:
Releases 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.createSprite(0,0,200,200,true) != 0 ){
Serial.printf("Ink Sprite create failed");
}else{
Serial.printf("create Sprite success\n");
}
if(InkPageSprite.deleteSprite() != 0){
Serial.printf("Sprite delete failed");
}else{
Serial.printf("delete Sprite success\n");
}
}
Function:
Gets the image buffer data.
Syntax:
uint8_t* getSpritePtr(){ return _spriteBuff;}
Function:
Gets the 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.createSprite(0,0,200,200,true);
Serial.printf("width:%d",InkPageSprite.width());
}
Function:
Gets the 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.createSprite(0,0,200,200
,true);
Serial.printf("height:%d",InkPageSprite.height());
}
Function:
Gets 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.createSprite(0,0,200,200,true);
Serial.printf("posX:%d",InkPageSprite.posX());
}
Function:
Gets 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.createSprite(0,0,200,200,true);
Serial.printf("posY:%d",InkPageSprite.posY());
}