Signed-off-by: deadprogram <ron@hybridgroup.com>
TinyGo Drivers
This package provides a collection of hardware drivers for devices such as sensors and displays 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 58 devices are supported.
=======
docs: add missing new drivers added since last release | MCP23017 port expander | I2C | | MCP3008 analog to digital converter (ADC) | SPI | | Microphone - PDM | I2S/PDM | | MMA8653 accelerometer | I2C | | MPU6050 accelerometer/gyroscope | I2C | | PCD8544 display | SPI | | Resistive Touchscreen (4-wire) | GPIO | | Semihosting | Debug | | Shift register (PISO) | GPIO | | Shift registers (SIPO) | GPIO | | SHT3x Digital Humidity Sensor | I2C | | SPI NOR Flash Memory | SPI/QSPI | | SSD1306 OLED display | I2C / SPI | | SSD1331 TFT color display | SPI | | SSD1351 OLED display | SPI | | ST7735 TFT color display | SPI | | ST7789 TFT color display | SPI | | Stepper motor "Easystepper" controller | GPIO | | Thermistor | ADC | | TMP102 I2C Temperature Sensor | I2C | | VEML6070 UV light sensor | I2C | | VL53L1X time-of-flight distance sensor | I2C | | Waveshare 2.13" (B & C) e-paper display | SPI | | Waveshare 2.13" e-paper display | SPI | | Waveshare 4.2" e-paper B/W display | SPI | | WS2812 RGB LED | GPIO |
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.