Node.js binding of waveshare e-ink display driver for Raspberry-Pi
npm install node-epdjavascript var Lcd = require('node-epd');
var lcd = new Lcd(0, 4, 10, 5, 1, 55); //initialize display
lcd.clear(); //clear all lcd
var fontAwesome = lcd.font('./test/fontawesome-webfont.ttf', 10); //load ttf font
var robotoFont = lcd.font('./test/Roboto-Regular.ttf', 14); //load ttf font
lcd.char(fontAwesome, 50, 110, 0xf206); //draw char (utf16)
lcd.drawString(robotoFont, 10, 50, "Hello"); //draw string (utf8)
lcd.circle(10,20,25, true); //draw filled circle
lcd.rect(50, 8, 50, 50); //draw rect
lcd.update(function() { //update all display
console.log("LCD updated");
lcd.clearPart(); //switch to partitial update mode
lcd.rect(100, 100, 20, 20); //draw rect
lcd.line(100, 100, 120, 120); //draw line in rect
lcd.partUpdate(); //update only changed part of display
});
``Main Lcd driver class
ObjectRect object
ObjectFT_Face object wrapper
ObjectEpdSize object
numberDrawing color -1 inverse, 1 black (default), 0 white
Kind: global class
* Lcd
* new Lcd(channel, dc, cs, rst, led)
* .font(ttfPath, font) ⇒ FontFace
* .size() ⇒ EpdSize
* .clear()
* .clearPart()
* .update()
* .partUpdate()
* .line(x, y, x2, y2, col)
* .rect(x, y, width, height, fill, col)
* .circle(x, y, r, fill, col)
* .pixel(x, y, col)
* .drawChar(x, y, char) ⇒ Rect
* .drawString(font, x, y) ⇒ Rect
* .color(color)
| Param | Type | Description |
| --- | --- | --- |
| channel | number | spi channel |
| dc | number | dc pin |
| cs | number | cs pin |
| rst | number | rst pin |
| led | number | additional led pin |
Kind: instance method of Lcd
Returns: FontFace - Description of return value.
| Param | Type | Description |
| --- | --- | --- |
| ttfPath | string | font path |
| font | number | size |
Kind: instance method of Lcd
Returns: EpdSize - display width and height
Kind: instance method of Lcd
Kind: instance method of Lcd
Kind: instance method of Lcd
Kind: instance method of Lcd
Kind: instance method of Lcd
| Param | Type | Description |
| --- | --- | --- |
| x | number | start point on x axis |
| y | number | start point on y axis |
| x2 | number | end point on x axis |
| y2 | number | end point on y axis |
| col | Color | line color |
Kind: instance method of Lcd
| Param | Type | Description |
| --- | --- | --- |
| x | number | start point on x axis |
| y | number | start point on y axis |
| width | number | rect width |
| height | number | rect height |
| fill | bool | If true rect is filled |
| col | Color | rect color |
Kind: instance method of Lcd
| Param | Type | Description |
| --- | --- | --- |
| x | number | mid point on x axis |
| y | number | mid point on y axis |
| r | number | circle size |
| fill | bool | If true circle is filled |
| col | Color | circle color |
Kind: instance method of Lcd
| Param | Type | Description |
| --- | --- | --- |
| x | number | point on x axis |
| y | number | point on y axis |
| col | Color | pixel color |
Kind: instance method of Lcd
| Param | Type | Description |
| --- | --- | --- |
| x | number | point on x axis |
| y | number | point on y axis |
| char | number | char code |
Kind: instance method of Lcd
Returns: Rect - drawed coordinates
| Param | Type | Description |
| --- | --- | --- |
| font | FontFace | Font to draw string |
| x | number | x position |
| y | number | y position |
Kind: instance method of Lcd
| Param | Type | Description |
| --- | --- | --- |
| color | number | 0 is white, 1 is black, -1 is inversion of current state |
ObjectKind: global typedef
Properties
| Name | Type |
| --- | --- |
| xMin | number |
| yMin | number |
| xMax | number |
| yMax | number |
ObjectKind: global typedef
Properties
| Name | Type | Description |
| --- | --- | --- |
| size | number | font size |
| height | number | font size in px |
ObjectKind: global typedef
Properties
| Name | Type | Description |
| --- | --- | --- |
| width | number | Display width in px |
| height | number | Display height in px |
numberKind: global typedef