Skip to content

peter-l5/MicroPython-Sharp-Memory-Display

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MicroPython - Sharp Memory Display driver

MicroPython driver for Sharp Memory Displays.

This driver was derived from the Adafruit CircuitPython version Adafruit_CircuitPython_SharpMemoryDisplay driver made by @ladyada and others. Some enhancements have been added.

Features and performance

An SPI connection at 2 MHz can achieve full screen updates in around 110 ms for the 400x240 display. This is the rated maximum speed for the display.

The driver builds in the facility to use the extended framebuffer methods large_text(), triangle() and circle() methods in the MicroPython FrameBuffer extension framebuf2.

Important

To prevent potential permanent burn-in on the display the polarity must be reversed at least every 2 hours. This can be achieved by refreshing the display with the show() method. See display datasheet and application note for further information.

Display connection

The display has an SPI interface, connections for SCLK, MOSI, CS are required.

Usage

The module code should be uploaded to the Raspberry Pico Pi (or other Microcontroller running MicroPython). The large font, triangle and circles extension is added by additionally uploading the framebuf2.py module code. (See framebuf2.)

Classes

The module includes the class SharpMemoryDisplay.

syntax:

display = sharp.SharpMemoryDisplay(width, 
                                   height, 
                                   spi,
                                   cs)
  • width (default 400) and height (default 240) define the size of the display
  • spi is an SPI object. The SCL (clock) and MOSI (data) pins must be defined. MISO is not used.
  • cs is a GPIO Pin object for Chip Select

Methods and Properties

In addition to all MicroPython's framebuffer drawing methods, the following methods and properties are available for controlling the display

show() - this method updates the display from the framebuffer.

clear() - this method clears the display to white (colour 1).

Example usage

    from machine import Pin, SPI
    import sharp

    spi0 = SPI(0, baudrate=2_000_000, sck=Pin(18), mosi=Pin(19), miso=Pin(16))
    display = sharp_memory_display.SharpMemoryDisplay(400, 240, spi0, cs=Pin(15, Pin.OUT))

    display.fill(0)
    display.text('SHARP MEMORY DISPLAY', 0, 0, 1)
    display.text('driver', 0, 8, 1)
    display.show()

See demo example for further details and usage demonstrations of other methods. (The example code was written for 400x240 displays.)

Tested displays

This driver has been tested with a Raspberry Pi Pico and an Adafruit 400x240 display. It should work with other Adafruit Sharp Memory Displays.

Version notes

version 0.2.016

  • initial working version

Collaboration

Suggestions for improvements and pull requests are welcome.

References

to add: link to Adafruit documentation

to add: link to appliction note and datasheet

Application Note: Sharp Memory LCDs: Theory, Interfacing, and Programming

Possible enhancements

  1. amend show to allow line updates rather than the full screen

  2. use a buffer that includes the overhead bytes for writing a line to the display

About

MicroPython driver for Sharp Memory Displays

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages