Skip to content

Commit 6eb84f0

Browse files
Merge branch 'master' into subvariants
2 parents 06a3354 + 7c821bb commit 6eb84f0

File tree

12 files changed

+273
-130
lines changed

12 files changed

+273
-130
lines changed

Cargo.toml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,45 @@ description = "Peripheral access API for STM32F3 series microcontrollers"
66
keywords = ["arm", "cortex-m", "stm32f3xx", "hal"]
77
license = "0BSD"
88
name = "stm32f3xx-hal"
9+
readme = "README.md"
910
repository = "https://github.com/stm32-rs/stm32f3xx-hal"
1011
documentation = "https://docs.rs/stm32f3xx-hal"
11-
version = "0.4.1"
12+
version = "0.4.3"
1213

1314
[package.metadata.docs.rs]
1415
features = ["stm32f303xc", "rt", "stm32-usbd"]
15-
default-target = "x86_64-unknown-linux-gnu"
16+
targets = ["thumbv7em-none-eabihf"]
1617

1718
[badges]
1819
travis-ci = { repository = "stm32-rs/stm32f3xx-hal" }
1920

2021
[dependencies]
21-
cortex-m = ">=0.5.8,<0.7"
22-
cortex-m-rt = "0.6.8"
23-
embedded-hal = "0.2.3"
24-
nb = "0.1.2"
25-
stm32f3 = "0.10.0"
22+
cortex-m = "0.6"
23+
cortex-m-rt = "0.6"
24+
embedded-hal = "0.2"
25+
nb = "0.1"
26+
stm32f3 = "0.10"
2627

2728
[dependencies.bare-metal]
28-
version = "0.2.4"
29+
version = "0.2"
2930
features = ["const-fn"]
3031

3132
[dependencies.cast]
3233
default-features = false
33-
version = "0.2.2"
34+
version = "0.2"
3435

3536
[dependencies.void]
3637
default-features = false
37-
version = "1.0.2"
38+
version = "1"
3839

3940
[dependencies.stm32-usbd]
40-
version = "0.5.0"
41+
version = "0.5"
4142
optional = true
4243

4344
[dev-dependencies]
44-
panic-semihosting = "0.5.2"
45-
usb-device = "0.2.3"
46-
usbd-serial = "0.1.0"
45+
panic-semihosting = "0.5"
46+
usb-device = "0.2"
47+
usbd-serial = "0.1"
4748

4849
[features]
4950
default = ["unproven"]

examples/pwm.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![no_std]
44
#![no_main]
55

6-
extern crate panic_semihosting;
6+
use panic_semihosting as _;
77

88
use cortex_m_rt::entry;
99
//use cortex_m_semihosting::hprintln;
@@ -23,7 +23,7 @@ fn main() -> ! {
2323
// Configure our clocks
2424
let mut flash = dp.FLASH.constrain();
2525
let mut rcc = dp.RCC.constrain();
26-
let clocks = rcc.cfgr.freeze(&mut flash.acr);
26+
let clocks = rcc.cfgr.sysclk(16.mhz()).freeze(&mut flash.acr);
2727

2828
// Prep the pins we need in their correct alternate function
2929
let mut gpioa = dp.GPIOA.split(&mut rcc.ahb);
@@ -34,10 +34,8 @@ fn main() -> ! {
3434
let mut gpiob = dp.GPIOB.split(&mut rcc.ahb);
3535
let pb0 = gpiob.pb0.into_af2(&mut gpiob.moder, &mut gpiob.afrl);
3636
let pb1 = gpiob.pb1.into_af2(&mut gpiob.moder, &mut gpiob.afrl);
37-
let pb3 = gpiob.pb3.into_af4(&mut gpiob.moder, &mut gpiob.afrl);
3837
let pb4 = gpiob.pb4.into_af2(&mut gpiob.moder, &mut gpiob.afrl);
3938
let pb5 = gpiob.pb5.into_af2(&mut gpiob.moder, &mut gpiob.afrl);
40-
let pb7 = gpiob.pb7.into_af10(&mut gpiob.moder, &mut gpiob.afrl);
4139
let pb8 = gpiob.pb8.into_af1(&mut gpiob.moder, &mut gpiob.afrh);
4240
let pb10 = gpiob.pb10.into_af1(&mut gpiob.moder, &mut gpiob.afrh);
4341

@@ -77,7 +75,7 @@ fn main() -> ! {
7775
tim3_ch3.set_duty(tim3_ch3.get_max_duty() / 50 * 3); // 6% duty cyle
7876
tim3_ch3.enable();
7977

80-
let mut tim3_ch4 = tim3_channels.3.output_to_pb1(pb1).output_to_pb7(pb7);
78+
let mut tim3_ch4 = tim3_channels.3.output_to_pb1(pb1);
8179
tim3_ch4.set_duty(tim3_ch4.get_max_duty() / 10); // 10% duty cyle
8280
tim3_ch4.enable();
8381

@@ -132,7 +130,7 @@ fn main() -> ! {
132130
&clocks, // To get the timer's clock speed
133131
);
134132

135-
let mut tim8_ch1 = tim8_channels.0.output_to_pb3(pb3).output_to_pc10(pc10);
133+
let mut tim8_ch1 = tim8_channels.0.output_to_pc10(pc10);
136134
tim8_ch1.set_duty(tim8_ch1.get_max_duty() / 10); // 10% duty cyle
137135
tim8_ch1.enable();
138136

examples/spi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![no_std]
44
#![no_main]
55

6-
extern crate panic_semihosting;
6+
use panic_semihosting as _;
77

88
use stm32f3xx_hal as hal;
99

examples/toggle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#![no_main]
77
#![no_std]
88

9-
extern crate panic_semihosting;
9+
use panic_semihosting as _;
1010

1111
use cortex_m_rt::entry;
1212
use stm32f3xx_hal::prelude::*;

examples/usb_serial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![no_std]
44
#![no_main]
55

6-
extern crate panic_semihosting;
6+
use panic_semihosting as _;
77

88
use cortex_m::asm::delay;
99
use cortex_m_rt::entry;

src/gpio.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ gpio!([
892892
AF13: (into_af13, 13, ["stm32f334",],),
893893
AF14: (into_af14, 14, ["stm32f302", "stm32f303xb", "stm32f303xc",],),
894894
]),
895-
PA13: (pa13, 13, Input<Floating>, AFRH, [
895+
PA13: (pa13, 13, AF0, AFRH, [
896896
AF0: (into_af0, 0,),
897897
AF1: (into_af1, 1,),
898898
AF3: (into_af3, 3,),
@@ -904,7 +904,7 @@ gpio!([
904904
AF6: (into_af6, 6, ["stm32f373", "stm32f378", "stm32f398",],),
905905
AF10: (into_af10, 10, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f373", "stm32f378", "stm32f358", "stm32f398",],),
906906
]),
907-
PA14: (pa14, 14, Input<Floating>, AFRH, [
907+
PA14: (pa14, 14, AF0, AFRH, [
908908
AF0: (into_af0, 0,),
909909
AF3: (into_af3, 3,),
910910
AF4: (into_af4, 4,),
@@ -915,7 +915,7 @@ gpio!([
915915
AF7: (into_af7, 7, ["stm32f301", "stm32f318", "stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],),
916916
AF10: (into_af10, 10, ["stm32f373", "stm32f378",],),
917917
]),
918-
PA15: (pa15, 15, Input<Floating>, AFRH, [
918+
PA15: (pa15, 15, AF0, AFRH, [
919919
AF0: (into_af0, 0,),
920920
AF1: (into_af1, 1,),
921921
AF4: (into_af4, 4,),
@@ -977,7 +977,7 @@ gpio!([
977977
AF13: (into_af13, 13, ["stm32f334",],),
978978
AF15: (into_af15, 15, ["stm32f301", "stm32f302", "stm32f303", "stm32f334",],),
979979
]),
980-
PB3: (pb3, 3, Input<Floating>, AFRL, [
980+
PB3: (pb3, 3, AF0, AFRL, [
981981
AF0: (into_af0, 0,),
982982
AF1: (into_af1, 1,),
983983
AF3: (into_af3, 3,),
@@ -993,7 +993,7 @@ gpio!([
993993
AF12: (into_af12, 12, ["stm32f334",],),
994994
AF13: (into_af13, 13, ["stm32f334",],),
995995
]),
996-
PB4: (pb4, 4, Input<Floating>, AFRL, [
996+
PB4: (pb4, 4, AF0, AFRL, [
997997
AF0: (into_af0, 0,),
998998
AF1: (into_af1, 1,),
999999
AF3: (into_af3, 3,),

src/i2c.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ macro_rules! busy_wait {
8888
loop {
8989
let isr = $i2c.isr.read();
9090

91-
if isr.berr().is_error() {
91+
if isr.$flag().$variant() {
92+
break;
93+
} else if isr.berr().is_error() {
9294
return Err(Error::Bus);
9395
} else if isr.arlo().is_lost() {
9496
return Err(Error::Arbitration);
95-
} else if isr.$flag().$variant() {
96-
break;
9797
} else {
9898
// try again
9999
}
@@ -228,7 +228,7 @@ macro_rules! hal {
228228
.start()
229229
.start()
230230
.autoend()
231-
.software()
231+
.automatic()
232232
});
233233

234234
for byte in buffer {
@@ -315,16 +315,16 @@ macro_rules! hal {
315315
});
316316

317317
for byte in bytes {
318-
// Wait until we are allowed to send data (START has been ACKed or last byte
319-
// when through)
318+
// Wait until we are allowed to send data
319+
// (START has been ACKed or last byte went through):
320320
busy_wait!(self.i2c, txis, is_empty);
321321

322-
// put byte on the wire
322+
// put byte into TXDR
323323
// NOTE(write): writes all non-reserved bits.
324324
self.i2c.txdr.write(|w| w.txdata().bits(*byte));
325325
}
326326

327-
// Wait until the last transmission is finished
327+
// Wait until the last byte transmission is finished:
328328
busy_wait!(self.i2c, tc, is_complete);
329329

330330
// reSTART and prepare to receive bytes into `buffer`

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,6 @@ pub mod timer;
142142
)
143143
))]
144144
pub mod usb;
145+
146+
#[cfg(feature = "device-selected")]
147+
pub mod watchdog;

0 commit comments

Comments
 (0)