Skip to content

Commit 0b02c1d

Browse files
FeikoEllerbach
andauthored
[Ssd13xx] Added Sh1106 that needs a different PageCmd (#1383)
Co-authored-by: Laurent Ellerbach <[email protected]>
1 parent 529382c commit 0b02c1d

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

devices/Ssd13xx/Sh1106.cs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System;
5+
using System.Device.Gpio;
6+
using System.Device.I2c;
7+
using Iot.Device.Ssd13xx.Commands;
8+
9+
namespace Iot.Device.Ssd13xx
10+
{
11+
/// <summary>
12+
/// A single-chip CMOS OLED/PLED driver with controller for organic/polymer
13+
/// light emitting diode dot-matrix graphic display system.
14+
/// </summary>
15+
public class Sh1106 : Ssd1306
16+
{
17+
private byte[] _pageCmd = new byte[]
18+
{
19+
0x00,
20+
0xB0,
21+
0x00,
22+
0x10
23+
};
24+
25+
/// <summary>
26+
/// Initializes a new instance of the <see cref="Sh1106" /> class.
27+
/// A single-chip CMOS OLED/PLED driver with controller for organic/polymer
28+
/// light emitting diode dot-matrix graphic display system.
29+
/// </summary>
30+
/// <param name="i2cDevice">The I2C device used for communication.</param>
31+
/// <param name="resetPin">Reset pin (some displays might be wired to share the microcontroller's
32+
/// reset pin).</param>
33+
public Sh1106(I2cDevice i2cDevice, int resetPin = -1) : base(i2cDevice, DisplayResolution.OLED128x64, DisplayOrientation.Landscape, resetPin)
34+
{
35+
SetPageCmd(_pageCmd);
36+
}
37+
38+
/// <summary>
39+
/// Initializes a new instance of the <see cref="Sh1106" /> class.
40+
/// A single-chip CMOS OLED/PLED driver with controller for organic/polymer
41+
/// light emitting diode dot-matrix graphic display system.
42+
/// </summary>
43+
/// <param name="i2cDevice">The I2C device used for communication.</param>
44+
/// <param name="res">Display resolution.</param>
45+
/// <param name="orientation">Rotation of the display with reference to the hardware's default orientation.</param>
46+
/// <param name="resetPin">Reset pin (some displays might be wired to share the microcontroller's
47+
/// reset pin).</param>
48+
/// <param name="gpio">Gpio Controller.</param>
49+
/// <param name="shouldDispose">True to dispose the GpioController.</param>
50+
public Sh1106(I2cDevice i2cDevice, DisplayResolution res, DisplayOrientation orientation = DisplayOrientation.Landscape, int resetPin = -1, GpioController gpio = null, bool shouldDispose = true) : base(i2cDevice, res, orientation, resetPin, gpio, shouldDispose)
51+
{
52+
SetPageCmd(_pageCmd);
53+
}
54+
}
55+
}

devices/Ssd13xx/Ssd13xx.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,16 @@ public enum DisplayResolution
683683
OLED64x128
684684
}
685685

686+
/// <summary>
687+
/// Set custom page mode output command bytes.
688+
/// <para></para>
689+
/// </summary>
690+
/// <param name="pageCmd">An array of bytes representing the custom page mode command.</param>
691+
internal void SetPageCmd(byte[] pageCmd)
692+
{
693+
_pageCmd = pageCmd;
694+
}
695+
686696
/// <summary>
687697
/// Page mode output command bytes.
688698
/// </summary>

devices/Ssd13xx/Ssd13xx.nfproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<Compile Include="IFont.cs" />
5656
<Compile Include="ListByte.cs" />
5757
<Compile Include="DisplayOrientation.cs" />
58+
<Compile Include="Sh1106.cs" />
5859
<Compile Include="Ssd1306.cs" />
5960
<Compile Include="Ssd1327.cs" />
6061
<Compile Include="Ssd13xx.cs" />

0 commit comments

Comments
 (0)