Coder Social home page Coder Social logo

adafruit / adafruit_circuitpython_ssd1327 Goto Github PK

View Code? Open in Web Editor NEW
2.0 17.0 6.0 80 KB

DisplayIO drivers for grayscale OLEDs driven by SSD1327

License: MIT License

Python 100.00%
circuitpython displayio ssd1327 oled-display grayscale-display hacktoberfest

adafruit_circuitpython_ssd1327's Introduction

Introduction

Documentation Status

Discord

Build Status

Code Style: Black

DisplayIO drivers for grayscale OLEDs driven by SSD1327

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-ssd1327

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-ssd1327

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-ssd1327

Usage Example

import board
import displayio
import adafruit_ssd1327
import busio
import time

displayio.release_displays()

# This pinout works on a Metro and may need to be altered for other boards.
spi = busio.SPI(board.SCL, board.SDA)
tft_cs = board.D6
tft_dc = board.D9
tft_reset = board.D5

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_reset, baudrate=1000000)
time.sleep(1)
display = adafruit_ssd1327.SSD1327(display_bus, width=128, height=128)

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

adafruit_circuitpython_ssd1327's People

Contributors

dhalbert avatar evaherrada avatar foamyguy avatar kattni avatar ladyada avatar lesamouraipourpre avatar makermelissa avatar prcutler avatar siddacious avatar sommersoft avatar tannewt avatar tcfranks avatar tekktrik avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_circuitpython_ssd1327's Issues

Error Running I2C Example on Pi CM4

I have a custom Pi 4 Compute Module board with the "Adafruit Grayscale 1.5" 128x128 OLED Display" and an I2C LED driver on I2C1. I have the I2C LED driver working on the bus no problem. I am trying to get the adafruit_ssd1327 library running. When I run the example code, I get garbage displayed on the screen. I see traffic on the I2C1 bus when I run the code but the data does not look correct. It looks like a 0x80 is getting inserted every other byte.

scope_9

Using Screen on Raspberry Pi Without CircuitPython Image

To get this screen working on a Raspberry Pi Zero 2 W without having to use a CircuitPython image, I needed the following Python dependencies:

adafruit-blinka-displayio
adafruit-circuitpython-display-text
adafruit-circuitpython-ssd1327
RPi.GPIO

I've opened this issue for others that may be struggling to do the same thing because I couldn't find instructions anywhere.

raise ValueError

I have some problem running this code on jetson nano:raise ValueError(
ValueError: No Hardware SPI on (SCLK, MOSI, MISO)=(GEN2_I2C_SCL, GEN2_I2C_SDA, None)
Valid SPI ports:((0, SPI1_SCK, SPI1_MOSI, SPI1_MISO), (1, SPI2_SCK, SPI2_MOSI, SPI2_MISO))
I'll be very thankful to the one who tells me how to solve it?

Modifying init sequence

Hi,

Is there a way to modify the init sequence without re compiling the lib?

For example, let say I would like to change the contrast value:

b"\x81\x01\x80" # set contrast control

Is there a way to pass another value than x80 as an argument to override it?

Not really an issue but I didn't where else to ask.
Thanks!

Missing Type Annotations

There are missing type annotations for some functions in this library.

The typing module does not exist on CircuitPython devices so the import needs to be wrapped in try/except to catch the error for missing import. There is an example of how that is done here:

try:
    from typing import List, Tuple
except ImportError:
    pass

Once imported the typing annotations for the argument type(s), and return type(s) can be added to the function signature. Here is an example of a function that has had this done already:

def wrap_text_to_pixels(
    string: str, max_width: int, font=None, indent0: str = "", indent1: str = ""
) -> List[str]:

If you are new to Git or Github we have a guide about contributing to our projects here: https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github

There is also a guide that covers our CI utilities and how to run them locally to ensure they will pass in Github Actions here: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code In particular the pages: Sharing docs on ReadTheDocs and Check your code with pre-commit contain the tools to install and commands to run locally to run the checks.

If you are attempting to resolve this issue and need help, you can post a comment on this issue and tag both @FoamyGuy and @kattni or reach out to us on Discord: https://adafru.it/discord in the #circuitpython-dev channel.

The following locations are reported by mypy to be missing type annotations:

  • adafruit_ssd1327.py:58

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.