From 5e82e8a771ecb56b815ee3801cc2a9e724dac065 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 12 Dec 2021 21:06:42 +0100 Subject: [PATCH] updated links, deps for updated ADC code --- Cargo.toml | 1 + src/button.rs | 4 ++-- src/leds.rs | 4 +++- src/max11619.rs | 33 +++++++++++++++++++++++++-------- src/temp_sensor.rs | 2 +- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cb8fb99..8f1c22c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ categories = ["embedded", "no-std", "hardware-support"] cortex-m = "0.7.3" cortex-m-rt = "0.7.0" embedded-hal = "0.2.6" +dummy-pin = "0.1.1" [dependencies.max116xx-10bit] path = "../max116xx-10bit" diff --git a/src/button.rs b/src/button.rs index d297124..d45ef15 100644 --- a/src/button.rs +++ b/src/button.rs @@ -2,8 +2,8 @@ //! //! ## Examples //! -//! - [Button Blinky with Interrupts](https://github.com/robamu-org/vorago-reb1-rs/blob/main/examples/blinky-button-irq.rs) -//! - [Button Blinky with Interrupts using RTIC](https://github.com/robamu-org/vorago-reb1-rs/blob/main/examples/blinky-button-rtic.rs) +//! - [Button Blinky with IRQs](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/blinky-button-irq.rs) +//! - [Button Blinky with IRQs and RTIC](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/blinky-button-rtic.rs) use va108xx_hal::{ gpio::{FilterClkSel, FilterType, InputFloating, InterruptEdge, InterruptLevel, Pin, PA11}, pac, diff --git a/src/leds.rs b/src/leds.rs index 46a68b7..cd06858 100644 --- a/src/leds.rs +++ b/src/leds.rs @@ -2,7 +2,9 @@ //! //! ## Examples //! -//! - [LED example](https://github.com/robamu-org/vorago-reb1-rs/blob/main/examples/blinky-leds.rs) +//! - [LED example](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/blinky-leds.rs) +//! - [Button Blinky using IRQs](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/blinky-button-irq.rs) +//! - [Button Blinky using IRQs and RTIC](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/blinky-button-rtic.rs) use va108xx_hal::{ gpio::dynpins::DynPin, gpio::pins::{Pin, PushPullOutput, PA10, PA6, PA7}, diff --git a/src/max11619.rs b/src/max11619.rs index cc52b55..43e1f3b 100644 --- a/src/max11619.rs +++ b/src/max11619.rs @@ -1,15 +1,23 @@ +//! This module provides a thin REB1 specific layer on top of the `max116xx_10bit` driver crate +//! +//! ## Examples +//! +//! - [ADC example](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/max11619-adc.rs) +use core::convert::Infallible; + +use dummy_pin::DummyPin; +use embedded_hal::{blocking::spi::Transfer, spi::FullDuplex}; use max116xx_10bit::{ Error, ExternallyClocked, InternallyClockedInternallyTimedSerialInterface, Max11619, Max116xx10Bit, RefMode, WithoutWakeupDelay, }; -use embedded_hal::blocking::spi::Transfer; -use embedded_hal::spi::FullDuplex; use va108xx_hal::gpio::{Floating, Input, Pin, PA14}; pub type Max11619ExternallyClocked = - Max116xx10Bit; + Max116xx10Bit; pub type Max11619InternallyClocked = Max116xx10Bit< SPI, + DummyPin, Max11619, InternallyClockedInternallyTimedSerialInterface, WithoutWakeupDelay, @@ -23,26 +31,35 @@ pub const POTENTIOMETER_CHANNEL: u8 = 3; pub fn max11619_externally_clocked( spi: SPI, -) -> Result, Error> +) -> Result, Error> where SPI: Transfer + FullDuplex, { - let adc: Max116xx10Bit = - Max116xx10Bit::new(spi, RefMode::ExternalSingleEndedNoWakeupDelay)?; + let adc: Max116xx10Bit = + Max116xx10Bit::new( + spi, + DummyPin::new_low(), + RefMode::ExternalSingleEndedNoWakeupDelay, + )?; Ok(adc) } pub fn max11619_internally_clocked( spi: SPI, -) -> Result, Error> +) -> Result, Error> where SPI: Transfer + FullDuplex, { let adc: Max116xx10Bit< SPI, + DummyPin, Max11619, InternallyClockedInternallyTimedSerialInterface, WithoutWakeupDelay, - > = Max116xx10Bit::new(spi, RefMode::ExternalSingleEndedNoWakeupDelay)?; + > = Max116xx10Bit::new( + spi, + DummyPin::new_low(), + RefMode::ExternalSingleEndedNoWakeupDelay, + )?; Ok(adc) } diff --git a/src/temp_sensor.rs b/src/temp_sensor.rs index 173382d..e5f664f 100644 --- a/src/temp_sensor.rs +++ b/src/temp_sensor.rs @@ -4,7 +4,7 @@ //! //! ## Examples //! -//! - [Temperature Sensor example](https://github.com/robamu-org/vorago-reb1-rs/blob/main/examples/temp-sensor.rs) +//! - [Temperature Sensor example](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/adt75-temp-sensor.rs) use cortex_m::prelude::_embedded_hal_blocking_i2c_Write; use embedded_hal::blocking::i2c::{Read, SevenBitAddress}; use va108xx_hal::{