Comments (3)
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.
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micropython-ssd1309.