npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tessel-nokia5110

v2.0.3

Published

Nokia 5110 display for Tessel

Downloads

4

Readme

Nokia 5110 Graphic LCD

A simple Tessel library for interacting with the Nokia 5110 display. The library is a port of the LCD5110_Graph library by Henning Karlsen. Most of the functions are supported with the exception of printNumF and printNumI. Performance is generally good except for printing characters. It seems that the math involved with rendering characters is slow on the Tessel. Entire screen updates take about 53ms on average.

Connection Information

The module uses the double-wide proto-module and can be installed on either side of the Tessel. It occupies two ports but only uses one of them (A or D).

Hardware

The module uses the Nokia 5110 display which can be easily acquired online. A few options are:

For connection information I followed the wiring guide from Sparkfun.

Installation

npm install tessel-nokia5110

Example

var tessel = require('tessel');

// Screen is connected to port D
var nokia5110 = require('tessel-nokia5110').use(tessel.port['D']);

var CENTER = 9998;

nokia5110.on('ready', function(){
    nokia5110.print("Hello Tessel!", CENTER, 20);
    nokia5110.update(function(err){
      console.log("Your text is ready.");
    });
});

Event

Nokia5110.on('ready', callback(err, screen)) - Emitted when the screen object is first initialized

Methods

Nokia5110.update([callback(err)]) - Updates the display with the contents of scrbuf

Nokia5110.clear([callback(err)]) - Clears the display

Nokia5110.fill() - Turns on every pixel in scrbuf

Nokia5110.setContrast(contrast, [callback(err)]) - Adjust contrast of screen. contrast can be any value between 0x00 and 0x7F

Nokia5110.setPixel(x, y) - Sets pixel at location (x,y)

Nokia5110.clrPixel(x, y) - Clears the pixel at location (x,y)

Nokia5110.invPixel(x, y) - Invert the state of the pixel at location (x,y)

Nokia5110.print(str, x, y) - Write the string str at location (x,y). The default font is SmallFont.

Nokia5110.setFont(font) - Sets the current font. See Members below for more info on using the fonts member of the screen object.

Nokia5110.drawHLine(x, y, len) - Draws a horizontal line starting at location (x,y) that is len pixels long.

Nokia5110.clrHLine(x, y, len) - Removes len pixels of the horizontal line that starts at location (x,y).

Nokia5110.drawVLine(x, y, len) - Draws a vertical line starting at location (x,y) that is len pixels long.

Nokia5110.clrVLine(x, y, len) - Removes len pixels of the horizontal line that starts at location (x,y).

Nokia5110.drawLine(x1, y1, x2, y2) - Draws a line from location (x1,y1) to (x2,y2).

Nokia5110.clrLine(x1, y1, x2, y2) - Clears a line on the screen from location (x1,y1) to (x2,y2).

Nokia5110.drawRect(x1, y1, x2, y2) - Draws a rectangle that has a top left corner at (x1,y1) and a lower right corner at (x2,y2).

Nokia5110.clrRect(x1, y1, x2, y2) - Removes a rectangle that has a top left corner at (x1,y1) and a lower right corner at (x2,y2).

Nokia5110.drawRoundRect(x1, y1, x2, y2) - Same as drawRect but adds a rounded look to the rectangle corners.

Nokia5110.clrRoundRect(x1, y1, x2, y2) - Removes a rounded rectangle that has a top left corner at (x1,y1) and a lower right corner at (x2,y2).

Nokia5110.drawCircle(x, y, radius) - Draws a circle that is centered at location (x,y) with radius.

Nokia5110.clrCircle(x, y, radius) - Removes a circle that is centered at location (x,y) with radius.

Nokia5110.drawBitmap(x, y, bitmap, sx, sy) - Draw bitmap(defined as byte array) at location (x,y). sx and sy define the size.

Nokia5110.drawPreSizedBitmap(bitmap) - Draw bitmap by simply copying the bits onto the screen. This is much faster than drawBitmap but does not allow you to change the location.

Nokia5110.setBacklight(state) - Turns the backlight on if state is truthy, off otherwise.

Members

Nokia5110.fonts - Contains definitions of the supported fonts. SmallFont, TinyFont, MediumNumbers, BigNumbers.

Nokia5110.scrbuf - The 504 byte raw buffer that is used to update the screen.

Nokia5110.CENTER - Can be used in calls to print to center text

Nokia5110.LEFT - Can be used in calls to print to left-align text

Nokia5110.RIGHT - Can be used in calls to print to right-align text

Development Note

Almost all of the library calls simply update a display buffer without actually updating the screen. This is useful for making multiple changes to the screen at once without the overhead of actually redrawing the screen. To help with performance only call update() when you are actually ready for the screen to refresh.

Further Examples

  • Full Graphic Demo. Demonstrates all display capabilities.
  • Tiny Font. Demonstrates how to change the font and what the TinyFont looks like.
  • Scrolling Text. Demonstrates how to get scrolling text. Runs very slow
  • Bitmap Display. Demonstrates how to display a monochrome bitmap on the lcd.
  • Static Display. Demonstrates some of basic graphic calls to create a static screen.

Version History

v2.0.0 - Complete rewrite to port LCD5110_Graph library.

  • Rewrote SPI interface code for major performance boost
  • Removed async library to improve performance
  • Added additional examples

v1.0.1 - Updated examples to remove async calls

v1.0.0 - Initial version

Licensing

Apache 2.0