-
Notifications
You must be signed in to change notification settings - Fork 198
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
pcf8523: RTC driver #599
pcf8523: RTC driver #599
Conversation
func assertNoError(t testing.TB, e error) { | ||
if e != nil { | ||
t.Fatalf("unexpected error: %v", e) | ||
} | ||
} | ||
func assertEquals[T comparable](t testing.TB, a, b T) { | ||
if a != b { | ||
t.Fatalf("%v != %v", a, b) | ||
} | ||
} |
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.
I've tried to use quicktest instead but always run into a panic: unimplemented: (reflect.Type).IsVariadic()
error.
Happy to change if somebody can point me towards how to fix that.
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.
See https://github.com/tinygo-org/drivers/blob/dev/mcp23017/device_test.go for driver that is using it now.
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.
I think you need
c := qt.New(t)
bus := tester.NewI2CBus(c)
instead of
bus := tester.NewI2CBus(t)
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.
Actually the linked test also doesn't work 🤕
~> tinygo test -v ./mcp23017
panic: unimplemented: (reflect.Type).IsVariadic()
FAIL tinygo.org/x/drivers/mcp23017 3.049s
I use:
~> tinygo version
tinygo version 0.29.0 linux/amd64 (using go version go1.20.7 and LLVM version 16.0.6)
Looking at the sources that is indeed not implemented:
https://github.com/search?q=repo%3Atinygo-org/tinygo%20IsVariadic&type=code
But I see the tests are run against some bleeding edge version where the tests don't fail:
https://github.com/tinygo-org/drivers/actions/runs/6232602259/job/16916095548#step:5:5
But I couldn't find the corresponding tag/branch in the tinygo repo.
Test's fail because I use some go1.18 features, e.g. Is it intentionally still at go1.15 or is that just not updated? |
Should probably update the minimum version. |
Bumped to 1.18, works all fine now. |
Driver for the pcf8523 RTC clocks as found on https://www.adafruit.com/product/2922 .
Interface similar to other RTC drivers :)