tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
622 stars 196 forks source link

dht package is broken #696

Closed Gnyblast closed 4 months ago

Gnyblast commented 4 months ago

Since release v0.20.0 when device.go introduced to the package, the methods are gone for dht package like: dht.New(). dht package now only exposes device.go constants and types which just 3 items, as you can see in the image below.

image

v0.19.0 seem to not having this issue though.

I don't think I'm doing some miss-implementation because your example is also using that way which is not exist anymore.

I see when I compare this dht package tagged with //go:build tinygo any reason doing that? Gopls now does not support it.

deadprogram commented 4 months ago

Hello @Gnyblast I think the issue must be with the auto-complete in your editor, since the dht package itself builds correctly in the CI.

See https://github.com/tinygo-org/drivers/blob/release/smoketest.sh#L101 and https://github.com/tinygo-org/drivers/actions/runs/9563791661/job/26363092847#step:8:378

Perhaps you need to open an issue in https://github.com/tinygo-org/vscode-tinygo?

Gnyblast commented 4 months ago

Yeah since addition of go tags to top //go:build tinygo, gopls stopped working.

Gnyblast commented 4 months ago

Yeah problem was vscode-tinygo configs from the looks of it. Thanks.

Gnyblast commented 4 months ago

Sorry to coming back to this again but let me explain. I'm writing a program for especially for Raspberry pi (not pico) models. And I'm not using tinygo because it's obviosuly running an OS not a microcontroller. I just wanted to take advantage of your drivers module to create a factory for input devices, communicate and fetch data from them. But obviously since v0.20.0 the addition of //go:build tinygo prevents default gopls on vscode to resolve the code correctly also the go compiler as well. This go tag is added because the code is not compatible with main go binary for compilation and being used as library or just to make things more integrated on tinygo side?