drivers

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2019 License: BSD-3-Clause Imports: 1 Imported by: 0

README

TinyGo Drivers

GoDoc CircleCI

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

Device Name Interface Type
ADXL345 accelerometer I2C
APA102 RGB LED SPI
BH1750 ambient light sensor I2C
BlinkM RGB LED I2C
BMP180 barometer I2C
DS1307 real time clock I2C
DS3231 real time clock I2C
"Easystepper" stepper motor controller GPIO
ESP8266/ESP32 AT Command set for WiFi/TCP/UDP UART
GPS module I2C/UART
HUB75 RGB led matrix SPI
LIS3DH accelerometer I2C
MAG3110 magnetometer I2C
BBC micro:bit LED matrix GPIO
MMA8653 accelerometer I2C
MPU6050 accelerometer/gyroscope I2C
PCD8544 display SPI
SHT3x Digital Humidity Sensor I2C
SSD1306 OLED display I2C / SPI
Thermistor ADC
VL53L1X time-of-flight distance sensor I2C
Waveshare 2.13" e-paper display SPI
Waveshare 2.13" (B & C) e-paper 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.

Documentation

Overview

Package drivers provides a collection of hardware drivers for devices that can be used together with TinyGo (https://tinygo.org).

Here is an example in TinyGo that uses the BMP180 digital barometer:

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.ReadTemperature()
		println("Temperature:", float32(temp)/1000, "ºC")

		pressure, _ := sensor.ReadPressure()
		println("Pressure", float32(pressure)/100000, "hPa")

		time.Sleep(2 * time.Second)
	}
}

Each individual driver is contained within its own sub-package within this package and there are no interdependencies in order to minimize the final size of compiled code that uses any of these drivers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Displayer

type Displayer interface {
	// Size returns the current size of the display.
	Size() (x, y int16)

	// SetPizel modifies the internal buffer.
	SetPixel(x, y int16, c color.RGBA)

	// Display sends the buffer (if any) to the screen.
	Display() error
}

Directories

Path Synopsis
Package adxl345 provides a driver for the ADXL345 digital accelerometer.
Package adxl345 provides a driver for the ADXL345 digital accelerometer.
Package apa102 implements a driver for the APA102 SPI LED.
Package apa102 implements a driver for the APA102 SPI LED.
Package bh1750 provides a driver for the BH1750 digital Ambient Light Datasheet: https://www.mouser.com/ds/2/348/bh1750fvi-e-186247.pdf
Package bh1750 provides a driver for the BH1750 digital Ambient Light Datasheet: https://www.mouser.com/ds/2/348/bh1750fvi-e-186247.pdf
Package blinkm implements a driver for the BlinkM I2C RGB LED.
Package blinkm implements a driver for the BlinkM I2C RGB LED.
Package bmp180 provides a driver for the BMP180 digital pressure sensor by Bosch.
Package bmp180 provides a driver for the BMP180 digital pressure sensor by Bosch.
Package ds1307 provides a driver for the DS1307 RTC Datasheet: https://datasheets.maximintegrated.com/en/ds/DS1307.pdf
Package ds1307 provides a driver for the DS1307 RTC Datasheet: https://datasheets.maximintegrated.com/en/ds/DS1307.pdf
Package ds3231 provides a driver for the DS3231 RTC Datasheet: https://datasheets.maximintegrated.com/en/ds/DS3231.pdf
Package ds3231 provides a driver for the DS3231 RTC Datasheet: https://datasheets.maximintegrated.com/en/ds/DS3231.pdf
Simple driver to rotate a 4-wire stepper motor
Simple driver to rotate a 4-wire stepper motor
Package espat implements TCP/UDP wireless communication over serial with a separate ESP8266 or ESP32 board using the Espressif AT command set across a UART interface.
Package espat implements TCP/UDP wireless communication over serial with a separate ESP8266 or ESP32 board using the Espressif AT command set across a UART interface.
examples
apa102
Connects to an APA102 SPI RGB LED strip with 30 LEDS.
Connects to an APA102 SPI RGB LED strip with 30 LEDS.
blinkm
Connects to an BlinkM I2C RGB LED.
Connects to an BlinkM I2C RGB LED.
ds3231
Connects to an MAG3110 I2C magnetometer.
Connects to an MAG3110 I2C magnetometer.
espat/espconsole
This is a console to a ESP8266/ESP32 running on the device UART1.
This is a console to a ESP8266/ESP32 running on the device UART1.
espat/esphub
This is a sensor hub that uses a ESP8266/ESP32 running on the device UART1.
This is a sensor hub that uses a ESP8266/ESP32 running on the device UART1.
espat/espstation
This is a sensor station that uses a ESP8266 or ESP32 running on the device UART1.
This is a sensor station that uses a ESP8266 or ESP32 running on the device UART1.
lis3dh
Connects to a LIS3DH I2C accelerometer on the Adafruit Circuit Playground Express.
Connects to a LIS3DH I2C accelerometer on the Adafruit Circuit Playground Express.
mag3110
Connects to an MAG3110 I2C magnetometer.
Connects to an MAG3110 I2C magnetometer.
mma8653
Connects to an MMA8653 I2C accelerometer.
Connects to an MMA8653 I2C accelerometer.
mpu6050
Connects to an MPU6050 I2C accelerometer/gyroscope.
Connects to an MPU6050 I2C accelerometer/gyroscope.
thermistor
This example uses the settings for the thermistor that is built in to the Adafruit Circuit Playground Express.
This example uses the settings for the thermistor that is built in to the Adafruit Circuit Playground Express.
ws2812
Connects to an WS2812 RGB LED strip with 10 LEDS, such as on an Adafruit Circuit Playground Express board.
Connects to an WS2812 RGB LED strip with 10 LEDS, such as on an Adafruit Circuit Playground Express board.
Package gps provides a driver for GPS receivers over UART and I2C
Package gps provides a driver for GPS receivers over UART and I2C
Package lis3dh provides a driver for the HD44780 LCD controller.
Package lis3dh provides a driver for the HD44780 LCD controller.
Package hub75 implements a driver for the HUB75 LED matrix.
Package hub75 implements a driver for the HUB75 LED matrix.
Package lis3dh provides a driver for the LIS3DH digital accelerometer.
Package lis3dh provides a driver for the LIS3DH digital accelerometer.
Package mag3110 implements a driver for the MAG3110 3-axis magnetometer by Freescale/NXP.
Package mag3110 implements a driver for the MAG3110 3-axis magnetometer by Freescale/NXP.
Package microbitmatrix implements a driver for the BBC micro:bit's LED matrix.
Package microbitmatrix implements a driver for the BBC micro:bit's LED matrix.
Package mma8653 provides a driver for the MMA8653 3-axis accelerometer by Freescale/NXP.
Package mma8653 provides a driver for the MMA8653 3-axis accelerometer by Freescale/NXP.
Package mpu6050 provides a driver for the MPU6050 accelerometer and gyroscope made by InvenSense.
Package mpu6050 provides a driver for the MPU6050 accelerometer and gyroscope made by InvenSense.
Package pcd8544 implements a driver for the PCD8544 48x84 pixels matrix LCD, used in Nokia's 5110 and 3310 phones.
Package pcd8544 implements a driver for the PCD8544 48x84 pixels matrix LCD, used in Nokia's 5110 and 3310 phones.
Package sht3x provides a driver for the SHT3x digital humidity sensor series by Sensirion.
Package sht3x provides a driver for the SHT3x digital humidity sensor series by Sensirion.
Package ssd1306 implements a driver for the SSD1306 led matrix controller, it comes in various colors and screen sizes.
Package ssd1306 implements a driver for the SSD1306 led matrix controller, it comes in various colors and screen sizes.
Package thermistor is for temperature sensing using a thermistor such as the NTC 3950.
Package thermistor is for temperature sensing using a thermistor such as the NTC 3950.
Package vl53l1x provides a driver for the VL53L1X time-of-flight distance sensor Datasheet: https://www.st.com/resource/en/datasheet/vl53l1x.pdf This driver was based on the library https://github.com/pololu/vl53l1x-arduino and ST's VL53L1X API (STSW-IMG007) https://www.st.com/content/st_com/en/products/embedded-software/proximity-sensors-software/stsw-img007.html
Package vl53l1x provides a driver for the VL53L1X time-of-flight distance sensor Datasheet: https://www.st.com/resource/en/datasheet/vl53l1x.pdf This driver was based on the library https://github.com/pololu/vl53l1x-arduino and ST's VL53L1X API (STSW-IMG007) https://www.st.com/content/st_com/en/products/embedded-software/proximity-sensors-software/stsw-img007.html
epd2in13
Package epd2in13 implements a driver for Waveshare 2.13in black and white e-paper device.
Package epd2in13 implements a driver for Waveshare 2.13in black and white e-paper device.
epd2in13x
Package epd2in13x implements a driver for Waveshare 2.13in (B & C versions) tri-color e-paper device.
Package epd2in13x implements a driver for Waveshare 2.13in (B & C versions) tri-color e-paper device.
Package ws2812 implements a driver for WS2812 and SK6812 RGB LED strips.
Package ws2812 implements a driver for WS2812 and SK6812 RGB LED strips.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL