Merge pull request #276 from embassy-rs/deny-warnings
Deny warnings in CI
This commit is contained in:
commit
ed83b93b6d
9
.github/workflows/rust.yml
vendored
9
.github/workflows/rust.yml
vendored
@ -102,8 +102,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: target
|
path: target
|
||||||
key: ${{ runner.os }}-${{ matrix.target }}
|
key: ${{ runner.os }}-${{ matrix.target }}
|
||||||
|
|
||||||
|
# We have to append the "-D warnings" flag to .cargo/config rather than
|
||||||
|
# using the RUSTFLAGS environment variable because if we set RUSTFLAGS
|
||||||
|
# cargo will ignore the rustflags config in .cargo/config.
|
||||||
- name: Check
|
- name: Check
|
||||||
run: cd ${{ matrix.package }} && cargo check --features=${{ matrix.features }} --target=${{ matrix.target }}
|
run: |
|
||||||
|
mkdir -p .cargo
|
||||||
|
echo -e '[target."cfg(all())"]\nrustflags = ["-D", "warnings"]' >> .cargo/config
|
||||||
|
cd ${{ matrix.package }} && RUSTFLAGS=-Dwarnings cargo check --features=${{ matrix.features }} --target=${{ matrix.target }}
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -10,7 +10,7 @@ use embedded_hal::digital::v2::{InputPin, StatefulOutputPin};
|
|||||||
use futures::future::poll_fn;
|
use futures::future::poll_fn;
|
||||||
|
|
||||||
use crate::gpio::sealed::Pin as _;
|
use crate::gpio::sealed::Pin as _;
|
||||||
use crate::gpio::{AnyPin, Input, Output, Pin as GpioPin, Port};
|
use crate::gpio::{AnyPin, Input, Output, Pin as GpioPin};
|
||||||
use crate::pac;
|
use crate::pac;
|
||||||
use crate::ppi::{Event, Task};
|
use crate::ppi::{Event, Task};
|
||||||
use crate::{interrupt, peripherals};
|
use crate::{interrupt, peripherals};
|
||||||
@ -140,8 +140,8 @@ impl<'d, C: Channel, T: GpioPin> InputChannel<'d, C, T> {
|
|||||||
};
|
};
|
||||||
#[cfg(any(feature = "nrf52833", feature = "nrf52840"))]
|
#[cfg(any(feature = "nrf52833", feature = "nrf52840"))]
|
||||||
w.port().bit(match pin.pin.port() {
|
w.port().bit(match pin.pin.port() {
|
||||||
Port::Port0 => false,
|
crate::gpio::Port::Port0 => false,
|
||||||
Port::Port1 => true,
|
crate::gpio::Port::Port1 => true,
|
||||||
});
|
});
|
||||||
unsafe { w.psel().bits(pin.pin.pin()) }
|
unsafe { w.psel().bits(pin.pin.pin()) }
|
||||||
});
|
});
|
||||||
@ -223,8 +223,8 @@ impl<'d, C: Channel, T: GpioPin> OutputChannel<'d, C, T> {
|
|||||||
};
|
};
|
||||||
#[cfg(any(feature = "nrf52833", feature = "nrf52840"))]
|
#[cfg(any(feature = "nrf52833", feature = "nrf52840"))]
|
||||||
w.port().bit(match pin.pin.port() {
|
w.port().bit(match pin.pin.port() {
|
||||||
Port::Port0 => false,
|
crate::gpio::Port::Port0 => false,
|
||||||
Port::Port1 => true,
|
crate::gpio::Port::Port1 => true,
|
||||||
});
|
});
|
||||||
unsafe { w.psel().bits(pin.pin.pin()) }
|
unsafe { w.psel().bits(pin.pin.pin()) }
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use crate::adc::{AdcPin, Instance};
|
use crate::adc::{AdcPin, Instance};
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
use cortex_m::delay::Delay;
|
|
||||||
use embassy::util::Unborrow;
|
use embassy::util::Unborrow;
|
||||||
use embassy_extras::unborrow;
|
use embassy_extras::unborrow;
|
||||||
use embedded_hal::blocking::delay::DelayUs;
|
use embedded_hal::blocking::delay::DelayUs;
|
||||||
@ -123,7 +122,7 @@ pub struct Adc<'d, T: Instance> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: Instance> Adc<'d, T> {
|
impl<'d, T: Instance> Adc<'d, T> {
|
||||||
pub fn new(_peri: impl Unborrow<Target = T> + 'd, mut delay: Delay) -> (Self, Delay) {
|
pub fn new(_peri: impl Unborrow<Target = T> + 'd, delay: &mut impl DelayUs<u32>) -> Self {
|
||||||
unborrow!(_peri);
|
unborrow!(_peri);
|
||||||
unsafe {
|
unsafe {
|
||||||
T::regs().cr().modify(|reg| {
|
T::regs().cr().modify(|reg| {
|
||||||
@ -142,18 +141,15 @@ impl<'d, T: Instance> Adc<'d, T> {
|
|||||||
|
|
||||||
delay.delay_us(1);
|
delay.delay_us(1);
|
||||||
|
|
||||||
(
|
Self {
|
||||||
Self {
|
sample_time: Default::default(),
|
||||||
sample_time: Default::default(),
|
resolution: Resolution::default(),
|
||||||
resolution: Resolution::default(),
|
calibrated_vdda: VDDA_CALIB_MV,
|
||||||
calibrated_vdda: VDDA_CALIB_MV,
|
phantom: PhantomData,
|
||||||
phantom: PhantomData,
|
}
|
||||||
},
|
|
||||||
delay,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn enable_vref(&self, mut delay: Delay) -> (Vref, Delay) {
|
pub fn enable_vref(&self, delay: &mut impl DelayUs<u32>) -> Vref {
|
||||||
unsafe {
|
unsafe {
|
||||||
T::common_regs().ccr().modify(|reg| {
|
T::common_regs().ccr().modify(|reg| {
|
||||||
reg.set_vrefen(true);
|
reg.set_vrefen(true);
|
||||||
@ -166,7 +162,7 @@ impl<'d, T: Instance> Adc<'d, T> {
|
|||||||
//cortex_m::asm::delay(20_000_000);
|
//cortex_m::asm::delay(20_000_000);
|
||||||
delay.delay_us(15);
|
delay.delay_us(15);
|
||||||
|
|
||||||
(Vref {}, delay)
|
Vref {}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn enable_temperature(&self) -> Temperature {
|
pub fn enable_temperature(&self) -> Temperature {
|
||||||
|
@ -16,8 +16,8 @@ use cortex_m_rt::entry;
|
|||||||
use cortex_m::delay::Delay;
|
use cortex_m::delay::Delay;
|
||||||
use embassy_stm32::adc::{Adc, Resolution};
|
use embassy_stm32::adc::{Adc, Resolution};
|
||||||
use stm32l4::stm32l4x5 as pac;
|
use stm32l4::stm32l4x5 as pac;
|
||||||
use stm32l4xx_hal::rcc::PllSource;
|
|
||||||
use stm32l4xx_hal::prelude::*;
|
use stm32l4xx_hal::prelude::*;
|
||||||
|
use stm32l4xx_hal::rcc::PllSource;
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
@ -29,12 +29,11 @@ fn main() -> ! {
|
|||||||
let mut rcc = pp.RCC.constrain();
|
let mut rcc = pp.RCC.constrain();
|
||||||
let mut pwr = pp.PWR.constrain(&mut rcc.apb1r1);
|
let mut pwr = pp.PWR.constrain(&mut rcc.apb1r1);
|
||||||
|
|
||||||
let delay = Delay::new(cp.SYST, 80_000_000);
|
let mut delay = Delay::new(cp.SYST, 80_000_000);
|
||||||
|
|
||||||
// TRY the other clock configuration
|
// TRY the other clock configuration
|
||||||
// let clocks = rcc.cfgr.freeze(&mut flash.acr);
|
// let clocks = rcc.cfgr.freeze(&mut flash.acr);
|
||||||
rcc
|
rcc.cfgr
|
||||||
.cfgr
|
|
||||||
.sysclk(80.mhz())
|
.sysclk(80.mhz())
|
||||||
.pclk1(80.mhz())
|
.pclk1(80.mhz())
|
||||||
.pclk2(80.mhz())
|
.pclk2(80.mhz())
|
||||||
@ -69,7 +68,7 @@ fn main() -> ! {
|
|||||||
|
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
|
|
||||||
let (mut adc, _) = Adc::new(p.ADC1, delay);
|
let mut adc = Adc::new(p.ADC1, &mut delay);
|
||||||
//adc.enable_vref();
|
//adc.enable_vref();
|
||||||
adc.set_resolution(Resolution::EightBit);
|
adc.set_resolution(Resolution::EightBit);
|
||||||
let mut channel = p.PC0;
|
let mut channel = p.PC0;
|
||||||
|
Loading…
Reference in New Issue
Block a user