-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SSD1309 Device using non-traditional SPI #2316
Conversation
@dotnet-policy-service agree |
src/devices/Ssd13xx/Ssd1309.cs
Outdated
{ | ||
Span<byte> commandBytes = command?.GetBytes(); | ||
|
||
_gpioController?.Write(_dc, PinValue.Low); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main difference between this and the existing I2C implementation is that the DC pin is set to LOW for commands and HIGH for data. The SSD1306 with I2C uses a control byte here.
@AdamJSchofield I noticed you marked this as work in progress and it is still a draft. Is this ready for review though? Is there anything we can do to help making it ready for review? |
Hi! I have since got it working and am putting together a final draft of the PR with a working example in the samples project for RaspberryPi boards. I hit a small snag last night but I expect I'll be able to push that up and mark it ready for review in the next few days. I'm also happy to close this PR/issue and open a new one when its actually ready if that helps you all stay organized. I jumped the gun a bit but I've since worked out most of the kinks. I may do that anyway since the nature of the PR will be more of a contribution with documentation and less of a cry for help 😆 |
Great to hear you have got it working now! No need to close this PR, we just need to mark it ready for review once you are ready, and then we can jump and take a peek 😃 |
d4ec5c3
to
55df856
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the addition! couple of comments in a very quick review
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
- Move SPI sample to separate sample project - Add sample ./deployToPi.ps1 script - Make SpiDevice internal and a property on Ssd13xx class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few questions left.
Sorry I forgot that I was assigned to this PR. Nice work!
_rstGpioPin.Write(PinValue.Low); | ||
Thread.Sleep(100); | ||
_rstGpioPin.Write(PinValue.High); | ||
Thread.Sleep(100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be useful to call Initialize()
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method was intended to just execute the specific sequence to reset the controller according to the datasheet. But practically, it could be useful to include other reset-related tasks. Calling Reset
and then Initialize
separately in a "re-initialization" procedure feels more intuitive to me personally, but I can see advantages to both.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@AdamJSchofield Thanks for this contribution |
Adds support for SSD1309 displays such as this one. Datasheet for the SSD1309 available here.
These transparent displays have many potential applications but the coolest is mini volumetric displays like this one (not my video).
Implementation Notes:
PreRenderBitmap
method was added to the baseSsd13xx
class. This is useful because it may not always be desired to send frames to the display immediately. An example of this is the simulation I included which uses one thread to buffer/render display-ready frames and another to send them to the display at a fixed rate. Obviously this only works for multi-core boards.Sample Notes:
Included is a sample simulation for falling sand. It looks pretty cool on the transparent OLED I tested with. My 4-core RaspberryPi Zero 2 was able to maintain 45 FPS without dropping frames. Rendering to a SkiaSharp bitmap is the bottleneck. Much faster speeds are possible with a large buffer or by using a 2D byte-array as the render state instead of drawing to a BitmapImage.
If desired, a
PreRenderBitmap
method could be added to theGraphicDisplay
base class allowing for theSsd1309Simulation
class to be extended for many other displays.Microsoft Reviewers: Open in CodeFlow