From a1d25eb4d681e88f2e87b19498f70af013d4f4e5 Mon Sep 17 00:00:00 2001 From: Roma Sokolov Date: Wed, 5 Jun 2019 23:31:59 +0200 Subject: [PATCH] Fix deprecation warnings --- src/rcc.rs | 20 ++++++++++---------- src/spi.rs | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/rcc.rs b/src/rcc.rs index 5aee7e8..b75d774 100644 --- a/src/rcc.rs +++ b/src/rcc.rs @@ -259,12 +259,12 @@ impl CFGR { 0 => panic!("Requested HCLK is higher than generated SYSCLK"), 1 => 0b0111, 2 => 0b1000, - 3...5 => 0b1001, - 6...11 => 0b1010, - 12...39 => 0b1011, - 40...95 => 0b1100, - 96...191 => 0b1101, - 192...383 => 0b1110, + 3..=5 => 0b1001, + 6..=11 => 0b1010, + 12..=39 => 0b1011, + 40..=95 => 0b1100, + 96..=191 => 0b1101, + 192..=383 => 0b1110, _ => 0b1111, } }) @@ -280,8 +280,8 @@ impl CFGR { 0 => panic!("Requested PCLK1 is higher than generated HCLK"), 1 => 0b011, 2 => 0b100, - 3...5 => 0b101, - 6...11 => 0b110, + 3..=5 => 0b101, + 6..=11 => 0b110, _ => 0b111, } }) @@ -298,8 +298,8 @@ impl CFGR { 0 => panic!("Requested PCLK2 is higher than generated HCLK"), 1 => 0b011, 2 => 0b100, - 3...5 => 0b101, - 6...11 => 0b110, + 3..=5 => 0b101, + 6..=11 => 0b110, _ => 0b111, } }) diff --git a/src/spi.rs b/src/spi.rs index 6c54e2b..2c75077 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -2,9 +2,9 @@ use core::ptr; +use crate::pac::{RCC, SPI1, SPI2, SPI3}; use hal::spi::{FullDuplex, Mode, Phase, Polarity}; use nb; -use crate::pac::{RCC, SPI1, SPI2, SPI3}; use crate::gpio::{AltFn, PullType, AF5, AF6}; use crate::gpio::{HighSpeed, PinMode, PushPull}; @@ -169,13 +169,13 @@ macro_rules! spi { let br = match clocks.$pclkX().0 / freq.into().0 { 0 => unreachable!(), - 1...2 => 0b000, - 3...5 => 0b001, - 6...11 => 0b010, - 12...23 => 0b011, - 24...39 => 0b100, - 40...95 => 0b101, - 96...191 => 0b110, + 1..=2 => 0b000, + 3..=5 => 0b001, + 6..=11 => 0b010, + 12..=23 => 0b011, + 24..=39 => 0b100, + 40..=95 => 0b101, + 96..=191 => 0b110, _ => 0b111, }; @@ -284,6 +284,8 @@ macro_rules! spi { }; } +//// DEFINE traits for Spi1Sck, Spi1Miso or, even better Sck + spi!(SPI1, apb2enr, apb2rstr,