Skip to content
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

Closed
wants to merge 3 commits into from
Closed

pcf8523: RTC driver #599

wants to merge 3 commits into from

Conversation

trichner
Copy link
Contributor

Driver for the pcf8523 RTC clocks as found on https://www.adafruit.com/product/2922 .

Interface similar to other RTC drivers :)

Comment on lines +82 to +91
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)
}
}
Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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)

Copy link
Contributor Author

@trichner trichner Sep 19, 2023

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.

@trichner
Copy link
Contributor Author

Test's fail because I use some go1.18 features, e.g. pcf8523/pcf8523_test.go:30:2: implicit function instantiation requires go1.18 or later (-lang was set to go1.15; check go.mod)

Is it intentionally still at go1.15 or is that just not updated?

@deadprogram
Copy link
Member

Should probably update the minimum version.

@trichner
Copy link
Contributor Author

Should probably update the minimum version.

Bumped to 1.18, works all fine now.

pcf8523/pcf8523.go Outdated Show resolved Hide resolved
@deadprogram
Copy link
Member

@trichner I pulled your commits into #600 where I rebased them together and merged into dev. Thank you very much for all your work on this! Now closing this PR.

@trichner
Copy link
Contributor Author

@trichner I pulled your commits into #600 where I rebased them together and merged into dev. Thank you very much for all your work on this! Now closing this PR.

Wonderful, thanks for the reviews and help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants