Skip to content

Latest commit

 

History

History
142 lines (85 loc) · 5.49 KB

DEVELOP.md

File metadata and controls

142 lines (85 loc) · 5.49 KB

Developing a P2 Application interacting with the new Mikroe eInk Click P2 Driver

Add an eInk display to your own project!

Project Maintenance

License

Table of Contents

On this Page:

Follow these steps to add Mikroe eInk Click P2 driver to your project:

Additional pages:


Download the latest release file

Go to the project Releases page expand the Assets heading to see the demo-archive-set.zip file link. Click on it to download the .zip file. Unpack it and move the files into your project.

Lastly you'll start the objects and then add your writte to display code.

Include Project Objects in your top-object-file

You now need to add eInk objects to your project.

Using the P2 Click driver

  • isp_eInk_click.spin2 - the new click driver code. It also includes the fonts

You simply include them with something like:

OBJ { Objects Used by this Object }

    eInkDisplay : "isp_eInk_click"	' include the driver, fonts

Start the eInk Driver

Starting eInk driver object in Spin2 is also pretty simple:


CON { click module io pins }

    ' our Click module is on 16-31!
    EINK_CLICK_PINGROUP = eInkDisplay.PINS_P16_P31
    
    ' we are using a 2.13" eInk display
    EINK_DISPLAY_TYPE = eInkDisplay.DS_eink213

PUB main() | ok
'' DEMO let's see what our radio hears!

    ' tell object where the module is connected
    ok := eInkDisplay.start(EINK_DISPLAY_TYPE, EINK_CLICK_PINGROUP)
    if not ok
        debug("* SPI FAILED to start")
    else
        debug("* SPI started OK")

  ... and do your app stuff from here on ...
  
        eInkDisplay.stop()   ' if you wish to shutdown COGs and release motor pins
   

And you're off! Add your own display code

You are now at the ... and do your app stuff from here on ... section of this page. From here on, just use any of the Public Methods found in the interface description. Here's a quick (maybe partial) summary:

Method Signature Purpose
PUB start(eDisplayType, eClickBasePin) : ok Specify the eval board connect location for the EINK click and start SPI
** eDisplayType** is [DS_eink154, DS_eink200, DS_eink213, or DS_eink290]
eClickBasePin is [PINS_P0_P15, PINS_P16_P31, or PINS_P32_P47]
PUB stop() Stop the EINK Click SPI Object
PUB resetDevice() Reset the EINK device
PUB displaySize() : widthInPix, heightInPix Return display size in pixels
NOTE: only valid is device is successfully started!
(ensure start() is called, first and that it is successful!)
PUB displayType() : eDisplayType Return display size in pixels
NOTE: only valid is device is successfully started!
(ensure start() is called, first and that it is successful!)
** eDisplayType** is [DS_eink154, DS_eink200, DS_eink213, or DS_eink290]
WRITE DIRECTLY TO DISPLAY
PUB fillScreen(color) Fill Display with {color}
PUB displayImage(pImageBffr) Write image bitmap to Display
PUB displayTextAtXY(X, Y, pText) Write zstr to Display at device row, column
WRITE TO BUFFER (NOTE: when all buffer writes done call flushToDisplay() to commit)
PUB setFont(orientation, color, eFont) Set font configuration
PUB setBackground(color) Fill Frame Buffer with {color}
PUB setTextAtXY(X, Y, pText) Write zstr to Frame Buffer at device row, column
PUB fillRegionAt(X, Y, color, width, height) Fill region of Frame Buffer with color
PUB borderAtXY(X, Y, color, thickness, width, height) Draw border of thinkness* into Frame Buffer
PUB lineAtXY(fmX, fmY, toX, toY, color) Draw line into Frame Buffer
PUB circleAtXY(X, Y, diameter, color) Draw circle into Frame Buffer
PUB placeImageAtXY(X, Y, pImgBits, imgWidth, imgHeight, rotation) Overlay image bits* of color into Frame Buffer
PUB flushToDisplay() Flush Frame Buffer content to Display

Have Fun!


If you like my work and/or this has helped you in some way then feel free to help me out for a couple of ☕'s or 🍕 slices!

coffee    -OR-    PatreonPatreon.com/IronSheep


Disclaimer and Legal

Parallax, Propeller Spin, and the Parallax and Propeller Hat logos are trademarks of Parallax Inc., dba Parallax Semiconductor


License

Licensed under the MIT License.

Follow these links for more information: