Skip to content

Commit 0290224

Browse files
authored
Merge pull request #68 from stm32-rs/revert-gpio-fix-travis-bump-stm32
Fix and bump build. Fix travis too.
2 parents cd4de91 + 12f76a1 commit 0290224

File tree

8 files changed

+54
-59
lines changed

8 files changed

+54
-59
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ matrix:
1515
fast_finish: true
1616

1717
install:
18-
- rustup target add thumbv7em-none-eabihf
18+
- rustup target add thumbv7em-none-eabi
1919

2020
script: tools/check.py $COMMAND

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ edition = "2018"
2323
[dependencies]
2424
cortex-m = "0.5.8"
2525
nb = "0.1.1"
26-
stm32l4 = "0.7.0"
26+
stm32l4 = "0.8.0"
2727
as-slice = "0.1"
2828

2929
[dependencies.cast]

src/gpio.rs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -553,41 +553,3 @@ gpio!(GPIOC, gpioc, gpioc, gpiocen, gpiocrst, PCx, [
553553
PC14: (pc14, 14, Input<Floating>, AFRH),
554554
PC15: (pc15, 15, Input<Floating>, AFRH),
555555
]);
556-
557-
gpio!(GPIOD, gpiod, gpiod, gpioden, gpiodrst, PDx, [
558-
PD0: (pd0, 0, Input<Floating>, AFRL),
559-
PD1: (pd1, 1, Input<Floating>, AFRL),
560-
PD2: (pd2, 2, Input<Floating>, AFRL),
561-
PD3: (pd3, 3, Input<Floating>, AFRL),
562-
PD4: (pd4, 4, Input<Floating>, AFRL),
563-
PD5: (pd5, 5, Input<Floating>, AFRL),
564-
PD6: (pd6, 6, Input<Floating>, AFRL),
565-
PD7: (pd7, 7, Input<Floating>, AFRL),
566-
PD8: (pd8, 8, Input<Floating>, AFRH),
567-
PD9: (pd9, 9, Input<Floating>, AFRH),
568-
PD10: (pd10, 10, Input<Floating>, AFRH),
569-
PD11: (pd11, 11, Input<Floating>, AFRH),
570-
PD12: (pd12, 12, Input<Floating>, AFRH),
571-
PD13: (pd13, 13, Input<Floating>, AFRH),
572-
PD14: (pd14, 14, Input<Floating>, AFRH),
573-
PD15: (pd15, 15, Input<Floating>, AFRH),
574-
]);
575-
576-
gpio!(GPIOE, gpioe, gpioe, gpioeen, gpioerst, PEx, [
577-
PE0: (pe0, 0, Input<Floating>, AFRL),
578-
PE1: (pe1, 1, Input<Floating>, AFRL),
579-
PE2: (pe2, 2, Input<Floating>, AFRL),
580-
PE3: (pe3, 3, Input<Floating>, AFRL),
581-
PE4: (pe4, 4, Input<Floating>, AFRL),
582-
PE5: (pe5, 5, Input<Floating>, AFRL),
583-
PE6: (pe6, 6, Input<Floating>, AFRL),
584-
PE7: (pe7, 7, Input<Floating>, AFRL),
585-
PE8: (pe8, 8, Input<Floating>, AFRH),
586-
PE9: (pe9, 9, Input<Floating>, AFRH),
587-
PE10: (pe10, 10, Input<Floating>, AFRH),
588-
PE11: (pe11, 11, Input<Floating>, AFRH),
589-
PE12: (pe12, 12, Input<Floating>, AFRH),
590-
PE13: (pe13, 13, Input<Floating>, AFRH),
591-
PE14: (pe14, 14, Input<Floating>, AFRH),
592-
PE15: (pe15, 15, Input<Floating>, AFRH),
593-
]);

src/pwm.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,35 +141,31 @@ macro_rules! hal {
141141
apb.rstr().modify(|_, w| w.$timXrst().clear_bit());
142142

143143
if PINS::C1 {
144-
tim.ccmr1_output
145-
.modify(|_, w| unsafe { w.oc1pe().set_bit().oc1m().bits(6) });
144+
tim.ccmr1_output().modify(|_, w| unsafe { w.oc1pe().set_bit().oc1m().bits(6) });
146145
}
147146

148147
if PINS::C2 {
149-
tim.ccmr1_output
150-
.modify(|_, w| unsafe { w.oc2pe().set_bit().oc2m().bits(6) });
148+
tim.ccmr1_output().modify(|_, w| unsafe { w.oc2pe().set_bit().oc2m().bits(6) });
151149
}
152150

153151
if PINS::C3 {
154-
tim.ccmr2_output
155-
.modify(|_, w| unsafe { w.oc3pe().set_bit().oc3m().bits(6) });
152+
tim.ccmr2_output().modify(|_, w| unsafe { w.oc3pe().set_bit().oc3m().bits(6) });
156153
}
157154

158155
if PINS::C4 {
159-
tim.ccmr2_output
160-
.modify(|_, w| unsafe { w.oc4pe().set_bit().oc4m().bits(6) });
156+
tim.ccmr2_output().modify(|_, w| unsafe { w.oc4pe().set_bit().oc4m().bits(6) });
161157
}
162158
let clk = clocks.pclk1().0;
163159
let freq = freq.0;
164160
let ticks = clk / freq;
165161

166162
// maybe this is all u32? also, why no `- 1` vs `timer.rs`?
167163
let psc = u16(ticks / (1 << 16)).unwrap();
168-
tim.psc.write(|w| unsafe { w.psc().bits(psc) });
164+
tim.psc.write(|w| { w.psc().bits(psc) });
169165
let arr = u16(ticks / u32(psc + 1)).unwrap();
170166
tim.arr.write(|w| { w.arr().bits(u32(arr)) });
171167

172-
tim.cr1.write(|w| unsafe {
168+
tim.cr1.write(|w| {
173169
w.cms()
174170
.bits(0b00)
175171
.dir().clear_bit()

src/rtc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ fn byte_to_bcd2(byte: u8) -> (u8, u8){
213213
(bcd_high, ((bcd_high << 4) | value) as u8)
214214
}
215215

216-
fn bcd2_to_byte(bcd: (u8, u8)) -> u8 { // TODO fix this
216+
fn bcd2_to_byte(bcd: (u8, u8)) -> u8 {
217217
let value = bcd.1 | bcd.0 << 4;
218218

219219
let tmp = ((value & 0xF0) >> 0x4) * 10;

src/serial.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use crate::stm32::{USART1, USART2};
1515
use void::Void;
1616

1717
use crate::gpio::gpioa::{PA10, PA2, PA3, PA9};
18-
use crate::gpio::gpiod::{PD5, PD6};
1918
use crate::gpio::gpiob::{PB6, PB7};
2019
use crate::gpio::{AF7, Alternate, Input, Floating};
2120
use crate::rcc::{APB1R1, APB2, Clocks};
@@ -63,10 +62,6 @@ impl Pins<USART2> for (PA2<Alternate<AF7, Input<Floating>>>, PA3<Alternate<AF7,
6362
const REMAP: u8 = 0;
6463
}
6564

66-
impl Pins<USART2> for (PD5<Alternate<AF7, Input<Floating>>>, PD6<Alternate<AF7, Input<Floating>>>) {
67-
const REMAP: u8 = 0;
68-
}
69-
7065

7166
/// Serial abstraction
7267
pub struct Serial<USART, PINS> {

src/spi.rs

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use core::ptr;
44

55
use crate::hal::spi::{FullDuplex, Mode, Phase, Polarity};
66
use nb;
7-
use crate::stm32::{SPI1, /* TODO SPI2, */ SPI3};
87

98
use crate::gpio::gpioa::{PA5, PA6, PA7};
109
use crate::gpio::{AF5, Input, Floating, Alternate};
@@ -178,8 +177,50 @@ macro_rules! hal {
178177
}
179178
}
180179

180+
181+
use crate::stm32::SPI1;
182+
#[cfg(any(
183+
feature = "stm32l4x1",
184+
feature = "stm32l4x2",
185+
feature = "stm32l4x3",
186+
feature = "stm32l4x5",
187+
feature = "stm32l4x6"
188+
))]
181189
hal! {
182190
SPI1: (spi1, APB2, spi1en, spi1rst, pclk2),
183-
// SPI2: (spi2, APB1R1, spi2en, spi2rst, pclk1), // NOT Avail on 32k(b|c)
191+
}
192+
193+
194+
#[cfg(any(
195+
feature = "stm32l4x1",
196+
feature = "stm32l4x2",
197+
feature = "stm32l4x5",
198+
feature = "stm32l4x6",
199+
))]
200+
use crate::stm32::SPI3;
201+
202+
#[cfg(any(
203+
feature = "stm32l4x1",
204+
feature = "stm32l4x2",
205+
feature = "stm32l4x5",
206+
feature = "stm32l4x6",
207+
))]
208+
hal! {
184209
SPI3: (spi3, APB1R1, spi3en, spi3rst, pclk1),
185210
}
211+
212+
#[cfg(any(
213+
feature = "stm32l4x3",
214+
feature = "stm32l4x5",
215+
feature = "stm32l4x6",
216+
))]
217+
use crate::stm32::SPI2;
218+
219+
#[cfg(any(
220+
feature = "stm32l4x3",
221+
feature = "stm32l4x5",
222+
feature = "stm32l4x6",
223+
))]
224+
hal! {
225+
SPI2: (spi2, APB1R1, spi2en, spi2rst, pclk1),
226+
}

tools/check.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def main():
3030

3131
features = ["{},rt".format(x)
3232
for x in crate_info["features"].keys()
33-
if x != "rt"]
33+
if x != "rt"
34+
if x != "unproven"]
3435

3536
if 'size_check' in sys.argv:
3637
cargo_cmd = ['cargo', 'build', '--release']

0 commit comments

Comments
 (0)