Commit Graph

366 Commits (9ab07ba9a6b1485342548aaaed9fbbb915c13187)
 

Author SHA1 Message Date
Michael Hanselmann 347b4e237c waveshare213v2: Make busy a PinIn, use WaitForEdge
The busy pin from the e-paper display is only used to read, not to
write, and thus there's no need for the PinIO interface. PinIn is
enough.

In addition the WaitForEdge function can be used to shorten the delays
when waiting for the display to become idle. Spurious or missed edges
are acceptable: the delay isn't very long.
4 years ago
Michael Hanselmann 5179e40adf waveshare213v2: Use color for clearing
This is an API-breaking change, albeit a simple one: Previously the
Dev.Clear function received a byte named "color". It was sent directly
to the display, thus acting more like a pattern to fill the display
with. In practice only 0 and 255 are likely to be used.

With this change the function is changed to receive a value of type
color.Color which is then converted to image1bit.Bit before filling the
display. The latter is also given a unittest.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
4 years ago
Michael Hanselmann ee4a6e4f2e waveshare213v2: Use correct row size for clearing
Commit ecc1eed contained a typo: the rows of data sent for clearing the
display were sized for the height instead of the width.
4 years ago
Michael Hanselmann e7981104ad waveshare2in13v2: Amend documentation with note on GDEH0213B73 4 years ago
Michael Hanselmann ecc1eed386 waveshare213v2: Add support for partial drawing
When the destination rectangle didn't start at (0,0) or cover the whole
display the Dev.Draw function would continue to update the display in
full. Obviously that didn't result in a good output.

This change updates the drawing logic to only update the affected area
(aligned to whole bytes on the horizontal axis) and limits the amount of
transferred data to the minimum needed to cover the destination
rectangle.

The calculation of the various offsets as well as the function sending
the image data are written to support unittesting.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
4 years ago
Michael Hanselmann abc5f2f9c2 waveshare213v2: Move code waiting for idle state to error handler
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
4 years ago
Michael Hanselmann b25f6410ea waveshare213v2: Move command and data sending code into error handler
This code isn't used directly and there's no need to keep the additional
complexity.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
4 years ago
Michael Hanselmann 969dc07218 waveshare213v2: Move error handler to separate file
The structure definition and the functions were already split up. Moving
to a separate file simplifies the code structure.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
4 years ago
Michael Hanselmann 670331bb80 waveshare213v2: Use error handler while clearing
Use the shared code for collecting errors.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
4 years ago
Michael Hanselmann 749694fcdb waveshare213v2: Separate functions for full and partial mode init
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
4 years ago
Michael Hanselmann 49c84dc6bb waveshare213v2: Avoid allocating for every row when drawing
Reuse the slice instead.
4 years ago
Marc-Antoine Ruel 9b7814b7f9 Update dependencies 4 years ago
Marc-Antoine Ruel 1a02735f94 go generate: replacement go get with go generate 4 years ago
Marc-Antoine Ruel 4d03e3f68b github actions: update go get to go install for go1.17 4 years ago
Michael Hanselmann 455934ac1d waveshare213v2: Always configure all aspects of RAM area
Set the start/end positions as well as the number of bytes to write by
computing them from an `image.Rectangle`. This is a preparatory step for
implementing partial image updates.

Also change the data entry mode setting to 0x03, the value applied at
power-on reset. It's not actually used given the way memory updates are
written (one large block instead of chunks).

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
4 years ago
Michael Hanselmann 414c28d5c6 waveshare213v2: Avoid using a slice for commands
All commands consist of a single byte and there's no need to use
a slice.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
4 years ago
Michael Hanselmann c38b40a52a waveshare213v2: Document more values
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>
4 years ago
hansmi 5b35a3fb05
waveshare2in13v2: Deduplicate and simplify logic for sending data (#33)
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>
4 years ago
hansmi 37f977f749
videosink: Add options for JPEG and PNG encoders (#30)
Expose the quality settings for the JPEG encoder and the compression
level of the PNG encoder via the Options structure.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
4 years ago
hansmi 58303fd4d6
videosink: Add missing comment on Display structure (#31) 4 years ago
hansmi 42ee8553ed
Add videosink display driver (#27)
The videosink package provides a display driver implementing an HTTP
request handler. Client requests get an initial snapshot of the graphics
buffer and are updated further on every change.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
4 years ago
hansmi 02831f4a67
Bump Go version in go.mod and for quick tests to 1.14 (#29)
Go 1.13 was released in September 2019, more than two years ago.
Updating to one later release should be fine.

The primary reason for doing this is the introduction of
"testing".T.Cleanup in Go 1.14 (https://pkg.go.dev/testing#T.Cleanup).

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
5 years ago
hansmi d09d487465
Remove dependencies on fogleman/gg and golang/freetype (#28)
The waveshare2in13v2 example was evidently copied from the epd example,
but didn't comment out the code pulling in additional dependencies.
5 years ago
hansmi d92a4ed45d
waveshare2in13v2: Add constants, add missing init to example (#25)
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>
5 years ago
Bracken 7836991f22
mfrc522: The default should be not bogus (#24) 5 years ago
Bracken 00ed90382f
mfrc522 - Fix 4-byte tag UIDs (#22)
4-byte UIDs incorrectly included a 5th csum byte. 7-byte UIDs were unaffected.
5 years ago
Marc-Antoine Ruel 47f3fec45d go.mod: update dependencies 5 years ago
Marc-Antoine Ruel cfbbeedbcb README: update badge 5 years ago
Marc-Antoine Ruel ecaf62d235 gohci and github actions: improve testing 5 years ago
Benjamin Böhmke 3b2961221d
ds18b20: fixed conversion time for DS18S20 + cleanup (#19)
* proper handle DS18S20 conversion time

* cleanup and docu fix for ds18b20
5 years ago
Benjamin Böhmke ddb2231182
Support for DS18S20 (#18) 5 years ago
Marc-Antoine Ruel b5024d6816 github actions: skip unnecessary checks
No need to test 1.14.7, 1.13.15 is already sufficient.
No need to test in GOPATH mode.
5 years ago
Marc-Antoine Ruel 97998e315b github action: update for go1.17 and fix checks for PRs
- Use go1.17 for github actions.
- Use go mod edit instead of go get for testing other packages. There's two
  benefits:
  - This removes the round trip to pkg.go.dev and use the already present local
    checkout.
  - The go get periph.io/x/conn/v3@${GITHUB_SHA} command worked if a maintainer
    push a branch, but fails for a PR. This is because the go get command does a
    clone with all the branches, so it finds the commit even if it's not in main.
    For a PR, one has to pull a specific refs/pull/ID/head ref that is not a
    branch, thus go get cannot find it because git clone doesn't know about it.
    The only way to work around is to git clone manually.
- Remove 'go version' and 'go env' since they are already run as part of
  setup-go@v2.
- Fix a new check in go vet in example code.
5 years ago
Marc-Antoine Ruel 440ba6e652 Fix ineffassign check 5 years ago
Marc-Antoine Ruel 0b81efc55a Roll dependencies 5 years ago
Marc-Antoine Ruel 287b18d411 Add gohci forward tests
Test with cmd with the current devices commit.
5 years ago
Marc-Antoine Ruel 823eae07fd staticcheck: enforce
This does result in a few awkward cases but in general it's worth
enforcing and most importantly will make my life as a code reviewer
easier.

It's mostly deletion of dead code.
5 years ago
Marc-Antoine Ruel a27238ec6e enforce no shadowed variable
Convert a few wrapped error from %v to %w.

This does result in a few awkward cases but the value outweighs the
downsides.
5 years ago
Marc-Antoine Ruel 31cac53e0a github: test on cmd in advance 5 years ago
Marc-Antoine Ruel 9d89bbe62d Update issue and PR github templates 5 years ago
Audrius Paskevicius 764682acfd
ds248x: add support for DS2482-800 in addition to DS2482-100 (#13) 5 years ago
Ohad Lutzky 8249b953cd
ssd1306: Add SetDisplayStartLine (#14) 5 years ago
Thereatra 765957cae1
[Inky] autodetect board opts and pHAT v2 support (#12)
* Added support for Inky pHAT v2
* Added support for detecting Inky board. Detect Inky board opts from eeprom, and detect new inky dev with sane default from opts
5 years ago
Marc-Antoine Ruel c53a2960d0 Add unnamed private struct
Forces the use of named values
5 years ago
Marc-Antoine Ruel 4d2d9a5ccb Bump go to 1.16 5 years ago
Marc-Antoine Ruel 94908ff801 screen1d: import from periph/extra
Tweak it a bit to expose the palette as an option.
Uses the same license.
This is the first commit that causes a dependency on golang.org/x/sys.
5 years ago
bezineb5 fa6bf2a91f
[TLV493D] Method to calibrate temperature offset (#10) 5 years ago
bezineb5 0900f2cbf4
[TLV493D] Method to calibrate temperature offset (#9) 5 years ago
Dan Kortschak 960e8d343b
waveshare2in13v2: add example (#8) 5 years ago
Bracken 7cccb95509
Prevent WaitForEdge() returning early after first call to selectCard() (#7)
Calling LowLevel.Init() in selectCard() clears the device interrupt
as a side effect, but another interrupt will occur due to the
subsquent operations. This additional host interrupt must be cleared
before the next call to selectCard.

Fixes https://github.com/google/periph/issues/425
5 years ago