Skip to content
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

Added Ssd1306 Device Binding #188

Merged
merged 36 commits into from
Feb 14, 2019
Merged

Added Ssd1306 Device Binding #188

merged 36 commits into from
Feb 14, 2019

Conversation

shaggygi
Copy link
Contributor

@shaggygi shaggygi commented Feb 1, 2019

This includes the initial binding for the SSD1306 OLED display controller. It includes all commands to perform operations like configuring paging, scrolling and other display settings.

It also includes a method to send raw data. However, it is not as simple as sending "Hello .NET" as it doesn't know about text/images. There needs to be a future PR and separate graphics library created to efficiently perform the conversion to raw data to send to a binding like this. See #178.

This binding also only works with I2C devices for now. There are SPI devices available and this binding could be improved in a future PR for those.

{
byte Value { get; }

byte[] GetBytes();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do end up changing the way we get the bytes of the command in order to use Span and cheaper operations, we should probably expose the Length of bytes from this interface as well.

/// <summary>
/// The value that represents the command.
/// </summary>
public byte Id => (byte)ScrollType;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does casting the VerticalHorizontalScrollType enum to byte give the expected value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming by ContinuousVerticalAndHorizontalScrollSetupTests. Is there something else I need to be testing/checking?

Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for getting this in @shaggygi ! One last thing before merging, do you mind also adding this to the bindings list?

@shaggygi
Copy link
Contributor Author

I can, but will need to be in about 3 hours.

@@ -13,7 +13,7 @@ public class SetMultiplexRatio : ICommand
/// The output pads COM0-COM63 will be switched to the corresponding COM signal.
/// </summary>
/// <param name="multiplexRatio">Multiplex ratio with a range of 15-63.</param>
public SetMultiplexRatio(byte multiplexRatio = 0x63)
public SetMultiplexRatio(byte multiplexRatio = 63)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we want to expose in the public surface area? Why not just public SetMultiplexRatio(byte multiplexRatio)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few variables that have defaults when the device is reset. I thought it would be useful to have those as optional in the commands, but can remove if you think that approach is better. I'm on the fence.

Copy link

@ahsonkhan ahsonkhan Feb 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If having it explicitly be part of the API surface is useful to the caller and we don't ever expect it to change in the future, then it's fine to keep. The concern of exposing the value is that we can never change the "default" value it in the future.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a domain expert here, so take my suggestion with a grain of salt. It could very well be fine to keep the default parameter. cc @joperezr - thoughts?

Copy link

@ahsonkhan ahsonkhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, LGTM. Thanks for following up on the feedback :)

@shaggygi
Copy link
Contributor Author

@ahsonkhan I believe I now have all the updates in. I want to thank you again for the input/help. Stressful, but truly a learning opportunity 😄

@joperezr joperezr merged commit e952939 into dotnet:master Feb 14, 2019
@joperezr
Copy link
Member

Thanks for getting this in @shaggygi !

@shaggygi shaggygi deleted the Ssd1306-device-binding branch February 14, 2019 18:24
@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants