Coder Social home page Coder Social logo

adafruit / adafruit_circuitpython_ssd1306 Goto Github PK

View Code? Open in Web Editor NEW
276.0 276.0 75.0 179 KB

Adafruit CircuitPython framebuf driver for SSD1306 or SSD1305 OLED displays. Not for use with displayio. See README.

License: MIT License

Python 100.00%
circuitpython hacktoberfest monochrome-oled-displays oled-display oled-display-ssd1306 ssd1306

adafruit_circuitpython_ssd1306's Introduction

Introduction

Documentation Status

Discord

Build Status

Code Style: Black

Adafruit CircuitPython driver for SSD1306 or SSD1305 OLED displays. Note that SSD1305 displays are back compatible so they can be used in-place of SSD1306 with the same code and commands.

This driver implements the adafruit_framebuf interface. It is not the displayio driver for the SSD1306. See the Adafruit CircuitPython DisplayIO SSD1306 driver for displayio support.

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-ssd1306

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

sudo pip3 install adafruit-circuitpython-ssd1306

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-ssd1306

Usage Example

# Basic example of clearing and drawing pixels on a SSD1306 OLED display.
# This example and library is meant to work with Adafruit CircuitPython API.
# Author: Tony DiCola
# License: Public Domain

# Import all board pins.
from board import SCL, SDA
import busio

# Import the SSD1306 module.
import adafruit_ssd1306


# Create the I2C interface.
i2c = busio.I2C(SCL, SDA)

# Create the SSD1306 OLED class.
# The first two parameters are the pixel width and pixel height.  Change these
# to the right size for your display!
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
# Alternatively you can change the I2C address of the device with an addr parameter:
#display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, addr=0x31)

# Clear the display.  Always call show after changing pixels to make the display
# update visible!
display.fill(0)

display.show()

# Set a pixel in the origin 0,0 position.
display.pixel(0, 0, 1)
# Set a pixel in the middle 64, 16 position.
display.pixel(64, 16, 1)
# Set a pixel in the opposite 127, 31 position.
display.pixel(127, 31, 1)
display.show()

More examples and details can be found in the adafruit_framebuf docs.

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_ssd1306's People

Contributors

adamcandy avatar brennen avatar careyk007 avatar caternuson avatar deshipu avatar dhalbert avatar djdevon3 avatar eliotg avatar evaherrada avatar foamyguy avatar gamblor21 avatar jepler avatar jerryneedell avatar jposada202020 avatar kattni avatar ladyada avatar makermelissa avatar mcauser avatar mrmcwethy avatar mrouillard avatar raidancampbell avatar siddacious avatar sommersoft avatar tannewt avatar tdicola avatar tekktrik avatar theacodes avatar tinycircuits avatar waynedyck avatar

Stargazers

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

Watchers

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

adafruit_circuitpython_ssd1306's Issues

"Incompatible .mpy file" error while using 8.x library version on CircuitPython 8.2.7

Attempting to import adafruit_ssd1306 when using the .mpy file from adafruit-circuitpython-ssd1306-8.x-mpy-2.12.15 with CircuitPython 8.2.7 yields the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_ssd1306.py", line 21, in <module>
ValueError: Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.

RPi Pico SSD 1306 I2C Serial Console Appears on Display

Hi!

I'm trying to use an SSD1306 OLED display with RPi Pico using CircuitPython. My Problem is when I power on the RPi the test drawing works fine on the display, but after changing something in the code and saving to the RPi, the serial monitor appears on the OLED display (also works in the editor) and stops with an error, saying that the GP11 IO is in use (SCL connection for the display). The display only works as expected when I disconnect and reconnect the RPi:

Here is the init code:

i2c = busio.I2C (scl=board.GP11, sda=board.GP10)
if(i2c.try_lock()):
    print("i2c.scan(): " + str(i2c.scan()))
    i2c.unlock()
print()   
display_bus = displayio.I2CDisplay (i2c, device_address = 0x3C) # The address of my Board

display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=64)
splash = displayio.Group()
display.show(splash)

color_bitmap = displayio.Bitmap(128, 64, 1) # Full screen white
color_palette = displayio.Palette(1)
color_palette[0] = 0xFFFFFF  # White

bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)

color_bitmap = displayio.Bitmap(128, 64, 1) # Full screen white
color_palette = displayio.Palette(1)
color_palette[0] = 0xFFFFFF  # White

bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)

# Draw a smaller inner rectangle
inner_bitmap = displayio.Bitmap(118, 54, 1)
inner_palette = displayio.Palette(1)
inner_palette[0] = 0x000000  # Black
inner_sprite = displayio.TileGrid(inner_bitmap, pixel_shader=inner_palette, x=5, y=4)
splash.append(inner_sprite)

# Draw a label
text = "Nicolau dos"
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=28, y=15)
splash.append(text_area)

text = "Brinquedos"
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=32, y=25)
splash.append(text_area)

Here is a video:
https://user-images.githubusercontent.com/80568222/149657931-ccd8c6b0-8c10-47a8-8b77-d96eee70a8b5.mp4

please add support orange pi one plus (H6)

this gpio pinout
1
2

python3 ssd1306_stats.py
Traceback (most recent call last): File "ssd1306_stats.py", line 12, in <module> from board import SCL, SDA File "/usr/local/lib/python3.7/dist-packages/board.py", line 254, in <module> platform.system(), package[0], package[1] NotImplementedError: Adafruit-PlatformDetect version 3.13.3 was unable to identify the board and/or microcontroller running the Linux platform. Please be sure you have the latest packages running: 'pip3 install --upgrade adafruit-blinka adafruit-platformdetect'

pip list | grep -i adafruit
Adafruit-Blinka 6.10.0 adafruit-circuitpython-busdevice 5.0.6 adafruit-circuitpython-framebuf 1.4.7 adafruit-circuitpython-ssd1306 2.11.4 Adafruit-GPIO 1.0.4 Adafruit-PlatformDetect 3.13.3 Adafruit-PureIO 1.1.8 adafruit-python-shell 1.3.1 Adafruit-SSD1306 1.6.2

Not possible to print text in circuitpython to Feather M0 express with SSD1306 oled shield

>>> import adafruit_ssd1306 as ssd1306
>>> from board import *
>>> import busio
>>> i2c = busio.I2C(SCL, SDA)
>>> oled = ssd1306.SSD1306_I2C(128, 32, i2c)
>>> oled.fill(0)
>>> oled.show()
>>> oled.text('Hello', 0, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_ssd1306/ssd1306.py", line 102, in text
TypeError: function takes 1 positional arguments but 5 were given
>>> ```

It looks like the framebuf.mpy is not fully implemented.

Black screen with SPI

I can initialize the display but the example code gives me black screen. The same display works with I2C.

Adafruit CircuitPython 7.3.0-alpha.0-38-g862210b3f-dirty on 2022-03-24; Adafruit Feather M4 Express with samd51j19
Board ID:feather_m4_express
import board
import busio
import displayio
import adafruit_displayio_ssd1306
import sys

displayio.release_displays()

try: 
	spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)

	display_bus = displayio.FourWire(spi_bus=spi, command=board.D10, chip_select=board.D11, reset=board.D9, baudrate=10000000)

	display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=64)

	splash = displayio.Group()
	display.show(splash)

	color_bitmap = displayio.Bitmap(120, 50, 1)
	color_palette = displayio.Palette(1)
	color_palette[0] = 0xFFFFFF # White

	bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
	splash.append(bg_sprite)

	while True:
		pass

except (KeyboardInterrupt) as e:
	spi.unlock()
	sys.exit(0)

Initialize display cmd

Why initialize display cmd is big difference from with the previous repo and u8g2 too. Where does it come from?

https://github.com/adafruit/Adafruit_CircuitPython_SSD1306/blob/main/adafruit_ssd1306.py#L116

# self.poweron
0xAE | 0x01

# self.init_display
0xAE,  # off
# address setting
0x20,
0x10  # Page Addressing Mode
if self.page_addressing
else 0x00,  # Horizontal Addressing Mode
# resolution and layout
0x40,
0xA0 | 0x01,  # column addr 127 mapped to SEG0
0xA8,
self.height - 1,
0xC0 | 0x08,  # scan from COM[N] to COM0
0xD3,
0x00,
0xDA,
0x02 if self.width > 2 * self.height else 0x12,
# timing and driving scheme
0xD5,
0x80,
0xD9,
0x22 if self.external_vcc else 0xF1,
0xDB,
0x30,  # 0.83*Vcc  # n.b. specs for ssd1306 64x32 oled screens imply this should be 0x40
# display
0x81,
0xFF,  # maximum
0xA4,  # output follows RAM contents
0xA6,  # not inverted
0xAD,
0x30,  # enable internal IREF during display on
# charge pump
0x8D,
0x10 if self.external_vcc else 0x14,
0xAE | 0x01,  # display on

https://github.com/adafruit/micropython-adafruit-ssd1306/blob/master/ssd1306.py#L40

# self.init_display
0xAE | 0x00,  # off
# address setting
0x20, 0x00,  # horizontal
# resolution and layout
0x40 | 0x00,
0xA0 | 0x01,  # column addr 127 mapped to SEG0
0xA8, self.height - 1,
0xC0 | 0x08,  # scan from COM[N] to COM0
0xD3, 0x00,
0xDA, 0x02 if self.height == 32 else 0x12,
# timing and driving scheme
0xD5, 0x80,
0xD9, 0x22 if self.external_vcc else 0xF1,
0xDB, 0x30,  # 0.83*Vcc
# display
0x81, 0xFF,  # maximum
0xA4,  # output follows RAM contents
0xA6,  # not inverted
# charge pump
0x8D, 0x10 if self.external_vcc else 0x14,
0xAE | 0x01  # on

https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306/blob/main/adafruit_displayio_ssd1306.py#L43

_INIT_SEQUENCE = (
    b"\xAE\x00"  # DISPLAY_OFF
    b"\x20\x01\x00"  # Set memory addressing to horizontal mode.
    b"\x81\x01\xcf"  # set contrast control
    b"\xA1\x00"  # Column 127 is segment 0
    b"\xA6\x00"  # Normal display
    b"\xc8\x00"  # Normal display
    b"\xA8\x01\x3f"  # Mux ratio is 1/64
    b"\xd5\x01\x80"  # Set divide ratio
    b"\xd9\x01\xf1"  # Set pre-charge period
    b"\xda\x01\x12"  # Set com configuration
    b"\xdb\x01\x40"  # Set vcom configuration
    b"\x8d\x01\x14"  # Enable charge pump
    b"\xAF\x00"  # DISPLAY_ON
)

https://github.com/adafruit/Adafruit_SSD1306/blob/master/Adafruit_SSD1306.cpp#L564

  // Init sequence
  static const uint8_t PROGMEM init1[] = {SSD1306_DISPLAYOFF,         // 0xAE
                                          SSD1306_SETDISPLAYCLOCKDIV, // 0xD5
                                          0x80, // the suggested ratio 0x80
                                          SSD1306_SETMULTIPLEX}; // 0xA8
  ssd1306_commandList(init1, sizeof(init1));
  ssd1306_command1(HEIGHT - 1);

  static const uint8_t PROGMEM init2[] = {SSD1306_SETDISPLAYOFFSET, // 0xD3
                                          0x0,                      // no offset
                                          SSD1306_SETSTARTLINE | 0x0, // line #0
                                          SSD1306_CHARGEPUMP};        // 0x8D
  ssd1306_commandList(init2, sizeof(init2));

  ssd1306_command1((vccstate == SSD1306_EXTERNALVCC) ? 0x10 : 0x14);

  static const uint8_t PROGMEM init3[] = {SSD1306_MEMORYMODE, // 0x20
                                          0x00, // 0x0 act like ks0108
                                          SSD1306_SEGREMAP | 0x1,
                                          SSD1306_COMSCANDEC};
  ssd1306_commandList(init3, sizeof(init3));

  uint8_t comPins = 0x02;
  contrast = 0x8F;

  if ((WIDTH == 128) && (HEIGHT == 32)) {
    comPins = 0x02;
    contrast = 0x8F;
  } else if ((WIDTH == 128) && (HEIGHT == 64)) {
    comPins = 0x12;
    contrast = (vccstate == SSD1306_EXTERNALVCC) ? 0x9F : 0xCF;
  } else if ((WIDTH == 96) && (HEIGHT == 16)) {
    comPins = 0x2; // ada x12
    contrast = (vccstate == SSD1306_EXTERNALVCC) ? 0x10 : 0xAF;
  } else {
    // Other screen varieties -- TBD
  }

  ssd1306_command1(SSD1306_SETCOMPINS);
  ssd1306_command1(comPins);
  ssd1306_command1(SSD1306_SETCONTRAST);
  ssd1306_command1(contrast);

  ssd1306_command1(SSD1306_SETPRECHARGE); // 0xd9
  ssd1306_command1((vccstate == SSD1306_EXTERNALVCC) ? 0x22 : 0xF1);
  static const uint8_t PROGMEM init5[] = {
      SSD1306_SETVCOMDETECT, // 0xDB
      0x40,
      SSD1306_DISPLAYALLON_RESUME, // 0xA4
      SSD1306_NORMALDISPLAY,       // 0xA6
      SSD1306_DEACTIVATE_SCROLL,
      SSD1306_DISPLAYON}; // Main screen turn on
  ssd1306_commandList(init5, sizeof(init5));

  TRANSACTION_END

Add colstart kwarg

Use it instead of special casing colstart based on display width. It shouldn't be assumed because it is up to the display's manufacturer.

Display Rotate?!

Hi ,

How can Rotate the Display at 180° Degrees ???

SOLVED: disp.rotation = 2

Sphinx build error

I saw this during a release. Re-running tests didn't help.

Run sphinx-build -E -W -b html . _build/html
Running Sphinx v2.3.1
making output directory... done
loading intersphinx inventory from https://docs.python.org/3.4/objects.inv...
loading intersphinx inventory from https://circuitpython.readthedocs.io/projects/bus_device/en/latest/objects.inv...
loading intersphinx inventory from https://circuitpython.readthedocs.io/en/latest/objects.inv...

Warning, treated as error:
failed to reach any of the inventories with the following issues:
intersphinx inventory 'https://circuitpython.readthedocs.io/projects/bus_device/en/latest/objects.inv' not fetchable due to <class 'requests.exceptions.HTTPError'>: 404 Client Error: Not Found for url: https://circuitpython.readthedocs.io/projects/bus_device/en/latest/objects.inv
##[error]Process completed with exit code 2.

Not building per instructions

Tried to follow the new instructions here https://learn.adafruit.com/monochrome-oled-breakouts/python-setup on Debian (OctoPi).

> pip3 install adafruit-circuitpython-ssd1306`

Getting in the end:

Downloading https://files.pythonhosted.org/packages/0c/d7/5d2f861155e9749f981e6c58f2a482d3ab458bf8c35ae24d4b4d5899ebf9/sysv_ipc-1.1.0.tar.gz (99kB)
    100% |████████████████████████████████| 102kB 298kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-lfr36pam/sysv-ipc/setup.py", line 11, in <module>
        import prober
      File "/tmp/pip-build-lfr36pam/sysv-ipc/prober.py", line 137
        d["SYSV_IPC_VERSION"] = f'"{version}"'
                                             ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-lfr36pam/sysv-ipc/

RuntimeError: This module can only be run on a Raspberry Pi!

>>> import adafruit_ssd1306 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alarm/.local/lib/python3.11/site-packages/adafruit_ssd1306.py", line 17, in <module>
    from adafruit_bus_device import i2c_device, spi_device
  File "/home/alarm/.local/lib/python3.11/site-packages/adafruit_bus_device/spi_device.py", line 20, in <module>
    from digitalio import DigitalInOut
  File "/home/alarm/.local/lib/python3.11/site-packages/digitalio.py", line 19, in <module>
    from adafruit_blinka.microcontroller.bcm283x.pin import Pin
  File "/home/alarm/.local/lib/python3.11/site-packages/adafruit_blinka/microcontroller/bcm283x/pin.py", line 5, in <module>
    from RPi import GPIO
  File "/home/alarm/.local/lib/python3.11/site-packages/RPi/GPIO/__init__.py", line 23, in <module>
    from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!

OS info

                   -`                    alarm@alarm
                  .o+`                   -----------
                 `ooo/                   OS: Arch Linux ARM aarch64
                `+oooo:                  Host: Raspberry Pi 4 Model B
               `+oooooo:                 Kernel: 6.2.10-1-aarch64-ARCH
               -+oooooo+:                Uptime: 2 days, 8 hours, 41 mins
             `/:-:++oooo+:               Packages: 505 (pacman)
            `/++++/+++++++:              Shell: zsh 5.9
           `/++++++++++++++:             Terminal: /dev/pts/0
          `/+++ooooooooooooo/`           CPU: (4) @ 1.500GHz
         ./ooosssso++osssssso+`          Memory: 3101MiB / 3778MiB
        .oossssso-````/ossssss+`
       -osssssso.      :ssssssso.
      :osssssss/        osssso+++.
     /ossssssss/        +ssssooo/-
   `/ossssso+/:-        -:/+osssso+-
  `+sso+:-`                 `.-/+oso:
 `++:.                           `-/+/
 .`                                 `/

Usage Example code requires two runs on Pico using Thonny before screen actually updates

When running the example code (or seemingly any code using the module) on a Raspberry Pi Pico using Thonny IDE the code must be run twice before any changes to the display made in code are visible on screen.
It consistently is exactly 2 runs before changes are visible, and the changes are always visible after 2.

I have tried implementing a delay both before the refresh, and before a second code refresh, and neither fix the issue.

image

not working wth OLED Featherwing on nrf52840

I just tried running the test cases on a particle argon (nrf52840) with an OLED featherwing and I just get a screen full of random pixels. The same code works fine on a metro_m4 _express

All of the test cases (bouncing bali,simpletest and ssd1306_framebuftest have the same results so it is not just framebuf)
Note -- the default nrf builds still include the "built in" framebuf but I tried it with they built-in and the new adafruit_framebuf.py -- same results.

I have not test other nrf52840 boards yet.

also note, there is no RESET pin for the OLED Featherwing.

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_ssd1306.py:52
  • adafruit_ssd1306.py:144
  • adafruit_ssd1306.py:149
  • adafruit_ssd1306.py:153
  • adafruit_ssd1306.py:164
  • adafruit_ssd1306.py:211
  • adafruit_ssd1306.py:242
  • adafruit_ssd1306.py:282
  • adafruit_ssd1306.py:319

Using the download functions from the target produces the word "download" as the download

Hello!
I have that file, "stats.py" running on an OLED attached to a Pi Zero WH. I needed to screenscrape a raw text of the file and paste that into the editor, because using the download methods, such as pointing the wget command to the URL that corresponds to the code did exactly the same as the subject, on a Pi3A board running the same release of PiOS and the tools described on the same page as https://learn.adafruit.com/adafruit-pioled-128x32-mini-oled-for-raspberry-pi?view=all

But if were to cause the download function to happen here on Windows, it would work. If I had a browser running on a desktop on that Pi Zero WH it would work. We are expected to send the code to our devices when seeing the prompt inside a terminal window such as Putty. So we should have the benefit of a doubt and believe that our download tools would also work.

"No module named 'framebuf'" error running simpletest.py on RaspberryPi

I'm trying to use the SSD1306 display on RaspberryPi (latest Stretch image) with CircuitPython.
Installed Blinka and other libraries as following:
pip3 install RPI-GPIO
pip3 install adafruit-blinka
pip3 install Adafruit_CircuitPython_SSD1306

The Blinka test was OK, however running the simpletest.py for SSD1306 gives the error that framebuf module is not found. Tried to install additional dependencies, as per documentation (https://cdn-learn.adafruit.com/downloads/pdf/micropython-hardware-ssd1306-oled-display.pdf?timestamp=1542370878):
pip3 install adafruit-circuitpython-busdevice
pip3 install adafruit-circuitpython-register

Tried to follow the issue #1, but very confusing to understand how to install the framebuf. The simpletest.py still can't run...
Please help. Thanks - Mac Ha

Example code not helpful - draws black on black

I assume that the example code given on README.rst should be considered a "smoke test" or "hello world" program to enable the user to check that his/her display can be addressed and is basically working.

That said, with executing display.fill(0) it draws a black background on my black display. I didn't see any change at all.

I suggest to change this to display.fill(1) so it draws some other "color" than black on the display. At least this works for my SSD1306 OLED display.

Does that make sense?

add dependency for adafruit_framebuf

Since framebuf is no longer going to be a "builtin" for most builds -- should adafruit_framebuf be added as a dependency for this library? I guess it could also be explained in the readme.md

64x32 displays skip every other horizontal row

Fantastic this library presents a straightforward and easy interface to these displays.
In the case of the smaller 64x32 ssd1306-based OLED displays, it is not possible to use half of the rows (every other row is skipped).

SSD1306_SPI TypeError: function expected at most 5 arguments, got 6

I'm following this spi oled guide to program my 128x32 SPI oled from a feather m0 express.

I am running circuit python 3.1.2, with the 3.x bundle

# boot_out.txt
Adafruit CircuitPython 3.1.2 on 2019-01-07; Adafruit Feather M0 Express with samd21g18                          

I'm running the sample code, with the pins changed to mach how I've connected the wires.

# code.py
import adafruit_ssd1306
import board
import busio
import digitalio
 
spi = busio.SPI(board.SCK, MOSI=board.MOSI)
dc_pin = digitalio.DigitalInOut(board.A0)    # any pin!
reset_pin = digitalio.DigitalInOut(board.A2) # any pin!
cs_pin = digitalio.DigitalInOut(board.A1)    # any pin!
 
oled = adafruit_ssd1306.SSD1306_SPI(128, 32, spi, dc_pin, reset_pin, cs_pin)

I cannot initialize SSD1306_SPI, it fails with TypeError: function expected at most 5 arguments, got 6

soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
  File "code.py", line 11, in <module>
TypeError: function expected at most 5 arguments, got 6

Before reporting this bug I updated circuitpython to 3.1.2 by copying the .uf2 into the bootloader, and I cleared the filesystem using system.erase_filesystem(), then I reinstalled the circuit python bundle.

font or text size

I am using the example code that prints hello world with white border.
Is there a way to increase the text size?

Adafruit_SSD1306 library not working on micropython with blinka

I am trying to use a SSD1306 display with a raspberry pi pico w, and i can't get it to work because of this error:
image

Line 70: super().__init__(buffer, width, height)
...
Line 327:  super().__init__(
Line 328:             memoryview(self.buffer),
Line 329:             width,
Line 330:             height,
Line 331:             external_vcc=external_vcc,
Line 332:             reset=reset,
Line 333:             page_addressing=self.page_addressing,
                 )

Displays random patterns on show() for some screens

After extending the library for 64x32 screens (#53 b92bf18) a new batch of screens fail to work!
Following show(), just random data is shown on screen.
It is possible to adjust the contrast, so the displays seem operational, but there is something up with the framebuffer/RAM/correct addressing.

Does not work with 0.9.1 due to missing framebuf module

>>> uos.uname()
(sysname='samd21', nodename='samd21', release='0.9.1', version='0.9.1 on 2017-02-28', machine='Adafruit Feather M0 Basic with samd21g18')
>>> import adafruit_ssd1306 as ssd1306
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/flash/lib/adafruit_ssd1306/__init__.py", line 1, in <module>
  File "adafruit_ssd1306/ssd1306.py", line 3, in <module>
ImportError: no module named 'framebuf'

According to the release notes, framebuf was removed from CircuitPython in 0.8.1:

  • Remove the framebuf. It made the binaries too large with all of the extra functionality added in 1.8.7.

https://blog.adafruit.com/2017/01/12/circuitpython-0-8-1-released/

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.