mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-04 15:07:46 +00:00
ef34c13cc12543f385ca916e3e93c6d083129b17
On some HD44780 boards (eg the Keyestudio LCD1602 expansion shield), the RW pin isn't brought out and is permanently grounded. This means that the board can't be read from, and in particular the busy status can't be read. This patch adapts the package to work with boards like these. To signal this to the package, set the RW pin to machine.NoPin. The package will then disallow all reading and use adjustable timing based writing. The timing can be adjusted the configuration.
drivers/flash: restore previous calls directly to machine package until we implement SetClockSpeed()
TinyGo Drivers
This package provides a collection of hardware drivers for devices that can be used together with TinyGo.
Installing
go get tinygo.org/x/drivers
How to use
Here is an example in TinyGo that uses the BMP180 digital barometer:
package main
import (
"time"
"machine"
"tinygo.org/x/drivers/bmp180"
)
func main() {
machine.I2C0.Configure(machine.I2CConfig{})
sensor := bmp180.New(machine.I2C0)
sensor.Configure()
connected := sensor.Connected()
if !connected {
println("BMP180 not detected")
return
}
println("BMP180 detected")
for {
temp, _ := sensor.ReadTemperature()
println("Temperature:", float32(temp)/1000, "°C")
pressure, _ := sensor.ReadPressure()
println("Pressure", float32(pressure)/100000, "hPa")
time.Sleep(2 * time.Second)
}
}
Currently supported devices
The following 53 devices are supported.
Contributing
Your contributions are welcome!
Please take a look at our CONTRIBUTING.md document for details.
License
This project is licensed under the BSD 3-clause license, just like the Go project itself.
Releases
10
Languages
Go
99.1%
Shell
0.7%