updated links, deps for updated ADC code

This commit is contained in:
Robin Müller 2021-12-12 21:06:42 +01:00
parent 4b3a46bbbb
commit 5e82e8a771
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
5 changed files with 32 additions and 12 deletions

View File

@ -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"

View File

@ -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,

View File

@ -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},

View File

@ -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<SPI> =
Max116xx10Bit<SPI, Max11619, ExternallyClocked, WithoutWakeupDelay>;
Max116xx10Bit<SPI, DummyPin, Max11619, ExternallyClocked, WithoutWakeupDelay>;
pub type Max11619InternallyClocked<SPI> = Max116xx10Bit<
SPI,
DummyPin,
Max11619,
InternallyClockedInternallyTimedSerialInterface,
WithoutWakeupDelay,
@ -23,26 +31,35 @@ pub const POTENTIOMETER_CHANNEL: u8 = 3;
pub fn max11619_externally_clocked<SpiE, SPI>(
spi: SPI,
) -> Result<Max11619ExternallyClocked<SPI>, Error<SpiE>>
) -> Result<Max11619ExternallyClocked<SPI>, Error<SpiE, Infallible>>
where
SPI: Transfer<u8, Error = SpiE> + FullDuplex<u8, Error = SpiE>,
{
let adc: Max116xx10Bit<SPI, Max11619, ExternallyClocked, WithoutWakeupDelay> =
Max116xx10Bit::new(spi, RefMode::ExternalSingleEndedNoWakeupDelay)?;
let adc: Max116xx10Bit<SPI, DummyPin, Max11619, ExternallyClocked, WithoutWakeupDelay> =
Max116xx10Bit::new(
spi,
DummyPin::new_low(),
RefMode::ExternalSingleEndedNoWakeupDelay,
)?;
Ok(adc)
}
pub fn max11619_internally_clocked<SpiE, SPI>(
spi: SPI,
) -> Result<Max11619InternallyClocked<SPI>, Error<SpiE>>
) -> Result<Max11619InternallyClocked<SPI>, Error<SpiE, Infallible>>
where
SPI: Transfer<u8, Error = SpiE> + FullDuplex<u8, Error = SpiE>,
{
let adc: Max116xx10Bit<
SPI,
DummyPin,
Max11619,
InternallyClockedInternallyTimedSerialInterface,
WithoutWakeupDelay,
> = Max116xx10Bit::new(spi, RefMode::ExternalSingleEndedNoWakeupDelay)?;
> = Max116xx10Bit::new(
spi,
DummyPin::new_low(),
RefMode::ExternalSingleEndedNoWakeupDelay,
)?;
Ok(adc)
}

View File

@ -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::{