From be048a35bfa82f4f66c4a35a0692ba3879fd3235 Mon Sep 17 00:00:00 2001 From: Ron Evans Date: Thu, 7 Feb 2019 08:35:07 +0100 Subject: [PATCH] docs: commit initial version of README file Signed-off-by: Ron Evans --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..24b1dca --- /dev/null +++ b/README.md @@ -0,0 +1,70 @@ +# TinyGo Drivers + +[![GoDoc](https://godoc.org/github.com/tinygo-org/drivers?status.svg)](https://godoc.org/github.com/tinygo-org/drivers) + +This package provides a collection of hardware drivers for devices that can be used together with [TinyGo](https://tinygo.org). + +## Installing + +```shell +go get github.com/tinygo-org/drivers +``` + +## How to use + +Here is an example in TinyGo that uses the BMP180 digital barometer: + +```go +package main + +import ( + "time" + + "machine" + + "github.com/tinygo-org/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.Temperature() + println("Temperature:", float32(temp)/1000, "ÂșC") + + pressure, _ := sensor.Pressure() + println("Pressure", float32(pressure)/100000, "hPa") + + time.Sleep(2 * time.Second) + } +} +``` + +## Currently supported devices + +| Device Name | Interface Type | +|----------|-------------| +| [APA102 RGB LED](https://cdn-shop.adafruit.com/product-files/2343/APA102C.pdf) | SPI | +| [BlinkM RGB LED](http://thingm.com/fileadmin/thingm/downloads/BlinkM_datasheet.pdf) | I2C | +| [BMP180 barometer](https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf) | I2C | +| [MAG3110 magnetometer](https://www.nxp.com/docs/en/data-sheet/MAG3110.pdf) | I2C | +| [MMA8653 accelerometer](https://www.nxp.com/docs/en/data-sheet/MMA8653FC.pdf) | I2C | +| [MPU6050 accelerometer/gyroscope](https://store.invensense.com/datasheets/invensense/MPU-6050_DataSheet_V3%204.pdf) | I2C | +| [WS2812 RGB LED](https://cdn-shop.adafruit.com/datasheets/WS2812.pdf) | GPIO | + +## Contributing + +This collection of drivers is part of the [TinyGo](https://github.com/tinygo-org/tinygo) project. Patches are welcome but new drivers should follow the patterns established by similar existing drivers. + +## License + +This project is licensed under the BSD 3-clause license, just like the [Go project](https://golang.org/LICENSE) itself.