3.2. Inkplate Arduino

To get started with Inkplate in Arduino IDE first select right board and include Inkplate.h
#include "Inkplate.h"

The variable “color” or somewhere only “c” represents a color of the pixels in different way with different display technologies. If your Inkplate supports only black and white colors, the variable color represents color in grayscale of black mode. 0 represents black, 7 represents white and numbers in between represents shades; 1 is lightest grey, 6 represents darkest grey. If your Inkplate is 6COLOR, the next table shows values that represents colors.

Color

Macro definition

Value

Black

INKPLATE_BLACK

0

White

INKPLATE_WHITE

1

Green

INKPLATE_GREEN

2

Blue

INKPLATE_BLUE

3

Red

INKPLATE_RED

4

Yellow

INKPLATE_YELLOW

5

Orange

INKPLATE_ORANGE

6

But, if your Inkplate is Inkplate 2, then see the following table for values that represents colors:

Color

Macro Definition

Value

White

INKPLATE2_WHITE

0

Black

INKPLATE2_BLACK

1

Red

INKPLATE2_RED

2

3.2.1. System Functions

3.2.1.1. Inkplate object initialization

To use any of Inkplates functionalities in Arduino IDE you need to include Inkplate header, as mentioned on the Index and Get Started pages. After you’ve done that you can create a new instance of the Inkplate object, like this:

Inkplate display(INKPLATE_1BIT);

or

Inkplate display(INKPLATE_3BIT);

or

Inkplate display;

depending on what you need, monochrome (INKPLATE_1BIT), grayscale (INKPLATE_3BIT) functionality or Inkplate 2 and 6COLOR (no arguments passed).

In here given examples, Inkplate object will always be named display, if not said otherwise. After calling this below your “#include” lines, you have access to all Inkplate functionality as display object methods.

3.2.1.2. Inkplate::begin()

Before calling any display method you must call .begin() like this:
display.begin();

or

display.begin(lightWaveform);
  • Arguments and return value:

    uint8_t lightWaveform - used only with inkplate 10 to set light mode.

    Returns communication state
  • Description:

    If you forget to do this most method calls will result in core panick and esp32 resetting. For most use cases this function is called in Arduino’s setup function. After you’ve done this you can proceed calling all other methods described below.

3.2.1.3. Inkplate::sdCardInit()

  • Method prototype (as seen in System.h):

int sdCardInit();
  • Arguments and return value:
    No Arguments

    Returns 0 if card initialization unsuccessful, else some number which casts to true.

  • Description:
    Used to initialize SD card interface.
    Must be called before using SD card functionality like SdFile::read();
    Note: Not supported on Inkplate 2

3.2.1.4. Inkplate::getSdFat();

  • Method prototype (as seen in System.h):

SdFat Inkplate::getSdFat()
  • Arguments and return value:
    No Arguments

    Returns SdFat object.

  • Description:
    See SdFat library documentation for use examples.
    Note: Not supported on Inkplate 2

3.2.1.5. Inkplate::getSPI();

  • Method prototype (as seen in System.h):

SPIClass getSPI();
  • Arguments and return value:
    No Arguments

    Returns SPIClass object.

3.2.1.6. Inkplate::waitForEpd();

  • Method prototype (as seen in System.h):

bool waitForEpd(timeout);
  • Arguments and return value:
    uint16_t timeout - Timeout for waiting
    Returns 1 if panel is busy and 0 if panel is ready
  • Description:
    Waits for panel to be ready for data.
  • Example:
    display.setPanelState(0);
    
    Note: Supported only on Inkplate 2

3.2.1.7. Inkplate::setPanelState();

  • Method prototype (as seen in System.h):

void setPanelState(s);
  • Arguments and return value:
    uint8_t s panel state ON or OFF (1 or 0)

    No return value.

  • Description:
    Used to set if the panel on or off.
  • Example:
    display.setPanelState(0);
    
    Note: not supported on Inkplate 6COLOR and Inkplate 2

3.2.1.8. Inkplate::getPanelState();

  • Method prototype (as seen in System.h):

uint8_t getPanelState();
  • Arguments and return value:
    No Arguments.

    Returns 1 if eink panel is on, and 0 if it’s off.

  • Description:
    Used to see if the panel is on.
  • Example:
    Serial.print(display.getPanelState(), DEC);
    
    Note: not supported on Inkplate 6COLOR and Inkplate 2

3.2.1.9. Inkplate::readTouchpad();

  • Method prototype (as seen in System.h):

uint8_t readTouchpad(uint8_t);
  • Arguments and return value:
    uint8_t _pad - touchpad pin to check, pass in PAD1, PAD2 or PAD3

    Returns state of the desired pad.

  • Description:
    readTouchpad reads touchpad pin to check if triggered
  • Example:
    if (display.readTouchpad(PAD1))
    {
        //Do something
    }
    
    Note: Not supported on Inkplate 6PLUS, Inkplate 2 and all newer Inkplates.

3.2.1.10. Inkplate::readTemperature();

  • Method prototype (as seen in System.h):

int8_t readTemperature();
  • Arguments and return value:
    No arguments.

    Returns temperature in range from -10 to 85 degree C with accuracy of +-1 in range from 0 to 50.

  • Description:
    Can be used to determine temperature roughly.
  • Example:
    Serial.print(display.readTemperature(), DEC);
    
    Note: Not supported on Inkplate 2 or Inkplate 6COLOR

3.2.1.11. Inkplate::readBattery();

  • Method prototype (as seen in System.h):

double readBattery();
  • Arguments and return value:
    No Arguments.

    Returns battery voltage as a double.

  • Description:
    Function used to determine battery voltage.
    Can be used to display how much more time will the device be on.
  • Example:
    double voltage = display.readBattery();
    
    Note: Not supported on Inkplate Inkplate 2

3.2.1.12. Inkplate::einkOff();

  • Method prototype (as seen in Inkplate.h):

void einkOff(void);
  • Arguments and return value:
    No Arguments.

    Returns nothing.

  • Description:
    Turns the panel off to save energy.
  • Example:
    display.einkOff();
    
    Note: Not supported on Inkplate 6COLOR and Inkplate 2

3.2.1.13. Inkplate::einkOn();

  • Method prototype (as seen in Inkplate.h):

int einkOn(void);
  • Arguments and return value:
    No Arguments.

    Returns 0 if failed, 1 if succeded.

  • Description:
    einkOn turns on supply for epaper display (TPS65186) [+15 VDC, -15VDC, +22VDC, -20VDC, +3.3VDC, VCOM]
  • Example:
    display.einkOn();
    
    Note: Not supported on Inkplate 6COLOR and Inkplate 2

3.2.1.14. Inkplate::readPowerGood();

  • Method prototype (as seen in Inkplate.h):

int readPowerGood();
  • Arguments and return value:
    No Arguments.

    Returns 0 if failed, 1 if succeded.

  • Description:
    Reads ok status for each rail
  • Example:
    int power = readPowerGood();
    
    Note: Not supported on Inkplate 6COLOR and Inkplate 2

3.2.1.15. Inkplate::vscan_start();

  • Method prototype (as seen in Inkplate.h):

void vscan_start();
  • Arguments and return value:
    No Arguments.

    No return.

  • Description:
    Starts writing new frame and skips first two lines that are invisible on screen
    Note: Not supported on Inkplate 6COLOR and Inkplate 2

3.2.1.16. Inkplate::hscan_start();

  • Method prototype (as seen in Inkplate.h):

void hscan_start();
  • Arguments and return value:
    uint32_t _d - Data to be written into current row.

    No return.

  • Description:
    Starts writing data into current row
    Note: Not supported on Inkplate 6COLOR and Inkplate 2

3.2.1.17. Inkplate::vscan_end();

  • Method prototype (as seen in Inkplate.h):

void vscan_end();
  • Arguments and return value:
    No Arguments.

    No return.

  • Description:
    Ends current row and prints data to screen
    Note: Not supported on Inkplate 6COLOR and Inkplate 2

3.2.1.18. Inkplate::pinsZstate();

  • Method prototype (as seen in Inkplate.h):

void pinsZstate();
  • Arguments and return value:
    No Arguments.

    No return.

  • Description:
    Sets pins connected to e-paper to High-Z state(or inputs).
    Note: Not supported on Inkplate 6COLOR and Inkplate 2

3.2.1.19. Inkplate::pinsAsOutputs();

  • Method prototype (as seen in Inkplate.h):

void pinsAsOutputs();
  • Arguments and return value:
    No Arguments.

    No return.

  • Description:
    Sets pins connected to e-paper to output state.
    Note: not supported on Inkplate 6COLOR and Inkplate 2

3.2.1.20. Inkplate::setFrontlight();

  • Method prototype (as seen in Inkplate.h):

void setFrontlight(uint8_t _v);
  • Arguments and return value:
    uint8_t _v - value to set frontlight to
    No return.
  • Description:
    setFrontlight function sets frontlight intensity for inkplate, only for inkplate 6 plus
    Note: Only supported on Inkplate 6PLUS

3.2.1.21. Inkplate::resetPanel();

  • Method prototype (as seen in Inkplate.h):

void resetPanel();
  • Arguments and return value:
    No arguments.
    Returns nothing.
  • Description:
    resetPanel resets Inkplate 2 or 6COLOR.

3.2.1.22. Inkplate::sendCommand();

  • Method prototype (as seen in Inkplate.h):

void sendCommand(uint8_t _command);
  • Arguments and return value:
    uint8_t command - predefined command for epaper control
    Returns nothing.
  • Description:
    sendCommand sends SPI command to Inkplate 2 or 6COLOR.

3.2.1.23. Inkplate::sendData();

  • Method prototype (as seen in Inkplate.h):

void sendData(uint8_t *_data, int _n);
void sendData(uint8_t _data);
  • Arguments and return value:
    uint8_t* data - pointer to data buffer to be sent to epaper
    int n - number of data bytes
    uint8_t data - data buffer to be sent to epaper
    Returns nothing.
  • Description:
    sendData sends SPI data to Inkplate 6COLOR or Inkplate 2.

3.2.1.24. Inkplate::setIOExpanderForLowPower;

  • Method prototype (as seen in Inkplate.h):

void setIOExpanderForLowPower;
  • Arguments and return value:
    No arguments.
    No return.
  • Description:
    setIOExpanderForLowPower initiates IO expander pins for low power, and puts
    them in OUTPUT LOW because they are using least amount of current in deep
    sleep that way

3.2.2. Drawing Functions

3.2.2.1. Inkplate::drawPixel();

  • Method prototype (as seen in Graphics.h):

void drawPixel(int16_t x0, int16_t y0, uint16_t color);
  • Arguments and return value:
    int16_t x0 - x coordinate of pixel, [0, 799] in rotations 2, 4 and [0, 599] in 1, 3
    int16_t y0 - y coordinate of pixel, [0, 599] in rotations 2, 4 and [0, 799] in 1, 3
    uint16_t color - pixel color, in 3 bit mode in range [0, 7]

    Returns nothing.

  • Description:
    Most basic drawing command in the library is .drawPixel();
    Draws one pixel at x0, y0 in desired color.
    Requires Inkplate::display() to be called afterwards to update the screen,
    See below.
    On Inkplate 2 if same pixel is set to red and black color, Red will always
    be shown. There are two buffers containing pictures ,one for black and one for red,
    and red is drawn after black.
  • Example:
    display.drawPixel(100, 50, BLACK);
    
  • Result:
    Here is what the code above produces:
    Quite small, isn’t it.
    _images/IMG_4345.jpg

3.2.2.2. Inkplate::display();

  • Method prototype (as seen in Inkplate.h):

void display(bool leaveOn = false);
  • Arguments and return value:
    bool leaveOn - if set to 1, it will disable turning supply for eink after display update in order to save some time needed for power supply to save some time at next display update or increase refreshing speed.

    Returns nothing.

  • Description:
    Displays all data in frame buffer to screen.
  • Example:
    //Any drawing code
    display.drawPixel(10, 100, BLACK);
    
    display.display(1);
    

3.2.2.3. Inkplate::display1b();

  • Method prototype (as seen in Inkplate.h):

void display1b(bool leaveOn = false);
  • Arguments and return value:
    bool leaveOn - if set to 1, it will disable turning supply for eink after display update in order to save some time needed for power supply to save some time at next display update or increase refreshing speed.
    Returns nothing.
  • Description:
    display1b function writes black and white data to display
  • Example:
    //Any drawing code
    display.drawPixel(10, 100, BLACK);
    
    display.display1b(1);
    
    Note: Not supported on Inkplate 6COLOR and Inkplate 2

3.2.2.4. Inkplate::display3b();

  • Method prototype (as seen in Inkplate.h):

void display3b(bool leaveOn = false);
  • Arguments and return value:
    bool leaveOn - if set to 1, it will disable turning supply for eink after display update in order to save some time needed for power supply to save some time at next display update or increase refreshing speed.
    Returns nothing.
  • Description:
    display3b function writes grayscale data to display
  • Example:
    //Any drawing code
    display.drawPixel(10, 100, BLACK);
    
    display.display3b(1);
    
    Note: not supported on Inkplate 6COLOR and Inkplate 2

3.2.2.5. Inkplate::preloadScreen();

  • Method prototype (as seen in Inkplate.h):

void preloadScreen();
  • Arguments and return value:
    No Arguments

    Returns nothing.

  • Description:
    Copies data from partial to data buffer.
    Note: not supported on Inkplate 6COLOR and Inkplate 2

3.2.2.6. Inkplate::clearDisplay();

  • Method prototype (as seen in Inkplate.h):

void clearDisplay();
  • Arguments and return value:
    No Arguments

    Returns nothing.

  • Description:
    Clears all data in buffer. Call display() after this to update/clear display.
  • Example:
    display.clearDisplay();
    display.display();
    

3.2.2.7. Inkplate::partialUpdate();

  • Method prototype (as seen in Inkplate.h):

void partialUpdate();

or

void partialUpdate(bool _forced = false, bool leaveOn = false);
  • Arguments and return value:
    bool _forced - For advanced use with deep sleep. Can force partial update in deep sleep.
    bool leaveOn - if set to 1, it will disable turning supply for eink after
    display update in order to save some time needed for power supply
    to save some time at next display update or increase refreshing speed.
    Returns nothing.
  • Description:
    Updates only the changed parts of the screen. (monochrome/INKPLATE_1BIT mode only!)
    After a few updates creates blurry parts of the screen.
    Fixed by calling Inkplate::clean();
  • Example:
    display.drawPixel(100, 50, BLACK);
    
    display.partialUpdate();
    
    display.drawPixel(100, 100, BLACK);
    
    Note: Not supported on Inkplate 6COLOR and Inkplate 2

3.2.2.8. Inkplate::setRotation();

  • Method prototype (as seen in Graphics.h):

void setRotation(uint8_t r);
  • Arguments and return value:
    uint8_t r - screen rotation.

    Returns nothing.

  • Description:
    Rotates the screen to be used in different orientations.
    Default is 2, to flip 180 input 4
    1 and 3 are for portait mode.
    Once flipped coordinate space remains to have the origin in the top left corner.
  • Example:
    display.setRotation(3);
    
    display.setCursor(100, 100);
    display.print("INKPLATE");
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4347.jpg

3.2.2.9. Inkplate::selectDisplayMode();

  • Method prototype (as seen in Graphics.h):

void selectDisplayMode(uint8_t _mode)
  • Arguments and return value:
    uint8_t _mode - New display mode, INKPLATE_1BIT or INKPLATE_3BIT.

    Returns nothing.

  • Description:
    Changes the screen mode to from monochrome to 3 bit grayscale or vice versa.
  • Example:
    display.selectDisplayMode(INKPLATE_3BIT);
    
    Note: Not supported on Inkplate 6COLOR and Inkplate 2

3.2.2.10. Inkplate::setDisplayMode();

  • Method prototype (as seen in Graphics.h):

void setDisplayMode(uint8_t _mode)
  • Arguments and return value:
    uint8_t _mode - Mode.

    Returns nothing.

  • Description:
    Sets display mode
    Note: not supported on Inkplate 6COLOR and Inkplate 2

3.2.2.11. Inkplate::getDisplayMode();

  • Method prototype (as seen in Graphics.h):

uint8_t getDisplayMode();
  • Arguments and return value:
    No arguments.

    Returns currently set display mode.

  • Description:
    Used to determine which display mode is currently used.
    Returns INKPLATE_1BIT or INKPLATE_3BIT.
  • Example:
    if(display.getDisplayMode() == INKPLATE_3BIT)
        Serial.println("I'm in grayscale mode!");
    
    Note: Not supported on Inkplate 6COLOR and Inkplate 2

3.2.2.12. Inkplate::drawImage();

  • Method prototype (as seen in Image.h):

bool drawImage(const char *path, int x, int y, bool dither = 1, bool invert = 0);
bool drawImage(const String path, int x, int y, bool dither = 1, bool invert = 0);
bool drawImage(const uint8_t *buf, int x, int y, int16_t w, int16_t h, uint8_t c = BLACK, uint8_t bg = 0xFF);
bool drawImage(const char *path, const Format &format, const int x, const int y, const bool dither = 1, const bool invert = 0);
bool drawImage(const String path, const Format &format, const int x, const int y, const bool dither = 1, const bool invert = 0);
bool drawImage(const char *path, const Format &format, const Position &position, const bool dither = 1, const bool invert = 0);
  • Arguments and return value:
    const char *path - Path to file.
    int x - x coordinate to draw the image at
    int y - y coordinate to draw the image at
    bool dither - to dither the image or not
    bool invert - invert all colors, defaults to false

    const String path - Path to file.
    int x - x coordinate to draw the image at
    int y - y coordinate to draw the image at
    bool dither - to dither the image or not
    bool invert - invert all colors, defaults to false

    const uint8_t *p - Buffer to draw from.
    int x - x coordinate to draw the image at
    int y - y coordinate to draw the image at
    int16_t w - x coordinate to draw the image at
    int16_t h - y coordinate to draw the image at
    bool dither - to dither the image or not
    bool invert - invert all colors, defaults to false
    uint8_t c - color to draw 1 pixels if in BW mode
    uint8_t bg - color to draw all 0 pixels if in BW mode.
    const char *path - Path to file.
    const Format &format - image format (bmp, jpeg, png).
    int x - x coordinate to draw the image at
    int y - y coordinate to draw the image at
    bool dither - to dither the image or not
    bool invert - invert all colors, defaults to false
    const String *path - Path to file.
    const Format &format - image format (bmp, jpeg, png).
    int x - x coordinate to draw the image at
    int y - y coordinate to draw the image at
    bool dither - to dither the image or not
    bool invert - invert all colors, defaults to false
    const char *path - Path to file.
    const Format &format - image format (bmp, jpeg, png).
    const Position &position - image position (Center, TopLeft, BottomLeft, TopRight, BottomRight, _npos)
    bool dither - to dither the image or not
    bool invert - invert all colors, defaults to false

    Returns 0 if error occured, else returns 1.

  • Description:
    Should always have Inkplate::sdCardInit() called before if file is from SD.
    Can draw all kinds of images, but they should have a file extensions in them.
    Can draw from web if path starts with http:// or https:// or if not from SD.
    Draws bmp, png and jpeg images.
    Automatically adjusts for current display mode.

    On Inkplate 6COLOR, dither will use all of the 7 colors.
    The default color values are:

Color hex

Color

0x000000

Black

0xFFFFFF

White

0x00FF00

Green

0x0000FF

Blue

0xFF0000

Red

0xFFFF00

Yellow

0xFF8000

Orange


If you want to change the color palette in which the image is dithered, check the file /src/include/ImageDitherColor.cpp in your library. It has a palette[] array where you can modify the color values in hex for a different look to the dithered image.
The order of the colors is: [Black, White, Green, Blue, Red, Yellow, Orange]ˇ

There is online Image converter for the Inkplate which have a presets for easier converting images for different Inkplates

On Inkplate 2 if you use online image converter, include picture in header file and it will draw it in tri-color mode.

3.2.2.13. Inkplate::drawBitmapFromSD();

  • Method prototype (as seen in Image.h):

[[deprecated("Use drawImage, as this will soon become a private method.")]]
int drawBitmapFromSD(SdFile *p, int x, int y, bool dither = false, bool invert = false);
int drawBitmapFromSD(char *fileName, int x, int y, bool dither = false, bool invert = false);
  • Arguments and return value:
    SdFile *p - SdFile pointer to draw to screen
    int x - x coordinate to draw the image at
    int y - y coordinate to draw the image at
    bool dither - to dither the image or not
    bool invert - invert all colors, defaults to false

    char *fileName - filename of the bmp on the sd card
    int x - x coordinate to draw the image at
    int y - y coordinate to draw the image at
    bool dither - to dither the image or not
    bool invert - invert all colors, defaults to false

    Returns 0 if error occured, else returns 1.

  • Description:
    Should always have Inkplate::sdCardInit() called before.
    Draws a bitmap image from sd card to screen.
    Image can currently have 1, 4, 8 or 24 bit color depth.
    24 or 8 bit ones can be dithered, else the argument is ignored.
    Info on dithering: dithering
  • Example:
    if (display.sdCardInit())
    {
        display.println("SD Card OK! Reading image...");
        display.partialUpdate();
        if(!display.drawBitmapFromSD("pandaImage.bmp", 0, 0)) {
            display.println("Image open error");
            display.display();
        }
    }
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4348.jpg
    Note: not supported on Inkplate 2

3.2.2.14. Inkplate::drawBitmapFromWeb();

  • Method prototype (as seen in Image.h):

[[deprecated("Use drawImage, as this will soon become a private method.")]]
int drawBitmapFromWeb(WiFiClient *s, int x, int y, int len, bool dither = false, bool invert = false);
int drawBitmapFromWeb(char *url, int x, int y, bool dither = false, bool invert = false);
  • Arguments and return value:
    WiFiClient *s - WiFiClient stream to dowload image from.
    int x - x coordinate at which to display the image.
    int y - y coordinate at which to display the image.
    int len - file size (header included).
    bool dither - flag indicating to dither the image
    bool invert - invert all image colors.

    char *url - url of the image.
    int x - x coordinate at which to display the image.
    int y - y coordinate at which to display the image.
    bool dither - flag indicating to dither the image
    bool invert - invert all image colors.

    Returns 0 if failed and 1 if successful.

  • Description:
    Draws an image from the web.

    On Inkplate 6COLOR, dither will use all of the 7 colors.
    The default color values are:

Color hex

Color

0x000000

Black

0xFFFFFF

White

0x00FF00

Green

0x0000FF

Blue

0xFF0000

Red

0xFFFF00

Yellow

0xFF8000

Orange


If you want to change the color palette in which the image is dithered, check the file /src/include/ImageDitherColor.cpp in your library. It has a palette[] array where you can modify the color values in hex for a different look to the dithered image.
The order of the colors is: [Black, White, Green, Blue, Red, Yellow, Orange]

On Inkplate 2 if you use online image converter, include picture in header file and it will draw it in tri-color mode.
Make sure WiFi is setup beforehand as in examples (10-Inkplate_download_and_show).
  • Example:
    if(!display.drawBitmapFromWeb("https://varipass.org/neowise_mono.bmp", 0, 0, true)) {
        display.println("Image open error");
        display.display();
    }
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4349.jpg

3.2.2.15. Inkplate::drawThickLine();

  • Method prototype (as seen in Shapes.h):

void drawThickLine(int x1, int y1, int x2, int y2, int color, float thickness);
  • Arguments and return value:
    int x1 - x coordinate of line start, [0, 799] in rotations 2, 4 and [0, 599] in 1, 3
    int y1 - y coordinate of line start, [0, 599] in rotations 2, 4 and [0, 799] in 1, 3
    int x2 - x coordinate of line end, [0, 799] in rotations 2, 4 and [0, 599] in 1, 3
    int y2 - y coordinate of line end, [0, 599] in rotations 2, 4 and [0, 799] in 1, 3
    int color - line color, in 3 bit mode in range [0, 7]
    float thickness - line thickness in pixels

    Returns nothing.

  • Description:
    For drawing thick lines.
  • Example:
    display.drawThickLine(random(0, 799), random(0, 599), random(0, 799), random(0, 599), BLACK, (float)random(1, 20));
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4350.jpg

3.2.2.16. Inkplate::drawGradientLine();

  • Method prototype (as seen in Shapes.h):

void drawGradientLine(int x1, int y1, int x2, int y2, int color1, int color2, float thickness = -1);
  • Arguments and return value:
    int x1 - x coordinate of line start, [0, 799] in rotations 2, 4 and [0, 599] in 1, 3
    int y1 - y coordinate of line start, [0, 599] in rotations 2, 4 and [0, 799] in 1, 3
    int x2 - x coordinate of line end, [0, 799] in rotations 2, 4 and [0, 599] in 1, 3
    int y2 - y coordinate of line end, [0, 599] in rotations 2, 4 and [0, 799] in 1, 3
    int color1 - start line color, in 3 bit mode in range [0, 7]
    int color2 - start line color, in 3 bit mode in range [0, 7]
    float thickness - line thickness, defaults to -1 meaning use normal, non thick, line.

    Returns nothing.

  • Description:
    For drawing color gradient lines.
    color1 should always be less than color2.
    If Inkplate 6Color is used, it will draw line in colors, so it is not recommended to use this function with Inkplate 6COLOR.
  • Example:
    int startColor = random(0, 7);
    int endColor = random(startColor, 7);
    display.drawGradientLine(random(0, 799), random(0, 599), random(0, 799), random(0, 599), startColor, endColor, (float)random(1, 20));
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4353.jpg

3.2.2.17. Inkplate::clean();

  • Method prototype (as seen in Inkplate.h):

void clean(c, rep);
or (Inkplate 6PLUS)
void clean();
  • Arguments and return value:
    uint8_t c - one of four posible pixel states (0 will light screen, 1 will darken screen, 2 will discharge screen and 3 will skip).
    uint8_t rep - number of repetitions.

    Returns nothing.

  • Description:
    Cleans the actual screen of any possible burn in.
    Should not be used in intervals less than 5 seconds.
  • Example:
    display.clean();
    
    Note: Inkplate 2 does not support this function

3.2.2.18. Inkplate::fillScreen();

  • Method prototype (as seen in Adafruit_GFX.h):

void fillScreen(uint16_t color);
  • Arguments and return value:
    uint16_t color - color of the screen after filling.

    Returns nothing.

  • Description:
    Fills the whole screen to a solid color.
  • Example:
    display.fillScreen(0);
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4357.jpg

3.2.2.19. Inkplate::drawRect();

  • Method prototype (as seen in Adafruit_GFX.h):

void drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
  • Arguments and return value:
    int16_t x - Rectangle x coordinate.
    int16_t y - Rectangle y coordinate.
    int16_t w - Rectangle width.
    int16_t h - Rectangle height.
    uint16_t color - Rectangle color (edges only, see fillRect for fully filled one).

    Returns nothing.

  • Description:
    Draws and empty (not filled) rectangle.
  • Example:
    display.drawRect(200, 200, 400, 300, 0);
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4359.jpg

3.2.2.20. Inkplate::drawElipse();

  • Method prototype (as seen in Shapes.h):

void drawElipse(int rx, int ry, int xc, int yc, int c);
  • Arguments and return value:
    int rx - Elipse X radius.
    int ry - Elipse Y radius.
    int xc - Elipse center x.
    int yc - Elipse center y.
    int color - Elipse color (just the edge, see fillElipse for fully filled).

    Returns nothing.

  • Description:
    Draws an empty(not filled) elipse.
  • Example:
    display.drawElipse(100, 200, 400, 300, 0);
    

3.2.2.21. Inkplate::fillElipse();

  • Method prototype (as seen in Shapes.h):

void fillElipse(int rx, int ry, int xc, int yc, int c);
  • Arguments and return value:
    int rx - Elipse X radius.
    int ry - Elipse Y radius.
    int xc - Elipse center x.
    int yc - Elipse center y.
    int color - Elipse color.

    Returns nothing.

  • Description:
    Draws an filled elipse.
  • Example:
    display.fillElipse(100, 200, 400, 300, 0);
    

3.2.2.22. Inkplate::drawPolygon();

  • Method prototype (as seen in ShapesPolygon.h):

void drawPolygon(int *x, int *y, int n, int color);
  • Arguments and return value:
    int *x - Polygon points X coordinates.
    int *y - Polygon points Y coordinates.
    int n - Number of points.
    int color - Elipse color (just the edge, see fillElipse for fully filled).

    Returns nothing.

  • Description:
    Draws an empty(not filled) polygon.
  • Example:
    display.drawPolygon(xt, yt, n, 0);
    

3.2.2.23. Inkplate::fillPolygon();

  • Method prototype (as seen in ShapesPolygon.h):

void fillPolygon(int *x, int *y, int n, int color);
  • Arguments and return value:
    int *x - Polygon points X coordinates.
    int *y - Polygon points Y coordinates.
    int n - Number of points.
    int color - Elipse color (just the edge, see fillElipse for fully filled).

    Returns nothing.

  • Description:
    Draws a filled polygon.
    Can be quite slow.
  • Example:
    display.fillPolygon(xt, yt, n, 0);
    

3.2.2.24. Inkplate::initedgeTable();

  • Method prototype (as seen in ShapesPolygon.h):

void initedgeTable();
  • Arguments and return value:
    No arguments.
    Returns nothing
  • Description:
    initedgeTable initiates edge table and sets all values inside struct to 0

3.2.2.25. Inkplate::insertionSort();

  • Method prototype (as seen in ShapesPolygon.h):

void insertionSort(edgeTableTuple *ett);
  • Arguments and return value:
    edgeTableTuple *ett - pointer to edgeTableTuple to be sorted.
    Returns nothing
  • Description:
    insertionSort sorts buckets inside edgeTableTuple

3.2.2.26. Inkplate::storeEdgeInTuple();

  • Method prototype (as seen in ShapesPolygon.h):

void storeEdgeInTuple(edgeTableTuple *receiver, int ym, int xm, float slopInv);
  • Arguments and return value:
    edgeTableTuple *receiver - pointer to edgeTableTuple structure.
    int ym - edgeTableTuple->ymax value.
    int xm - edgeTableTuple->xofymin value.
    float slopInv - edgeTableTuple->slopeInverse value.
    Returns nothing
  • Description:
    storeEdgeInTuple stores values in tuple structure

3.2.2.27. Inkplate::storeEdgeInTable();

  • Method prototype (as seen in ShapesPolygon.h):

void storeEdgeInTable(int x1, int y1, int x2, int y2);
  • Arguments and return value:
    int x1 - x plane starting position.
    int y1 - y plane starting position.
    int x2 - x plane ending position.
    int y2 - y plane ending position.
    Returns nothing
  • Description:
    storeEdgeInTable calculates edge values of edgeTableTuple and stores them

3.2.2.28. Inkplate::removeEdgeByYmax();

  • Method prototype (as seen in ShapesPolygon.h):

void removeEdgeByYmax(edgeTableTuple *tup, int yy);
  • Arguments and return value:
    edgeTableTuple *tup - pointer to edgeTableTuple to work on.
    int yy - value to remove from edgeTableTuple.
    Returns nothing
  • Description:
    removeEdgeByYmax removes edge by given yy

3.2.2.29. Inkplate::updatexbyslopeinv();

  • Method prototype (as seen in ShapesPolygon.h):

void updatexbyslopeinv(edgeTableTuple *tup);
  • Arguments and return value:
    edgeTableTuple *tup - pointer to edgeTableTuple to work on.
    Returns nothing
  • Description:
    updatexbyslopeinv updates all xofymin by adding slopeinverse

3.2.2.30. Inkplate::scanlineFill();

  • Method prototype (as seen in ShapesPolygon.h):

void scanlineFill(uint8_t c);
  • Arguments and return value:
    uint8_t c - color.
    Returns nothing
  • Description:
    scanlineFill dravs horizontal line based on edge table

3.2.2.31. Inkplate::drawCircle();

  • Method prototype (as seen in Adafruit_GFX.h):

void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
  • Arguments and return value:
    int16_t x0 - Circle center x coordinte.
    int16_t y0 - Circle center y coordinate.
    int16_t r - Circle radius.
    uint16_t color - Circle color (just the edge, see fillCircle for fully filled).

    Returns nothing.

  • Description:
    Draws an empty(not filled) circle.
  • Example:
    display.drawCircle(400, 300, 75, 0);
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4360.jpg

3.2.2.32. Inkplate::fillCircle();

  • Method prototype (as seen in Adafruit_GFX.h):

void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
  • Arguments and return value:
    int16_t x0 - Circle center x coordinte.
    int16_t y0 - Circle center y coordinate.
    int16_t r - Circle radius.
    uint16_t color - Circle color (fully filled).

    Returns nothing.

  • Description:
    Draws a filled circle to screen in a supplied color.
  • Example:
    display.fillCircle(random(0, 799), random(0, 599), 15, random(0, 7));
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4361.jpg

3.2.2.33. Inkplate::drawTriangle();

  • Method prototype (as seen in Adafruit_GFX.h):

void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
  int16_t x2, int16_t y2, uint16_t color);
  • Arguments and return value:
    int16_t x0 - First point x coordinate.
    int16_t y0 - First point y coordinate.
    int16_t x1 - Second point x coordinate.
    int16_t y1 - Second point y coordinate.
    int16_t x2 - Third point x coordinate.
    int16_t y2 - Third point y coordinate.
    uint16_t color - Triangle edge color(see fillTriangle for a fully filled one).

    Returns nothing.

  • Description:
    Draw an empty rectangle to screen.
  • Example:
    display.drawTriangle(250, 400, 550, 400, 400, 100, 0);
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4362.jpg

3.2.2.34. Inkplate::fillTriangle();

  • Method prototype (as seen in Adafruit_GFX.h):

void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
  int16_t x2, int16_t y2, uint16_t color);
  • Arguments and return value:
    int16_t x0 - First point x coordinate.
    int16_t y0 - First point y coordinate.
    int16_t x1 - Second point x coordinate.
    int16_t y1 - Second point y coordinate.
    int16_t x2 - Third point x coordinate.
    int16_t y2 - Third point y coordinate.
    uint16_t color - Triangle fill color.

    Returns nothing.

  • Description:
    Draw a rectangle filled with a certain color.
  • Example:
    display.fillTriangle(300, 350, 500, 350, 400, 150, 0);
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4363.jpg

3.2.2.35. Inkplate::drawRoundRect();

  • Method prototype (as seen in Adafruit_GFX.h):

void drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
  int16_t radius, uint16_t color);
  • Arguments and return value:
    int16_t x0 - Rectangle x coordinate.
    int16_t y0 - Rectangle y coordinate.
    int16_t w - Rectangle width.
    int16_t h - Rectangle height.
    int16_t radius - Curvature radius of the edges.
    uint16_t color - Rectangle edges color (for a fully filled one see fillRoundRect).

    Returns nothing.

  • Description:
    Draws an empty (not filled) rectangle with round edges to screen.
  • Example:
    display.drawRoundRect(200, 200, 400, 300, 10, 0);
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4364.jpg

3.2.2.36. Inkplate::fillRoundRect();

  • Method prototype (as seen in Adafruit_GFX.h):

void fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
  int16_t radius, uint16_t color);
  • Arguments and return value:
    int16_t x0 - Rectangle x coordinate.
    int16_t y0 - Rectangle y coordinate.
    int16_t w - Rectangle width.
    int16_t h - Rectangle height.
    int16_t radius - Curvature radius of the edges.
    uint16_t color - Rectangle fill color.

    Returns nothing.

  • Description:
    Draws a fully filled rectangle with rounded corners to screen.
  • Example:
    display.fillRoundRect(200, 200, 400, 300, 10, 0);
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4365.jpg

3.2.2.37. Inkplate::drawBitmap();

  • Method prototype (as seen in Adafruit_GFX.h):

void drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
  int16_t w, int16_t h, uint16_t color);

void drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
  int16_t w, int16_t h, uint16_t color, uint16_t bg);

void drawBitmap(int16_t x, int16_t y, uint8_t *bitmap,
  int16_t w, int16_t h, uint16_t color);

void drawBitmap(int16_t x, int16_t y, uint8_t *bitmap,
  int16_t w, int16_t h, uint16_t color, uint16_t bg);
  • Arguments and return value:
    int16_t x - Bitmap x coordinate.
    int16_t y - Bitmap y coordinate.
    const uint8_t bitmap [] - Buffer storing the image information.
    int16_t w - Bitmap width.
    int16_t h - Bitmap height.
    uint16_t color - Color to draw pixels marked with a 1.

    int16_t x - Bitmap x coordinate.
    int16_t y - Bitmap y coordinate.
    const uint8_t bitmap [] - Buffer storing the image information.
    int16_t w - Bitmap width.
    int16_t h - Bitmap height.
    uint16_t color - Color to draw pixels marked with a 1.
    uint16_t bg - Color to draw pixels marked with a 0.

    int16_t x - Bitmap x coordinate.
    int16_t y - Bitmap y coordinate.
    const uint8_t *bitmap - Buffer storing the image information.
    int16_t w - Bitmap width.
    int16_t h - Bitmap height.
    uint16_t color - Color to draw pixels marked with a 1.

    int16_t x - Bitmap x coordinate.
    int16_t y - Bitmap y coordinate.
    const uint8_t *bitmap - Buffer storing the image information.
    int16_t w - Bitmap width.
    int16_t h - Bitmap height.
    uint16_t color - Color to draw pixels marked with a 1.
    uint16_t bg - Color to draw pixels marked with a 0.

    Returns nothing.

  • Description:
    Draws a monochrome bitmap to screen.
    To get image data, use LCD image Converter.
  • Example:
    display.drawBitmap(100, 250, logo, 576, 100, BLACK);
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4366.jpg

3.2.2.38. Inkplate::drawBitmap3Bit();

  • Method prototype (as seen in Image.h):

void drawBitmap3Bit(int16_t _x, int16_t _y, const unsigned char *_p, int16_t _w, int16_t _h);
  • Arguments and return value:
    int16_t _x - x coordinate of image corner, [0, 799] in rotations 2, 4 and [0, 599] in 1, 3
    int16_t _y - y coordinate of image corner, [0, 599] in rotations 2, 4 and [0, 799] in 1, 3
    const unsigned char *_p - unsigned char buffer containing bitmap data
    int16_t _w - image width
    int16_t _h - image height

    Returns nothing.

  • Description:
    Draws a bitmap image to screen.
    Image data can be created using online tools or supplied Python script in some examples.
    If Inkplate 6COLOR is used, this function will draw image in 7-color mode, otherwise it will draw image in grayscale mode.
  • Example:
    //Picture is a predefined image buffer (const uint8_t, see 2-Inkplate_basic_grayscale example)
    display.drawBitmap3Bit(0, 0, picture, 800, 600);
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4369.jpg

3.2.2.39. Inkplate::drawChar();

  • Method prototype (as seen in Adafruit_GFX.h):

void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
  uint16_t bg, uint8_t size);
void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
          uint16_t bg, uint8_t size_x, uint8_t size_y);
  • Arguments and return value:
    No arguments.

    Returns nothing.

  • Description:
    Draws characters to the screen
  • Example:
    display.drawChar();
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4371.jpg

3.2.2.40. Inkplate::getTextBounds();

  • Method prototype (as seen in Adafruit_GFX.h):

void getTextBounds(const char *string, int16_t x, int16_t y,
  int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h);
void getTextBounds(const __FlashStringHelper *s, int16_t x, int16_t y,
  int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h);
void getTextBounds(const String &str, int16_t x, int16_t y,
  int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h);
  • Arguments and return value:
    const char *string - Text string from a char buffer (c style string - preferred).
    int16_t x - Starting x coordinate.
    int16_t y - Starting y coordinate.
    int16_t *x1 - Pointer showing where to put end x coordinate.
    int16_t *y1 - Pointer showing where to put end y coordinate.
    uint16_t *w - Pointer showing where to put text width.
    uint16_t *h -Pointer showing where to put text height.

    const __FlashStringHelper *s - Text string from a flash string (preferred when string doesn’t have to be changed)
    int16_t x - Starting x coordinate.
    int16_t y - Starting y coordinate.
    int16_t *x1 - Pointer showing where to put end x coordinate.
    int16_t *y1 - Pointer showing where to put end y coordinate.
    uint16_t *w - Pointer showing where to put text width.
    uint16_t *h -Pointer showing where to put text height.

    String &**string** - Text string from a String object reference (should be avoided).
    int16_t x - Starting x coordinate.
    int16_t y - Starting y coordinate.
    int16_t *x1 - Pointer showing where to put end x coordinate.
    int16_t *y1 - Pointer showing where to put end y coordinate.
    uint16_t *w - Pointer showing where to put text width.
    uint16_t *h -Pointer showing where to put text height.

    Returns nothing.

  • Description:
    Puts data about text box end coordinates, width and height in variable pointers.
  • Example:
    int16_t x, y;
    uint16_t w, h;
    
    display.getTextBounds("Some text", 0, 0, &x, &y, &w, &h);
    
    // Now x, y, w and h were set to respected values
    

3.2.2.41. Inkplate::setTextSize();

  • Method prototype (as seen in Adafruit_GFX.h):

void setTextSize(uint8_t s);
void setTextSize(uint8_t sx, uint8_t sy);
  • Arguments and return value:
    uint8_t s - font scale

    uint8_t sx - font x scale
    uint8_t sy - font y scale

    Returns nothing.

  • Description:
    Scales the font to some value.
  • Example:
    display.setTextSize(4);
    display.print("Welcome to Inkplate 6!");
    

3.2.2.42. Inkplate::setFont();

  • Method prototype (as seen in Adafruit_GFX.h):

void setFont(const GFXfont *f = NULL);
  • Arguments and return value:
    const GFXfont *f - font struct pointer, defaults to NULL meaning default font

    Returns nothing.

  • Description:
    Used to change the text font.
    Fonts can be found in the supplied Fonts folder or made using tools.
    Example tool: font converter (select Library version -> gfx font)
  • Example:
    //Font has to be included
    display.setFont(&Not_Just_Groovy20pt7b);
    display.println("Inkplate 6");
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4371.jpg

3.2.2.43. Inkplate::setCursor();

  • Method prototype (as seen in Adafruit_GFX.h):

void setCursor(int16_t x, int16_t y);
  • Arguments and return value:
    int16_t x - Cursor x position.
    int16_t y - Cursor y position.

    Returns nothing.

  • Description:
    Sets the cursor text position.
  • Example:
    display.setCursor(0, 550);
    display.print("Some text");
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4373.jpg

3.2.2.44. Inkplate::print();

  • Method prototype:

void print(char *s);
void print(String &s);
  • Arguments and return value:
    char *s - C string to be printed.

    String &**s** - String to be printed.

    Returns nothing.

  • Description:
    Puts the text on screen.
  • Example:
    display.print("Some text");
    
  • Result:
    Here is what the code above produces:
    _images/IMG_4373.jpg

3.2.2.45. Inkplate::println();

  • Method prototype:

void println(char *s);
void println(String &s);
  • Arguments and return value:
    char *s - C string to be printed.

    String &**s** - String to be printed.

    Returns nothing.

  • Description:
    Essentially the same as print but adds a new line to end.
  • Example:
    display.println("Some text");
    

3.2.2.46. Inkplate::drawTextWithShadow();

  • Method prototype:

void drawTextWithShadow(int x, int y, const char *_c, uint8_t _color1, uint8_t color2);
  • Arguments and return value:
    int x - x coordinate.

    int y - y coordinate.

    const char *_c - pointer to array of chars to be printed.

    uint8_t _color1 - Color of text.

    uint8_t color2 - Color of shadow.

    Returns nothing.

  • Description:
    Prints text with shadow on specific location.
  • Example:
    display.drawTextWithShadow(20,40, "Text", RED, BLACK);
    

3.2.2.47. Inkplate::setTextWrap();

  • Method prototype (as seen in Adafruit_GFX.h):

void setTextWrap(boolean w);
  • Arguments and return value:
    boolean w - to wrap or not to wrap text.

    Returns nothing.

  • Description:
    Wrap text thats gone of the edge.
  • Example:
    //Disables text wrapping
    display.setTextWrap(false);
    

3.2.2.48. Inkplate::width();

  • Method prototype (as seen in Graphics.h):

int16_t width(void);
  • Arguments and return value:
    No arguments.
  • Description:
    Returns screen width.
  • Example:
    display.width();
    

3.2.2.49. Inkplate::height();

  • Method prototype (as seen in Graphics.h):

int16_t height(void);
  • Arguments and return value:
    No arguments.

    Returns nothing.

  • Description:
    Returns screen height.
  • Example:
    display.height();
    

3.2.2.50. Inkplate::getRotation();

  • Method prototype (as seen in Graphics.h):

int16_t getRotation(void);
  • Arguments and return value:
    No arguments.

    Returns nothing.

  • Description:
    Returns screen rotation, in range [0,3], 2 is default.
  • Example:
    if(display.getRotation() == 4)
        Serial.println("I'm upside down!");
    

3.2.2.51. Inkplate::getCursorX();

  • Method prototype (as seen in Adafruit_GFX.h):

int16_t getCursorX(void);
  • Arguments and return value:
    No arguments.

    Returns nothing.

  • Description:
    Returns text cursor x coordinate.
  • Example:
    if(display.getCursorX() > 400)
        Serial.println("Were in the second half of the screen!");
    

3.2.2.52. Inkplate::getCursorY();

  • Method prototype (as seen in Adafruit_GFX.h):

int16_t getCursorY(void);
  • Arguments and return value:
    No arguments.

    Returns nothing.

  • Description:
    Returns text cursor y coordinate.
  • Example:
    if(display.getCursorY() > 300)
        Serial.println("Were in the bottom half of the screen!");
    

3.2.3. IO Expander Functions

Depending on which Inkplate you have, there are 2, 1, or no GPIO expanders.
There are 2 types of GPIO expanders on the Inkplate boards: MCP23017 and PCAL6416A.
The table below shows which GPIO expanders can be found on which Inkplate.
We call them internal and external. The internal one is needed for the e-paper and PMIC
to work (on certain Inkplates), and the second is just for more GPIO pins if
users want to use them.
* You can use this pin as GPIO, but you have to cut the certain jumper and connect it to the other side because it originally has another functionality. This functionality is not necessarily needed for e-paper to work, but can be useful so we set it as the default.
** Some Inkplates have 1 MCP expander because of chip shortage so you can’t use any on the external IO expander
DO NOT USE pins that are not available!
Using those, you might permanently damage the screen. Usage is limited by the library,
but just in case don’t use them! For the specific pin purpose, see the hardware-reference.
If you look at the back of the Inkplate and follow the lines from the GPIO expander pins,
you will see the IO expander IC. If your Inkplate has a smaller one (QFN-24 package), it is PCAL.
If there is a bigger IC (28-pin SSOP package), it is the MCP expander.
The picture below shows the difference in their dimensions so you can easily recognize what expander your Inkplate has.
_images/PCALvsMCP.jpg
If you have a blue PCB, don’t worry. It is just old color before rebranding to Soldered. We also maintain it. It comes only with MCP expanders.
If your Inkplate has a PCAL expander, you must use the “Soldered Inkplate …”
board definition, otherwise choose the “e-radionica Inkplate …” board in Arduino IDE.
IO Expander is started inside Inkplate.begin() function so you need only to call
that and everything is set for IO Expander. All user pins on the expander are set
to pin mode OUTPUT and LOW state because of saving energy.
Inkplate display(INKPLATE_1BIT); // Or INKPLATE_3BIT
display.begin();
Inkplate 6COLOR has only one IO Expander used as an external IO expander.
Inkplate 2 has no IO Expanders so all these functions will not work on Inkplate 2!

3.2.3.1. Common Functions

3.2.3.1.1. Inkplate::ioBegin();

  • Method prototype (as seen in Mcp.h and Pcal.h):

bool ioBegin(uint8_t _addr, uint8_t *_r);
  • Arguments and return value:
    uint8_t _addr - IO Exapnder I2C address.
    uint8_t *_r - pointer to array to be writen in registers.
    Returns true if successful, false otherwise.
  • Description:
    ioBegin function starts io expander and sets registers values.

3.2.3.1.2. Inkplate::pinModeIO();

  • Method prototype (as seen in Mcp.h and Pcal.h):

void pinModeIO(uint8_t _pin, uint8_t _mode, uint8_t _io_id = IO_EXT_ADDR);
  • Arguments and return value:
    uint8_t _pin - pin number.
    uint8_t _mode - mode to be set (INPUT, OUTPUT or INPUT_PULLUP).
    uint8_t _io_id - internal or external io exapnder.
    Returns nothing.
  • Description:
    Sets io expander pin mode.
  • Example:
    display.pinModeIO(LED_PIN, OUTPUT);
    

3.2.3.1.3. Inkplate::pinModeInternal();

  • Method prototype (as seen in Mcp.h and Pcal.h):

void pinModeInternal(uint8_t _addr, uint8_t *_r, uint8_t _pin, uint8_t _mode);
  • Arguments and return value:
    uint8_t _addr - IO Exapnder I2C address.
    uint8_t *_r - pointer to array that holds io expander registers.
    uint8_t _pin - pin to set mode.
    uint8_t _mode - mode for pi to be set (INPUT=0x01, OUTPUT=0x02, INPUT_PULLUP=0x05).
    Returns nothing.
  • Description:
    pinModeInternal sets io expanders internal pin mode.

3.2.3.1.4. Inkplate::digitalWriteInternal();

  • Method prototype (as seen in Mcp.h and Pcal.h):

void digitalWriteInternal(uint8_t _addr, uint8_t *_r, uint8_t _pin, uint8_t _state);
  • Arguments and return value:
    uint8_t _addr - IO Exapnder I2C address.
    uint8_t *_r - pointer to array that holds io expander registers.
    uint8_t _pin - pin to set mode.
    uint8_t _state - output pin state (0 or 1).
    Returns nothing.
  • Description:
    digitalWriteInternal sets internal output pin state (1 or 0).

3.2.3.1.5. Inkplate::digitalWriteIO();

  • Method prototype (as seen in Mcp.h and Pcal.h):

void digitalWriteIO(uint8_t _pin, uint8_t _state, uint8_t _io_id = IO_EXT_ADDR);
  • Arguments and return value:
    uint8_t _pin - pin number.
    uint8_t _state - pin state (HIGH or LOW).
    uint8_t _io_id - internal or external io exapnder.
    Returns nothing.
  • Description:
    Sets io exapnder output pin state.
  • Example:
    display.digitalWriteIO(LED_PIN, HIGH);
    

3.2.3.1.6. Inkplate::digitalReadInternal();

  • Method prototype (as seen in Mcp.h and Pcal.h):

void digitalReadInternal(uint8_t _addr, uint8_t *_r, uint8_t _pin);
  • Arguments and return value:
    uint8_t _addr - io expander i2c address.
    uint8_t *_r - pointer to array that holds io expander registers.
    uint8_t _pin - pin to set mode.
    Returns nothing.
  • Description:
    digitalReadInternal reads io expander internal pin state.

3.2.3.1.7. Inkplate::digitalReadIO();

  • Method prototype (as seen in Mcp.h and Pcal.h):

uint8_t digitalReadIO(uint8_t _pin, uint8_t _io_id = IO_EXT_ADDR);
  • Arguments and return value:
    uint8_t _pin - pin number.
    uint8_t _io_id - internal or external io exapnder.
    Returns HIGH or LOW value (1 or 0).
  • Description:
    digitalReadIO reads io exapnder internal pin state.
  • Example:
    display.digitalReadIO(LED_PIN);
    

3.2.3.1.8. Inkplate::removeIntPin();

  • Method prototype (as seen in Mcp.h and Pcal.h):

void removeIntPin(uint8_t _pin, uint8_t _io_id = IO_EXT_ADDR);
  • Arguments and return value:
    uint8_t _pin - pin number.
    uint8_t _io_id - internal or external io exapnder.
    Returns nothing.
  • Description:
    Removes interrupt from pin.
  • Example:
    display.removeIntPin(touchPadPin);
    

3.2.3.1.9. Inkplate::removeIntPinInternal();

  • Method prototype (as seen in Mcp.h and Pcal.h):

void removeIntPinInternal(uint8_t _addr, uint8_t *_r, uint8_t _pin);
  • Arguments and return value:
    uint8_t _addr - io expander i2c address.
    uint8_t *_r - pointer to array that holds io expander registers.
    uint8_t _pin - pin number.
    Returns nothing.
  • Description:
    Removes interrupt from pin.

3.2.3.1.10. Inkplate::getINT();

  • Method prototype (as seen in Mcp.h and Pcal.h):

uint16_t getINT(uint8_t _io_id = IO_EXT_ADDR);
  • Arguments and return value:
    uint8_t _io_id - internal or external io exapnder.
    Returns interupt registers state.
  • Description:
    Returns interrupt registers state for portA and portB.
    Every bit represents interrupt pin, MSB is PORTB PIN7, LSB is PORTA PIN1.
  • Example:
    display.getINT();
    

3.2.3.1.11. Inkplate::setPorts();

  • Method prototype (as seen in Mcp.h and Pcal.h):

void setPorts(uint16_t _d, uint8_t _io_id = IO_EXT_ADDR);
  • Arguments and return value:
    uint16_t _d - value to be writen to port A and port B registers.
    uint8_t _io_id - internal or external io exapnder.
    Returns nothing.
  • Description:
    Sets internal state of PORTA and PORTB registers.
    MSB byte is for PORTB, LSB byte for PORTA.
  • Example:
    uint16_t data = 0xFFFF; // To make all bits ones
    display.setPorts(data);
    

3.2.3.1.12. Inkplate::setPortsInternal();

  • Method prototype (as seen in Mcp.h and Pcal.h):

void setPorts(uint8_t _addr, uint8_t *_r, uint16_t _d);
  • Arguments and return value:
    uint8_t _addr - io expander i2c address.
    uint8_t *_r - pointer to array that holds io expander registers.
    uint16_t _d - value to be writen to port A and port B registers.
    Returns nothing.
  • Description:
    setPortsInternal sets internal state of PORTAB registers.

3.2.3.1.13. Inkplate::getPorts();

  • Method prototype (as seen in Mcp.h and Pcal.h):

uint16_t getPorts(uint8_t _io_id = IO_EXT_ADDR);
  • Arguments and return value:
    uint8_t _io_id - internal or external io exapnder.
    Returns register states of PORTA and PORTB.
  • Description:
    Returns states of PORTA and PORTB registers.
    MSB byte is for PORTB, LSB is for PORTA.
  • Example:
    display.getPorts();
    

3.2.3.1.14. Inkplate::getPortsInternal();

  • Method prototype (as seen in Mcp.h and Pcal.h):

uint16_t getPortsInternal(uint8_t _addr, uint8_t *_r);
  • Arguments and return value:
    uint8_t _addr - io expander i2c address.
    uint8_t *_r pointer to array that holds io exapnder registers
    Returns register states of PORTA and PORTB.
  • Description:
    Returns internal states of PORTA and PORTB registers.
    MSB byte is for PORTB, LSB is for PORTA.

3.2.3.1.15. Inkplate::getINTInternal();

  • Method prototype (as seen in Mcp.h and Pcal.h):

uint16_t getINTInternal(uint8_t _addr, uint8_t *_r);
  • Arguments and return value:
    uint8_t _addr - io expander i2c address.
    uint8_t *_r - pointer to array that holds io exapnder registers.
    Returns interrupt state of both ports (INTF).
  • Description:
    getINTInternal function reads Interrupt pin state for all pins and return interrupt state of both ports.
    Every bit represents interrupt pin, MSB is PORTB PIN7, LSB is PORTA PIN1, bit can be set only if interrupt is enabled.

3.2.3.2. MCP Functions

3.2.3.2.1. Inkplate::readMCPRegisters();

  • Method prototype (as seen in Mcp.h):

void readMCPRegisters(uint8_t _addr, uint8_t *k);

or

void readMCPRegisters(uint8_t _addr, uint8_t _regName, uint8_t *k, uint8_t _n);
  • Arguments and return value:
    uint8_t _addr - io expander i2c address.
    uint8_t *_k - pointer to array to be writen in registers.
    uint8_t _regName - name of register where read will start.
    uint8_t _n - number of bites/registers to read.
    Returns nothing.
  • Description:
    readMCPRegisters function uses i2c to read all io expander registers.

3.2.3.2.2. Inkplate::updateRegister();

  • Method prototype (as seen in Mcp.h):

void updateRegister(uint8_t _addr, uint8_t _regName, uint8_t _d);

or

void updateRegister(uint8_t _addr, uint8_t _regName, uint8_t *k, uint8_t _n);
  • Arguments and return value:
    uint8_t _addr - io expander i2c address.
    uint8_t _regName - name of register where update will start.
    uint8_t _d - data to be uploaded.
    uint8_t *k - pointer to array that holds new data.
    uint8_t _n - number of bites/registers to write to.
    Returns nothing.
  • Description:
    updateRegister function uses i2c to update selected io expander register.

3.2.3.2.3. Inkplate::updateAllRegister();

  • Method prototype (as seen in Mcp.h):

void updateAllRegister(uint8_t _addr, uint8_t *k);
  • Arguments and return value:
    uint8_t _addr - io expander i2c address.
    uint8_t *k - pointer to array that holds new data.
    Returns nothing.
  • Description:
    updateAllRegisters function uses i2c to updates all io expander registers.

3.2.3.2.4. Inkplate::setIntOutput();

  • Method prototype (as seen in Mcp.h):

void setIntOutput(uint8_t intPort, uint8_t mirroring, uint8_t openDrain, uint8_t polarity);
  • Arguments and return value:
    uint8_t intPort - portA or portB.
    uint8_t mirroring - set 1 to make ports mirror each other so that any interrupt will cause both to go HIGH.
    uint8_t openDrain - set 1 to set interupt port as open drain, this will override port polarity.
    uint8_t polarity - sets port interrupt polarity, 1 active high, 0 active low.
    Returns nothing.
  • Description:
    setIntOutput sets io exapnder interrupt port state.
  • Example:
    display.setIntOutput(1, false, false, HIGH); // 1 means portB, 0 portA
    

3.2.3.2.5. Inkplate::setIntOutputInternal();

  • Method prototype (as seen in Mcp.h):

void setIntOutputInternal(uint8_t _addr, uint8_t *_r, uint8_t intPort, uint8_t mirroring, uint8_t openDrain, uint8_t polarity);
  • Arguments and return value:
    uint8_t _addr - io expander i2c address.
    uint8_t *_r - pointer to array that holds io expander registers.
    uint8_t intPort - portA or portB.
    uint8_t mirroring - set 1 to make ports mirror each other so that any interrupt will.
    uint8_t openDrain - set 1 to set interupt port as open drain, this will override.
    uint8_t polarity - sets port interrupt polarity, 1 active high, 0 active low.
    Returns nothing.
  • Description:
    setIntOutputInternal sets io expander interrupt port state.

3.2.3.2.6. Inkplate::setIntPin();

  • Method prototype (as seen in Mcp.h):

void setIntPin(uint8_t _pin, uint8_t _mode);
  • Arguments and return value:
    uint8_t _pin - pin number.
    uint8_t _mode - interurpt mode (CHANGE, FALLING, RISING).
    Returns nothing.
  • Description:
    setIntPin function sets io exapnder interupt mode.
  • Example:
    display.setIntPin(touchPadPin, RISING);
    

3.2.3.2.7. Inkplate::setIntPinInternal();

  • Method prototype (as seen in Mcp.h):

void setIntPinInternal(uint8_t _addr, uint8_t *_r, uint8_t _pin, uint8_t _mode);
  • Arguments and return value:
    uint8_t _addr - io expander i2c address.
    uint8_t *_r - pointer to array that holds io expander registers.
    uint8_t _pin - pin to set interrupt mode to.
    uint8_t mode - interurpt mode (CHANGE, FALLING, RISING).
    Returns nothing.
  • Description:
    setIntPinInternal function sets io expander interupt internal mode.

3.2.3.2.8. Inkplate::getINTstate();

  • Method prototype (as seen in Mcp.h):

uint16_t getINTstate();
  • Arguments and return value:
    No argument.
    Returns interupt registers state at the time interrupt occured.
  • Description:
    Returns interrupt registers state for portA and portB.
    Every bit represents interrupt pin, MSB is PORTB PIN7, LSB is PORTA PIN1.
  • Example:
    display.getINTstate();
    

3.2.3.2.9. Inkplate::getINTstateInternal();

  • Method prototype (as seen in Mcp.h):

uint16_t getINTstateInternal(uint8_t _addr, uint8_t *_r);
  • Arguments and return value:
    uint8_t _addr - io expander i2c address.
    uint8_t *_r - pointer to array that holds io expander registers.
    Returns interupt registers state at the time interrupt occured.
  • Description:
    Returns interrupt registers state for portA and portB.
    Every bit represents interrupt pin, MSB is PORTB PIN7, LSB is PORTA PIN1.

3.2.3.2.10. Inkplate::readMCPRegister();

  • Method prototype (as seen in Mcp.h):

void readMCPRegister(uint8_t _addr, uint8_t _regName, uint8_t *k);
  • Arguments and return value:
    uint8_t _addr - io expander i2c address.
    uint8_t _regName - name of register where read will start.
    uint8_t *_k - pointer to array where io exapnder registers will be stored.
    Returns nothing.
  • Description:
    readMCPRegisters function uses i2c to read one selected io exapnder register.

3.2.3.3. PCAL Functions

3.2.3.3.1. Inkplate::setIntPin();

  • Method prototype (as seen in Pcal.h):

void setIntPin(uint8_t _pin, uint8_t _ioID = IO_EXT_ADDR);
  • Arguments and return value:
    uint8_t _pin - pin to set interrupt mode to.
    uint8_t _ioID - internal or external IO Exapnder.
    Returns nothing.
  • Description:
    setIntPin function enables interrupt on change on IO Expander pin.

3.2.3.3.2. Inkplate::setIntPinInternal();

  • Method prototype (as seen in Pcal.h):

void setIntPinInternal(uint8_t _addr, uint8_t *_r, uint8_t _pin);
  • Arguments and return value:
    uint8_t _addr - IO Exapnder I2C address.
    uint8_t *_r - pointer to array that holds IO Exapnder registers.
    uint8_t *_pin - selected pin.
    Returns nothing.
  • Description:
    setIntPinInternal function sets Interrupt on selected pin.

3.2.3.3.3. Inkplate::getPortsInternal();

  • Method prototype (as seen in Pcal.h):

uint16_t getPortsInternal(uint8_t _addr, uint8_t *_r);
  • Arguments and return value:
    uint8_t _addr - IO Exapnder I2C address.
    uint8_t *_r - pointer to array that holds IO Exapnder registers.
    Returns register states of PORTSAB.
  • Description:
    getPortsInternal gets register state of PORTSAB.

3.2.3.3.4. Inkplate::getInternalRegisterArray();

  • Method prototype (as seen in Pcal.h):

uint8_t *getInternalRegisterArray(uint8_t _addr);
  • Arguments and return value:
    uint8_t _addr - IO Exapnder I2C address.
    Pointer to the PCAL6416 register array.
  • Description:
    Function returns the pointer to the array of PCAL6416 copy of internal registers that depends on the I2C address of the IO Expander.

3.2.3.3.5. Inkplate::readPCALRegisters();

  • Method prototype (as seen in Pcal.h):

void readPCALRegisters(uint8_t _addr, uint8_t *k);

or

void readPCALRegisters(uint8_t _addr, uint8_t _regIndex, uint8_t *k, uint8_t _n);
  • Arguments and return value:
    uint8_t _addr - IO Exapnder I2C address.
    uint8_t *_k - pointer to array where pcal registers will be stored.
    uint8_t _regIndex - Start index of the PCAL6416 registers.
    uint8_t _n - number of bites/registers to read.
    Returns nothing.
  • Description:
    readPCALRegisters function uses I2C to read selected pcal registers.

3.2.3.3.6. Inkplate::readPCALRegister();

  • Method prototype (as seen in Pcal.h):

void readPCALRegister(uint8_t _addr, uint8_t _regIndex, uint8_t *_k);
  • Arguments and return value:
    uint8_t _addr - IO Exapnder I2C address.
    uint8_t _regIndex - Start index of the PCAL6416 registers.
    uint8_t *_k pointer to array where pcal registers will be stored.
    Returns nothing.
  • Description:
    readPCALRegister function uses I2C to read one selected pcal register.

3.2.3.3.7. Inkplate::updatePCALAllRegisters();

  • Method prototype (as seen in Pcal.h):

void updatePCALAllRegisters(uint8_t _addr, uint8_t *_k);
  • Arguments and return value:
    uint8_t _addr - IO Exapnder I2C address.
    uint8_t *_k - pointer to array where data to be uploaded is stored.
    Returns nothing.
  • Description:
    updatePCALAllRegisters function uses I2C to updates all pcal registers.

3.2.3.3.8. Inkplate::updatePCALRegister();

  • Method prototype (as seen in Pcal.h):

void updatePCALRegister(uint8_t _addr, uint8_t _regIndex, uint8_t _d);

or

void updatePCALRegister(uint8_t _addr, uint8_t _regIndex, uint8_t *_k, uint8_t _n);
  • Arguments and return value:
    uint8_t _addr - IO Exapnder I2C address.
    uint8_t _regIndex - Start index of the PCAL6416 registers.
    uint8_t _d - data to be uploaded.
    uint8_t *_k pointer to array that holds new data.
    uint8_t _n - number of bites/registers to write to.
    Returns nothing.
  • Description:
    updatePCALRegister function uses I2C to update some selected pcal registers.

3.2.4. NetworkClient Functions

3.2.4.1. WiFi connectivity

For some functionalities of the Inkplate to work you must be connected to WiFi.
For more information see our examples.
#include "Inkplate.h"
#include <WiFi.h>
#include <HTTPClient.h>

const char ssid = "Wifi_name"
const char pass = "password"

...

// In setup
while(!display.joinAP(ssid, pass))
{
    Serial.println("Connecting to wifi");
}

// After you can check if connection active
if((display.isConnected))
{
    HTTPClient http;

    http.begin("http://example.com/index.html");

    int httpCode = http.GET();

    if(httpCode > 0)
    {
        if(httpCode == HTTP_CODE_OK)
        {
            String payload = http.getString();

            ...
        }
    }
}

3.2.4.2. Inkplate::joinAP();

  • Method prototype (as seen in NetworkClient.h):

bool joinAP(const char *ssid, const char *pass);
  • Arguments and return value:
    const char *ssid - name of the wifi network.
    const xhar *pass - network password.
    Returns 1 if successfuly connected, 0 if not.
  • Description:
    Sets and connects inkplate to on wifi network.
  • Example:
    //In setup
    while(!display.joinAP(ssid, pass))
    {
        Serial.println("Connecting to wifi");
    }
    

3.2.4.3. Inkplate::disconnect();

  • Method prototype (as seen in NetworkClient.h):

void disconnect();
  • Arguments and return value:
    No arguments.
    Returns nothing.
  • Description:
    Disconnects Inkplate from wifi network (shuts network).
  • Example:
    display.disconnect();
    

3.2.4.4. Inkplate::isConnected();

  • Method prototype (as seen in NetworkClient.h):

bool isConnected();
  • Arguments and return value:
    No arguments.
    Returns 1 if connected to wifi, 0 if not.
  • Description:
    Checks if inkplate is connected to wifi.
  • Example:
    Serial.println(display.isConnected());
    

3.2.4.5. Inkplate::downloadFile();

  • Method prototype (as seen in NetworkClient.h):

uint8_t *downloadFile(const char *url, int32_t *defaultLen);
uint8_t *downloadFile(WiFiClient *url, int32_t len);
  • Arguments and return value:
    const char *url - link to file.
    int32_t *defaultLen - expected lenght (only matters if real length cant be checked).
    Returns file as byte buffer, NULL if failed to get file.
    WiFiClient *url - link to file
    int32_t *len - expected lenght (only matters if real length cant be checked).
    Returns file as byte buffer, NULL if failed to get file.
  • Description:
    Downloads file from given url.
  • Example:
    char url = "https//:www.somepic.com/pic.jpg"
    int32_t len = 54373;
    jpeg file = display.downloadFile(url, len);
    

3.2.5. Real-Time clock Functions

Note: Inkplate 2 doesn’t have dedicated RTC IC, but it has RTC built-in inside ESP32 that is not as precise as dedicated RTC IC, but it can be used for timekeeping, just time needs to be refreshed (updated) at least once a day using WiFi and NTP. Also, can’t keep time, when there is no power (doesn’t have RTC backup battery).

3.2.5.1. Inkplate::rtcSetTime();

  • Method prototype (as seen in System.h):

void rtcSetTime(uint8_t rtcHour, uint8_t rtcMinute, uint8_t rtcSecond);
  • Arguments and return value:
    uint8_t rtcHour - Set the rtcHour.
    uint8_t rtcMinute - Set the minutes.
    uint8_t rtcSeconds - Set the seconds.
    No return.
  • Description:
    Method to set time.

3.2.5.2. Inkplate::rtcSetDate();

  • Method prototype (as seen in System.h):

void rtcSetDate(uint8_t rtcWeekday, uint8_t rtcDay, uint8_t rtcMonth, uint16_t yr);
  • Arguments and return value:
    uint8_t rtcWeekday - Set the day of the week.
    uint8_t rtcDay - Set the day.
    uint8_t rtcMonth - Set the month.
    uint8_t yr - Set the year.
    No return.
  • Description:
    Method to set date.

3.2.5.3. Inkplate::rtcSetEpoch();

  • Method prototype (as seen in System.h):

void rtcSetEpoch(uint32_t _epoch);
  • Arguments and return value:
    uint32_t _epoch - RTC epoch.
    No return.
  • Description:
    Method to set time and date using epoch

3.2.5.4. Inkplate::rtcGetEpoch();

  • Method prototype (as seen in System.h):

uint32_t rtcGetEpoch();
  • Arguments and return value:
    No arguments.
    Returns the current epoch
  • Description:
    Method to get time and date using epoch

3.2.5.5. Inkplate::rtcGetRtcData();

  • Method prototype (as seen in System.h):

void rtcGetRtcData();
  • Arguments and return value:
    No arguments.
    No return.
  • Description:
    Reads time and date from the RTC.

3.2.5.6. Inkplate::rtcGetSecond();

  • Method prototype (as seen in System.h):

uint8_t rtcGetSecond();
  • Arguments and return value:
    No arguments.
    Returns the current seconds.
  • Description:
    Reads seconds from the RTC.

3.2.5.7. Inkplate::rtcGetMinute();

  • Method prototype (as seen in System.h):

uint8_t rtcGetMinute();
  • Arguments and return value:
    No arguments.
    Returns the current minutes.
  • Description:
    Reads minutes from the RTC.

3.2.5.8. Inkplate::rtcGetHour();

  • Method prototype (as seen in System.h):

uint8_t rtcGetHour();
  • Arguments and return value:
    No arguments.
    Returns the current hours.
  • Description:
    Reads hours from the RTC.

3.2.5.9. Inkplate::rtcGetDay();

  • Method prototype (as seen in System.h):

uint8_t rtcGetDay();
  • Arguments and return value:
    No arguments.
    Returns the current day.
  • Description:
    Reads day from the RTC.

3.2.5.10. Inkplate::rtcGetWeekday();

  • Method prototype (as seen in System.h):

uint8_t rtcGetWeekday();
  • Arguments and return value:
    No arguments.
    Returns the current weekday.
  • Description:
    Reads weekday from the RTC.

3.2.5.11. Inkplate::rtcGetMonth();

  • Method prototype (as seen in System.h):

uint8_t rtcGetMonth();
  • Arguments and return value:
    No arguments.
    Returns the current month.
  • Description:
    Reads month from the RTC.

3.2.5.12. Inkplate::rtcGetYear();

  • Method prototype (as seen in System.h):

uint8_t rtcGetYear();
  • Arguments and return value:
    No arguments.
    Returns the current year.
  • Description:
    Reads year from the RTC.

3.2.5.13. Inkplate::rtcEnableAlarm();

  • Method prototype (as seen in System.h):

void rtcEnableAlarm();
  • Arguments and return value:
    No arguments.
    No return.
  • Description:
    Enables the alarm of the RTC.

3.2.5.14. Inkplate::rtcSetAlarm();

  • Method prototype (as seen in System.h):

void rtcSetAlarm(uint8_t rtcAlarmSecond, uint8_t rtcAlarmMinute, uint8_t rtcAlarmHour, uint8_t rtcAlarmDay, uint8_t rtcAlarmWeekday);
  • Arguments and return value:
    uint8_t rtcAlarmSecond - Set the alarm seconds
    uint8_t rtcAlarmMinute - Set the alarm minutes
    uint8_t rtcAlarmHour - Set the alarm hours
    uint8_t rtcAlarmDay - Set the alarm day
    uint8_t rtcAlarmWeekday - Set the alarm weekday
    No return.
  • Description:
    Sets the alarm to all the params.

3.2.5.15. Inkplate::rtcSetAlarmEpoch();

  • Method prototype (as seen in System.h):

void rtcSetAlarmEpoch(uint32_t _epoch, uint8_t _match);
  • Arguments and return value:
    uint32_t _epoch - RTC Epoch alarm
    uint8_t _match - RTC Match
    No return.
  • Description:
    Set alarm using epoch.

3.2.5.16. Inkplate::rtcReadAlarm();

  • Method prototype (as seen in System.h):

void rtcReadAlarm();
  • Arguments and return value:
    No arguments
    No return.
  • Description:
    Reads the alarm of the RTC.

3.2.5.17. Inkplate::rtcGetAlarmSecond();

  • Method prototype (as seen in System.h):

uint8_t rtcGetAlarmSecond();
  • Arguments and return value:
    No arguments.
    Returns current alarm seconds.
  • Description:
    Get seconds alarm is set to.

3.2.5.18. Inkplate::rtcGetAlarmMinute();

  • Method prototype (as seen in System.h):

uint8_t rtcGetAlarmMinute();
  • Arguments and return value:
    No arguments.
    Returns current alarm minutes.
  • Description:
    Get minutes alarm is set to.

3.2.5.19. Inkplate::rtcGetAlarmHour();

  • Method prototype (as seen in System.h):

uint8_t rtcGetAlarmHour();
  • Arguments and return value:
    No arguments.
    Returns current alarm hours.
  • Description:
    Get hours alarm is set to.

3.2.5.20. Inkplate::rtcGetAlarmDay();

  • Method prototype (as seen in System.h):

uint8_t rtcGetAlarmDay();
  • Arguments and return value:
    No arguments.
    Returns current alarm day.
  • Description:
    Get day alarm is set to.

3.2.5.21. Inkplate::rtcGetAlarmWeekday();

  • Method prototype (as seen in System.h):

uint8_t rtcGetAlarmWeekday();
  • Arguments and return value:
    No arguments.
    Returns current alarm weekday.
  • Description:
    Get weekday alarm is set to.

3.2.5.22. Inkplate::rtcTimerSet();

  • Method prototype (as seen in System.h):

void rtcTimerSet(rtcCountdownSrcClock source_clock, uint8_t value, bool int_enable, bool int_pulse);
  • Arguments and return value:
    rtcCountdownSrcClock source_clock - timer clock frequency
    bool int_enable - timer interrupt enable, 0 means no interrupt generated from timer, 1 means interrupt is generated from timer
    bool int_pulse - timer interrupt mode, 0 means interrupt follows timer flag, 1 means interrupt generates a pulse
    No return.
  • Description:
    Sets the timer countdown.

3.2.5.23. Inkplate::rtcCheckTimerFlag();

  • Method prototype (as seen in System.h):

bool rtcCheckTimerFlag();
  • Arguments and return value:
    No arguments.
    Returns true if the timer flag is on.
  • Description:
    Returns timer flag .

3.2.5.24. Inkplate::rtcCheckAlarmFlag();

  • Method prototype (as seen in System.h):

bool rtcCheckAlarmFlag();
  • Arguments and return value:
    No arguments.
    Returns true if the alarm flag is on.
  • Description:
    Returns is the alarm flag on.

3.2.5.25. Inkplate::rtcClearAlarmFlag();

  • Method prototype (as seen in System.h):

void rtcClearAlarmFlag();
  • Arguments and return value:
    No arguments.
    No return.
  • Description:
    Clears alarm flag.

3.2.5.26. Inkplate::rtcClearTimerFlag();

  • Method prototype (as seen in System.h):

void rtcClearTimerFlag();
  • Arguments and return value:
    No arguments.
    No return.
  • Description:
    Clears timer flag.

3.2.5.27. Inkplate::rtcDisableTimer();

  • Method prototype (as seen in System.h):

void rtcDisableTimer();
  • Arguments and return value:
    No arguments.
    No return.
  • Description:
    Disables the timer.

3.2.5.28. Inkplate::rtcIsSet();

  • Method prototype (as seen in System.h):

bool rtcIsSet();
  • Arguments and return value:
    No arguments.
    Returns true if RTC is set, false if it’s not
  • Description:
    Check if the RTC is already set.

3.2.5.29. Inkplate::rtcReset();

  • Method prototype (as seen in System.h):

void rtcReset();
  • Arguments and return value:
    No arguments.
    No return.
  • Description:
    Resets the timer.

3.2.5.30. Inkplate::rtcDecToBcd();

  • Method prototype (as seen in System.h):

uint8_t rtcDecToBcd(uint8_t val);
  • Arguments and return value:
    uint8_t val - number which needs to be converted from decimal to Bcd value
    Returns converted number.
  • Description:
    Converts decimal to BCD.

3.2.5.31. Inkplate::rtcBcdToDec();

  • Method prototype (as seen in System.h):

uint8_t rtcrtcBcdToDec(uint8_t val);
  • Arguments and return value:
    uint8_t val - number which needs to be converted from Vcd to decimal value
    Returns converted number
  • Description:
    Converts BCD to decimal

3.2.6. Touchscreen

Note: Only Inkplate 6PLUS has built-in touchscreen

3.2.6.1. Inkplate::touchInArea();

  • Method prototype (as seen in System.h):

bool touchInArea(int16_t x1, int16_t y1, int16_t w, int16_t h);
  • Arguments and return value:
    int16_t x1 - rectangle top left corner x plane.
    int16_t y1 - rectangle top left corner y plane.
    int16_t w - rectangle width.
    int16_t h - rectangle height.
    Returns true if successful, false if failed.
  • Description:
    touchInArea checks if touch occured in given rectangle area

3.2.6.2. Inkplate::tsWriteRegs();

  • Method prototype (as seen in System.h):

uint8_t tsWriteRegs(uint8_t _addr, const uint8_t *_buff, uint8_t _size);
  • Arguments and return value:
    int16_t _addr - touchscreen register address.
    int16_t* _buff - buffer to write into touchscreen registers.
    int16_t _size - number of bytes to write.
    Returns 1 on successful write, 0 on fail.
  • Description:
    tsWriteRegs writes data to touchscreen registers

3.2.6.3. Inkplate::tsReadRegs();

  • Method prototype (as seen in System.h):

void tsWriteRegs(uint8_t _addr, const uint8_t *_buff, uint8_t _size);
  • Arguments and return value:
    int16_t _addr - touchscreen register address.
    int16_t* _buff - buffer to read touchscreen register content from.
    int16_t _size - number of bytes to write.
    No return.
  • Description:
    tsReadRegs returns touchscreen registers content

3.2.6.4. Inkplate::tsHardwareReset();

  • Method prototype (as seen in System.h):

void tsHardwareReset();
  • Arguments and return value:
    No arguments.
    No return.
  • Description:
    tsHardwareReset resets ts hardware

3.2.6.5. Inkplate::tsSoftwareReset();

  • Method prototype (as seen in System.h):

bool tsSoftwareReset();
  • Arguments and return value:
    No arguments.
    Returns true if successful, false if failed.
  • Description:
    tsSoftwareReset resets toucscreen software

3.2.6.6. Inkplate::tsInit();

  • Method prototype (as seen in System.h):

bool tsInit(uint8_t _pwrState);
  • Arguments and return value:
    uint8_t _pwrState - power state for touchScreen.
    Returns true if successful, false if failed.
  • Description:
    tsInit starts touchscreen and sets ts registers

3.2.6.7. Inkplate::tsShutdown();

  • Method prototype (as seen in System.h):

void tsShutdown();
  • Arguments and return value:
    No arguments.
    No return.
  • Description:
    tsShutdown turns off touchscreen power.

3.2.6.8. Inkplate::tsGetRawData();

  • Method prototype (as seen in System.h):

void tsGetRawData(uint8_t *b);
  • Arguments and return value:
    uint8_t* b - pointer to store register content
    No return.
  • Description:
    tsGetRawData gets touchscreen register content.

3.2.6.9. Inkplate::tsGetXY();

  • Method prototype (as seen in System.h):

void tsGetXY(uint8_t *_d, uint16_t *x, uint16_t *y);
  • Arguments and return value:
    uint8_t* b - pointer to register content of touchscreen register (data must be adapted, cant use raw data)
    uint16_t* x - pointer to store x plane data
    uint16_t* y - pointer to store y plane data
    No return.
  • Description:
    sGetXY gets x and y plane values.

3.2.6.10. Inkplate::tsGetData();

  • Method prototype (as seen in System.h):

uint8_t tsGetData(uint16_t *xPos, uint16_t *yPos);
  • Arguments and return value:
    uint16_t* xPos - pointer to store x position of finger
    uint16_t* yPos - pointer to store y position of finger
    Returns number of fingers currently on screen.
  • Description:
    tsGetData checks x, y position and returns number of fingers on screen.

3.2.6.11. Inkplate::tsGetResolution();

  • Method prototype (as seen in System.h):

void tsGetResolution(uint16_t *xRes, uint16_t *yRes);
  • Arguments and return value:
    uint16_t* xRes - pointer to store x position of finger
    uint16_t* yRes - pointer to store y position of finger
    Returns number of fingers currently on screen.
  • Description:
    tsGetResolution gets touchscreen resolution for x and y.

3.2.6.12. Inkplate::tsSetPowerState();

  • Method prototype (as seen in System.h):

void tsSetPowerState(uint8_t _s);
  • Arguments and return value:
    uint8_t* _s - pointer to store x position of finger
    No return.
  • Description:
    tsSetPowerState sets power state of touchscreen.

3.2.6.13. Inkplate::tsGetPowerState();

  • Method prototype (as seen in System.h):

uint8_t tsGetPowerState();
  • Arguments and return value:
    uint8_t* _s - pointer to store x position of finger
    Returns touchscreen power state, 1 if powered, 0 if not.
  • Description:
    tsGetPowerState checks if touchscreen is powered up.

3.2.6.14. Inkplate::tsAvailable();

  • Method prototype (as seen in System.h):

uint8_t tsAvailable();
  • Arguments and return value:
    uint8_t* _s - pointer to store x position of finger
    Returns tsflag, 1 for available touchscreen, 0 if not.
  • Description:
    tsAvailable checks for touch screen functionality.

3.2.7. Inkplate 4TEMPERA

This section is regarding the specific sensors and peripherals related to Inkplate 4TEMPERA.

3.2.7.1. Inkplate::buzzer.init();

  • Method prototype (as seen in Buzzer.h):

void begin();
  • Description:
    Initialize usage of the on-board buzzer.

3.2.7.2. Inkplate::buzzer.beep();

  • Method prototype (as seen in Buzzer.h):

void beep(uint32_t length, int freq);
  • Arguments and return value:
    uint32_t length - how long in ms to sound the buzzer
    int freq - the (approximate) frequency of the buzzer (optional)
  • Description:
    A blocking function which beeps the buzzer for a certain amount of time at a certain frequency. Frequencies from 572 to 2933 Hz are supported. Only the length parameter is required.

3.2.7.3. Inkplate::buzzer.beepOn();

  • Method prototype (as seen in Buzzer.h):

void beepOn(int freq);
  • Arguments and return value:
    int freq - the (approximate) frequency of the buzzer (optional)
  • Description:
    A function which starts beeping the buzzer indefinately. It has to be stopped with beepOff(). Frequencies from 572 to 2933 Hz are supported.

3.2.7.4. Inkplate::buzzer.beepOff();

  • Method prototype (as seen in Buzzer.h):

void beepOff();
  • Description:
    Stop the buzzer’s beeping, started by beepOn().

3.2.7.5. Inkplate::bme680.begin();

  • Method prototype (as seen in BME680-SOLDERED.h):

bool begin();
  • Arguments and return value:
    bool initOK - the function returns true if the BME680 sensor has initialized OK
  • Description:
    A function which initializes the BME680 sensor, it must be called before using the sensor

3.2.7.6. Inkplate::bme680.readTemperature();

  • Method prototype (as seen in BME680-SOLDERED.h):

float readTemperature();
  • Arguments and return value:
    float temperature - the temperature from the sensor
  • Description:
    Read the temperature as a flaot from the BME680 sensor.

3.2.7.7. Inkplate::bme680.readPressure();

  • Method prototype (as seen in BME680-SOLDERED.h):

float readPressure();
  • Arguments and return value:
    float pressure - the pressure from the sensor
  • Description:
    Read the pressure as a float from the BME680 sensor.

3.2.7.8. Inkplate::bme680.readHumidity();

  • Method prototype (as seen in BME680-SOLDERED.h):

float readHumidity();
  • Arguments and return value:
    float humidity - the humidity from the sensor
  • Description:
    Read the humidity as a float from the BME680 sensor.

3.2.7.9. Inkplate::bme680.readAltitude();

  • Method prototype (as seen in BME680-SOLDERED.h):

float readAltitude();
  • Arguments and return value:
    float altitude - the altitude calculated from sensor readings
  • Description:
    Calculate and read the altitude as a float based on pressure readings from the BME680 sensor.

3.2.7.10. Inkplate::bme680.readGasResistance();

  • Method prototype (as seen in BME680-SOLDERED.h):

float readGasResistance();
  • Arguments and return value:
    float gasResistance - the gas resistance from the sensor
  • Description:
    Read the gas resistance as a float from the BME680 sensor.

3.2.7.11. Inkplate::bme680.readSensorData();

  • Method prototype (as seen in BME680-SOLDERED.h):

void readSensorData(float &temp, float &humidity, float &pressure, float &gas);
  • Arguments and return value:
    float &temp - address where the temperature data from the sensor is saved
    float &humidity - address where the humidity data from the sensor is saved
    float &pressure - address where the pressure data from the sensor is saved
    float &gas - address where the gas resistance data from the sensor is saved
    Returns nothing.
  • Description:
    Reads the sensor data for temperature, humidity, pressure, and gas resistance and saves the data to the provided addresses.

3.2.7.12. Inkplate::lsm6ds3.begin();

  • Method prototype (as seen in LSM6DS3-SOLDERED.h):

status_t begin();
  • Arguments and return value:
    returns status_t - a status variable which will indicate if init was sucessful. 0 is IMU_SUCCESS. For details on other possible values of status_t, check SparkFunLSM6DS3.h within the library.
  • Description:
    A function which initializes the LSM6DS3 accelerometer/gyroscope. It must be called before using it.

3.2.7.13. Inkplate::LSM6DS3.readRawAccelX();

  • Method prototype (as seen in LSM6DS3.h):

int16_t readRawAccelX( void );
  • Arguments and return value:
    Returns int16_t - the raw acceleration data in the X-axis
  • Description:
    Read the raw acceleration data in the X-axis from the LSM6DS3 sensor.

3.2.7.14. Inkplate::LSM6DS3.readRawAccelY();

  • Method prototype (as seen in LSM6DS3.h):

int16_t readRawAccelY( void );
  • Arguments and return value:
    Returns int16_t - the raw acceleration data in the Y-axis
  • Description:
    Read the raw acceleration data in the Y-axis from the LSM6DS3 sensor.

3.2.7.15. Inkplate::LSM6DS3.readRawAccelZ();

  • Method prototype (as seen in LSM6DS3.h):

int16_t readRawAccelZ( void );
  • Arguments and return value:
    Returns int16_t - the raw acceleration data in the Z-axis
  • Description:
    Read the raw acceleration data in the Z-axis from the LSM6DS3 sensor.

3.2.7.16. Inkplate::LSM6DS3.readRawGyroX();

  • Method prototype (as seen in LSM6DS3.h):

int16_t readRawGyroX( void );
  • Arguments and return value:
    Returns int16_t - the raw gyroscope data in the X-axis
  • Description:
    Read the raw gyroscope data in the X-axis from the LSM6DS3 sensor.

3.2.7.17. Inkplate::LSM6DS3.readRawGyroY();

  • Method prototype (as seen in LSM6DS3.h):

int16_t readRawGyroY( void );
  • Arguments and return value:
    Returns int16_t - the raw gyroscope data in the Y-axis
  • Description:
    Read the raw gyroscope data in the Y-axis from the LSM6DS3 sensor.

3.2.7.18. Inkplate::LSM6DS3.readRawGyroZ();

  • Method prototype (as seen in LSM6DS3.h):

int16_t readRawGyroZ( void );
  • Arguments and return value:
    Returns int16_t - the raw gyroscope data in the Z-axis
  • Description:
    Read the raw gyroscope data in the Z-axis from the LSM6DS3 sensor.

3.2.7.19. Inkplate::LSM6DS3.readFloatAccelX();

  • Method prototype (as seen in LSM6DS3.h):

float readFloatAccelX( void );
  • Arguments and return value:
    Returns float - the acceleration data in the X-axis converted to g’s
  • Description:
    Read and convert the raw acceleration data in the X-axis to g’s from the LSM6DS3 sensor.

3.2.7.20. Inkplate::LSM6DS3.readFloatAccelY();

  • Method prototype (as seen in LSM6DS3.h):

float readFloatAccelY( void );
  • Arguments and return value:
    Returns float - the acceleration data in the Y-axis converted to g’s
  • Description:
    Read and convert the raw acceleration data in the Y-axis to g’s from the LSM6DS3 sensor.

3.2.7.21. Inkplate::LSM6DS3.readFloatAccelZ();

  • Method prototype (as seen in LSM6DS3.h):

float readFloatAccelZ( void );
  • Arguments and return value:
    Returns float - the acceleration data in the Z-axis converted to g’s
  • Description:
    Read and convert the raw acceleration data in the Z-axis to g’s from the LSM6DS3 sensor.

3.2.7.22. Inkplate::LSM6DS3.readFloatGyroX();

  • Method prototype (as seen in LSM6DS3.h):

float readFloatGyroX( void );
  • Arguments and return value:
    Returns float - the gyroscope data in the X-axis converted to degrees per second
  • Description:
    Read and convert the raw gyroscope data in the X-axis to degrees per second from the LSM6DS3 sensor.

3.2.7.23. Inkplate::LSM6DS3.readFloatGyroY();

  • Method prototype (as seen in LSM6DS3.h):

float readFloatGyroY( void );
  • Arguments and return value:
    Returns float - the gyroscope data in the Y-axis converted to degrees per second
  • Description:
    Read and convert the raw gyroscope data in the Y-axis to degrees per second from the LSM6DS3 sensor.

3.2.7.24. Inkplate::LSM6DS3.readFloatGyroZ();

  • Method prototype (as seen in LSM6DS3.h):

float readFloatGyroZ( void );
  • Arguments and return value:
    Returns float - the gyroscope data in the Z-axis converted to degrees per second
  • Description:
    Read and convert the raw gyroscope data in the Z-axis to degrees per second from the LSM6DS3 sensor.

3.2.7.25. Inkplate::battery.begin();

  • Method prototype (as seen in SparkFunBQ27441.h):

void begin();
  • Description:
    Initialize the fuel gauge, the on-board chip which measures the charge state of the battery

3.2.7.26. Inkplate::battery.setCapacity();

  • Method prototype (as seen in SparkFunBQ27441.h):

void setCapacity(uint16_t capacity);
  • Arguments and return value:
    uint16_t capacity - the total capacity of the battery in milliamp-hours (mAh)
    Returns nothing.
  • Description:
    Sets the BQ27441 fuel gauge’s battery capacity, which is used to calculate the charge percentage. The capacity parameter should reflect the total capacity of the battery being used. Default battery which ships with the device is 1200mAh.

3.2.7.27. Inkplate::battery.voltage();

  • Method prototype (as seen in SparkFunBQ27441.h):

uint16_t voltage(void);
  • Arguments and return value:
    Returns uint16_t - battery voltage in millivolts (mV)
  • Description:
    Reads and returns the battery voltage.

3.2.7.28. Inkplate::battery.current();

  • Method prototype (as seen in SparkFunBQ27441.h):

int16_t current(current_measure type = AVG);
  • Arguments and return value:
    current_measure type - enum specifying the current value to be read (default is AVG)
    Returns int16_t - specified current measurement in milliamps (mA). A positive value indicates charging.
  • Description:
    Reads and returns the specified current measurement.

3.2.7.29. Inkplate::battery.capacity();

  • Method prototype (as seen in SparkFunBQ27441.h):

uint16_t capacity(capacity_measure type = REMAIN);
  • Arguments and return value:
    capacity_measure type - enum specifying the capacity value to be read (default is REMAIN)
    Returns uint16_t - specified capacity measurement in milliamp-hours (mAh).
  • Description:
    Reads and returns the specified capacity measurement.

3.2.7.30. Inkplate::battery.power();

  • Method prototype (as seen in SparkFunBQ27441.h):

int16_t power(void);
  • Arguments and return value:
    Returns int16_t - measured average power in milliwatts (mW). A positive value indicates charging.
  • Description:
    Reads and returns measured average power.

3.2.7.31. Inkplate::battery.soc();

  • Method prototype (as seen in SparkFunBQ27441.h):

uint16_t soc(soc_measure type = FILTERED);
  • Arguments and return value:
    soc_measure type - enum specifying filtered or unfiltered measurement (default is FILTERED)
    Returns uint16_t - specified state of charge measurement in percentage (%).
  • Description:
    Reads and returns specified state of charge measurement.

3.2.7.32. Inkplate::battery.soh();

  • Method prototype (as seen in SparkFunBQ27441.h):

uint8_t soh(soh_measure type = PERCENT);
  • Arguments and return value:
    soh_measure type - enum specifying filtered or unfiltered measurement (default is PERCENT)
    Returns uint8_t - specified state of health measurement in percentage (%), or status bits.
  • Description:
    Reads and returns specified state of health measurement.

3.2.7.33. Inkplate::battery.temperature();

  • Method prototype (as seen in SparkFunBQ27441.h):

uint16_t temperature(temp_measure type = BATTERY);
  • Arguments and return value:
    temp_measure type - enum specifying internal or battery measurement (default is BATTERY)
    Returns uint16_t - specified temperature measurement in degrees Celsius (°C).
  • Description:
    Reads and returns specified temperature measurement.