Smdn.Devices.US2066 is a .NET library for controlling WiseChip US2066 OLED Driver with Controller.
This library enables you to control OLED character display modules which has US2066 controller chip.
The supported display modules are listed in tested and supported display modules.
Smdn.Devices.US2066
is based on Iot.Device.Bindings. This library enables you to control OLED character displays connected to the board like Raspberry Pi which Iot.Device.Bindings
supports.
Also combined with the library Smdn.Devices.MCP2221.GpioAdapter, you can control the OLED displays via USB connection even on generic PCs without using the specific board like Arduino. See MCP2221 example.
Smdn.Devices.US2066
can output string
s directly. Symbols and non-ASCII characters are automatically converted to the appropriate byte
s, and are displayed on the OLED display.
As an example, the string
"ÄÁΩ⏫→"
will be displayed like .
For more information about character mapping, see this document.
(⚠The character mapping of CGROM-B and some other characters, especially alphabets with diacritical marks, are incomplete. Contributions are welcome! See issue #2)
Smdn.Devices.US2066
also supports Japanese full-width Hiragana/Katakana to half-width Katakana conversion(全角かな/全角カナ→半角カナ変換), Russian lower case to upper case conversion.
As an example, the following string
s will be displayed like below.
string |
Characters on display |
---|---|
"こんにちは、せかい!" |
|
"Привет, мир!" |
See example of helloworld-ja and helloworld-ru.
US2066
supports registering custom characters. Smdn.Devices.US2066
can map custom characters to any characters including emojis on registration.
using Smdn.Devices.US2066;
using var display = SO1602A.Create(SO1602A.DefaultI2CAddress);
display.CGRamUsage = CGRamUsage.UserDefined6Characters;
// define and register a custom character, and map to the emoji
display.CreateCustomCharacter(
CGRamCharacter.Character0,
"🙂", // emoji for this custom character
new byte[8] {
0b_00000, // 🟪🟪🟪🟪🟪
0b_01010, // 🟪🟨🟪🟨🟪
0b_01010, // 🟪🟨🟪🟨🟪
0b_00000, // 🟪🟪🟪🟪🟪
0b_10001, // 🟨🟪🟪🟪🟨
0b_01110, // 🟪🟨🟨🟨🟪
0b_00000, // 🟪🟪🟪🟪🟪
0b_00000, // 🟪🟪🟪🟪🟪
}
);
// display the registered custom character by specifying mapped emoji
display.Write("🙂");
See example of customcharacters for detail.
- Interface
- 4/b bit 6800/8080
- SPI
- I2C
- Fundamental Command Set
- Clear Display
- Return Home
- Entry Mode Set
- Display ON/OFF Control
- Extended Function Set
- Cursor or Display Shift
- Double Height / Display dot shift
- Shift Enable
- Scroll Enable
- Function Set
- Set CGRAM address
- Set DDRAM address
- Set Scroll Quantity
- Read Busy Flag and Address/Part ID
- not tested
- Write data
- Read data
- not tested
- Extended Command Set
- Function Selection A
- Function Selection B
- OLED Characterization
- OLED Command Set
- Set Contrast Control
- Set Display Clock Divide Ratio / Oscillator Frequency
- Set Phase Length
- Set SEG Pins Hardware Configuration
- Set VCOMH Deselect Level
- Function Selection C
- Set Fade Out and Blinking
Series | Model No. | Size | Image |
---|---|---|---|
SUNLIKE DISPLAY SO Series (SOXXXXA) | SO1602A | 16×2 | |
SO2002A | 20×2 |
By deriving from the class US2066DisplayModuleBase
, other display modules can also be worked.
Firstly, add package Smdn.Devices.US2066 to your project.
dotnet add package Smdn.Devices.US2066
Nextly, write your codes. The simpliest Hello, world!
code is like below. This code uses the display module SO1602A
.
using Smdn.Devices.US2066;
using var display = SO1602A.Create(SO1602A.DefaultI2CAddress);
display.Write("Hello, world!");
For detailed instructions, including wiring of the devices and parts, see examples/helloworld.
More examples can be found in examples directory.