Introduce named constants where possible (based on the data sheet) and
compute values instead of using hardcoded ones.
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Dev.Clear: Avoid writing one beyond the end of the line. Also build the
row data only once before sending it for each line.
Dev.Draw, Dev.DrawPartial: Deduplicate logic for iterating over pixels
and simplify it such that a whole row of bits is built before sending
them in one go.
Tested using a Waveshare e-Paper 2.13in V2 display.
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Avoid using strconv.Itoa
fmt.Sprintf() can format numbers directly using the "%d" format
specifier.
Call Dev.Init in example code
Without initializing the hardware nothing is shown on the display.
Add constants for commands
Translate the command names from the datasheet into constant names,
similar to `epd/epd.go`. These names make it easier to understand what
the driver does.
One command, 0x37, is not documented in any of the datasheets available
(Waveshare 2.13inch e-Paper, Good Display GDEH0213B72).
Signed-off-by: Michael Hanselmann <public@hansmi.ch>