Socket
Book a DemoInstallSign in
Socket

epd7x5-v2

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

epd7x5-v2

node module for the 7.5 inch waveshare epaper display

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

epd7x5-v2

A Node.js package for the [7.5inch e-Paper HAT(B) V2 (12.2019) Waveshare display](https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT_(B\)) on a Raspberry Pi 2/3/zero.

It can consume BGRA image color buffer which may be produced by using for instance node-canvas library.

Dependencies

WiringPi for GPIO access of Raspberry Pi

Installation

  • Enable the SPI interface on Raspberry Pi: sudo raspi-config
  • WiringPi: follow installation on wiringpi.com
  • (optional) Install node-canvas: npm i canvas
  • epd7x5-v2: npm i epd7x5-v2

Example

This example requires node-canvas library installed.

import * as epd from 'epd7x5-v2';
import { createCanvas, registerFont } from 'canvas';

// Initialize canvas
registerFont('/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf', { family: 'DejaVu' });
const canvas = createCanvas(epd.RES_WIDTH, epd.RES_HEIGHT);
const ctx = canvas.getContext('2d');

// Draw something
ctx.antialias = 'none';
ctx.fillStyle = 'white';
ctx.fillRect(0, 0, epd.RES_WIDTH, epd.RES_HEIGHT);
ctx.font = '65px DejaVu';
ctx.textBaseline = 'top';
ctx.fillStyle = 'black';
ctx.fillText('Hello World!', 5, 5);
ctx.fillStyle = 'red';
ctx.fillText('Hello World!', 5, 105);
ctx.fillRect(5, 205, 500, 69);
ctx.fillStyle = 'white';
ctx.fillText('Hello World!', 5, 205);

// Send image to the HAT and sleep
epd.init();
epd.displayImageBuffer(canvas.toBuffer('raw'));
epd.deepSleep();

Roadmap

  • Rewrite to async code

Keywords

epaper

FAQs

Package last updated on 16 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts