Home

Awesome

Additional example programs for several rust drivers

Build Status

This repository includes examples of using devices through these drivers:

Device driverDescriptionInterfaceIntroductory blog post
Ad983xWaveform generator / direct digital synthesizer (DDS).SPIIntro blog post
Ads1x1x12/16-bit Analog-to-digital (ADC) converters.I2CIntro blog post
Apds9960Digital proximity, ambient light, RGB and gesture sensor.I2C
Bmi160Inertial measurement unit (IMU) (accelerometer + gyro).I2C / SPI
Ds1307Real-time clock (RTC) / calendar.I2CIntro blog post
Ds323xExtremely accurate real-time clock (RTC) / calendar.I2C / SPI
Eeprom24x24x series serial EEPROM devices.I2CIntro blog post
Embedded-Ccs811Digital gas sensor for monitoring indoor air quality.I2CIntro blog post
Hdc20xxTemperature and humidity sensors.I2C
iAQ-CoreIndoor air quality sensor.I2C
Isl29125RGB color light sensor with IR blocking filter.I2C
Kxcj9Tri-axis MEMS accelerometer.I2CIntro blog post
Lm75Temperature sensor and thermal watchdog.I2C
Lsm303agrTri-axis accelerometer and tri-axis magnetometer.I2C / SPI
Max170xxFuel-gauge for lithium-ion (Li+) batteries.I2C
Max3010xPulse oximeter and heart-rate sensor.I2C
Max44009Ambient light sensor.I2C
Mcp4xDigital potentiometers.SPI
Mcp49xx8/10/12-bit Digital-to-analog (DAC) converters.SPI
Mcp794xxReal-time clock (RTC) / calendar.I2CIntro blog post
Mlx9061xNon-contact infrared (IR) thermometer.I2C
Mma8x5xTri-axis MEMS accelerometers.I2C
Opt300xAmbient light sensor.I2CIntro blog post
Pcf857x8/16-pin I/O port expanders.I2C
Pwm-Pca968516-pin PWM port expander / LED driver.I2CIntro blog post
Si4703FM radio turners (receivers).I2CIntro blog post
Tcs3472RGBW light color sensor with IR filter.I2C
Tmp006Non-contact infrared (IR) thermopile temperature sensor.I2CIntro blog post
Tmp1x2Temperature sensors.I2CIntro blog post
Veml6030Ambient light sensor.I2CIntro blog post
Veml6040RGBW light color sensor.I2C
Veml6070Ultraviolet A (UVA) light sensor.I2C
Veml6075Ultraviolet A (UVA) and B (UVB) light sensor.I2CIntro blog post
W25Winbond's W25 serial flash memory devices.SPI
Xca9548aTCA9548A/PCA9548A I2C switches/multiplexers.I2C

These examples use several boards: STM32F3-Discovery, STM32F103 "Blue pill", Raspberry Pi and Micro:bit V2. These are classified in different folders.

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

These examples are guaranteed to build with the latest Rust stable release. If you get a build error, try updating your Rust installation.

To run the examples, clone this repository, go to the appropriate folder and run either cargo embed or cargo run. Look in the README of each folder for instructions.

git clone https://github.com/eldruin/driver-examples
cd driver-examples/stm32f1-bluepill
# ...

License

Licensed under either of:

at your option.

Contributing

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.