Coder Social home page Coder Social logo

Support I2C about micropython-ssd1309 HOT 3 CLOSED

orztrickster avatar orztrickster commented on July 28, 2024
Support I2C

from micropython-ssd1309.

Comments (3)

rdagger avatar rdagger commented on July 28, 2024

You would need to modify the class constructor to accept and I2C parameter.
Then you would need to modify the write_cmd and write_data for I2C. That should work although I have not tried.
SPI will provide better performance than I2C.

from micropython-ssd1309.

Omid888 avatar Omid888 commented on July 28, 2024

first I need to thank you for your good work. second I need to request about the I2C driver as well. Since you don't seem to have a plan for adding this feature, can you please provide more details about it? I tried to change the constructor and write_cmd and write_data but found no luck.
P.S: This repo also was my reference too (Link)

from micropython-ssd1309.

rdagger avatar rdagger commented on July 28, 2024

It's hard to write code without the actual display.
The following is untested code:

Here's a sample constructor:

    def __init__(self, i2c, address=0x3C):
        """Constructor for encoder.

        Args:
            i2c (class): I2C bus
            address (int):  Encoder I2C address
        """
        self.address = address
        self.i2c = i2c

The write_cmd and write_data could be combined as follows:

    def write_byte(self, cmd, data):
        """Write byte to encoder.

        Args:
            cmd (byte): Command address to write
            data (byte): Byte to write
        """
        self.i2c.writeto_mem(self.address, cmd, bytearray([data]))

Initialize I2C bus:

from machine import I2C, Pin
i2c = I2C(1, freq=400000, scl=Pin(22), sda=Pin(23))  # bus 1

from micropython-ssd1309.

Related Issues (3)

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.