-
Notifications
You must be signed in to change notification settings - Fork 44
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
waveshare2in13v2: Add constants, add missing init to example #25
Conversation
fmt.Sprintf() can format numbers directly using the "%d" format specifier. Signed-off-by: Michael Hanselmann <public@hansmi.ch>
waveshare2in13v2/example_test.go
Outdated
log.Fatalf("Failed to initialize driver: %v", err) | ||
} | ||
|
||
if err := dev.Init(false); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please unshadow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
waveshare2in13v2/waveshare213v2.go
Outdated
setDummyLinePeriod byte = 0x3A | ||
setGateTime byte = 0x3B | ||
borderWaveformControl byte = 0x3C | ||
unknownCommand37 byte = 0x37 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was it listed in the datasheet or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this was a leftover from an earlier revision. No, this particular command isn't documented anywhree. I removed the constant again.
Without initializing the hardware nothing is shown on the display. Signed-off-by: Michael Hanselmann <public@hansmi.ch>
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>
Codecov Report
@@ Coverage Diff @@
## main #25 +/- ##
=====================================
Coverage 60.3% 60.3%
=====================================
Files 48 48
Lines 6454 6453 -1
=====================================
Hits 3893 3893
+ Misses 2426 2425 -1
Partials 135 135
Continue to review full report at Codecov.
|
Thanks! |
Translate magic numbers to named constants based on datasheet and add missing calls to
dev.Init
in example code.