Skip to content

ssd1306 64x32 needs weird ResetCol #842

@nealey

Description

@nealey

If you are writing code to interface with a 64x32 SSD1306, you need to pass in a weird ResetCol in the configuration:

	display := ssd1306.NewI2C(machine.I2C0)
	display.Configure(
		ssd1306.Config{
			Width:   64,
			Height:  32,
			ResetCol: ssd1306.ResetValue{0x20, 0x20+64-1},
			Address: 0x3C,
		},
	)

I suspect (but have not verified) that this could be made the default in ssd1306/ssd1306.go by checking for width=64 like the Adafruit library does:

@@ -77,6 +118,8 @@ func (d *Device) Configure(cfg Config) {
        }
        if cfg.ResetCol != zeroReset {
                d.resetCol = cfg.ResetCol
+       } else if d.width == 64 {
+               d.resetCol = ResetValue{0x20, uint8(0x20 + d.width - 1)}
        } else {
                d.resetCol = ResetValue{0, uint8(d.width - 1)}
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions