Skip to content
Examples of many of my rust device drivers in hardware
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Additional example programs for several rust drivers

Build Status

This repository includes examples of using devices through these drivers:

Device driver Description Interface Introductory blog post
Ads1x1x 12/16-bit Analog-to-digital (ADC) converters. I2C Intro blog post
Apds9960 Digital proximity, ambient light, RGB and gesture sensor. I2C
Ds1307 Real-time clock (RTC). I2C Intro blog post
Ds323x Extremely accurate real-time clock (RTC). I2C / SPI
Kxcj9 Tri-axis accelerometer I2C
Eeprom24x 24x series serial EEPROM devices. I2C Intro blog post
Lm75 Temperature sensor and thermal watchdog. I2C
Max3010x Pulse oximeter and heart-rate sensor. I2C
Mcp4x Digital potentiometers. SPI
Mcp49x 8/10/12-bit Digital-to-analog (DAC) converters. SPI
Pcf857x 8/16-pin I/O port expanders. I2C
Pwm-pca9685 16-pin PWM port expander / LED driver. I2C
Tcs3472 RGBW light color sensor with IR filter. I2C
Tmp006 Non-contact infrared (IR) thermopile temperature sensor. I2C Intro blog post
Tmp1x2 Temperature sensors. I2C Intro blog post
Veml6040 RGBW light color sensor. I2C
Veml6075 Ultraviolet A (UVA) and B (UVB) light sensor. I2C

These examples use the STM32F3Discovery board. At the beginning of each example the setup and behavior is described. Many of them also use an SSD1306 OLED display. You can get the modules used here on AliExpress generally for a very small price.

For example, to run the f3-mcp41x example: First, connect your discovery board per USB, then connect OpenOCD in a terminal with:

openocd -f interface/stlink-v2-1.cfg -f target/stm32f3x.cfg

Then on another terminal run:

git clone
cd driver-examples
cargo run --example f3-mcp41x


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

You can’t perform that action at this time.