Crate stm32f3xx_hal[−][src]
Expand description
stm32f3xx-hal
stm32f3xx-hal
contains a multi device hardware abstraction on top of the
peripheral access API for the STMicro STM32F3 series microcontrollers.
Basic Usagee
#![no_std]
#![no_main]
use cortex_m::asm;
use cortex_m_rt::entry;
use panic_halt as _;
use stm32f3xx_hal::{self as hal, pac, prelude::*};
#[entry]
fn main() -> ! {
let dp = pac::Peripherals::take().unwrap();
let mut rcc = dp.RCC.constrain();
let mut gpioe = dp.GPIOE.split(&mut rcc.ahb);
let mut led = gpioe
.pe13
.into_push_pull_output(&mut gpioe.moder, &mut gpioe.otyper);
loop {
led.toggle().unwrap();
asm::delay(8_000_000);
}
}
Cargo features
Target chip selection
This crate requires you to specify your target chip as a feature.
Please select one of the following (x
denotes any character in [a-z]):
- stm32f301x6, stm32f301x8, stm32f318x8
- stm32f302x6, stm32f302x8, stm32f302xb, stm32f302xc, stm32f302xd, stm32f302xe
- stm32f303x6, stm32f303x8, stm32f303xb, stm32f303xc, stm32f303xd, stm32f303xe
- stm32f328x8
- stm32f358xc
- stm32f398xe
- stm32f373x8, stm32f373xb, stm32f373xc, stm32f378xc
- stm32f334x4, stm32f334x6, stm32f334x8
Example: The STM32F3Discovery board has a STM32F303VCT6 chip.
So you need to specify stm32f303xc
in your Cargo.toml
(note that VC → xc).
For more information, see the README.
ld
When this feature is enabled the memory.x
linker script for target chip is automatically
provided by this crate. See cortex-m-rt
document for more info.
rt
This feature enables stm32f3
’s rt
feature. See cortex-m-rt
document for more info.
can
Enable CAN peripherals on supported targets.
The can implementation of the interface is backed by bxcan
usb
Enable USB peripherals on supported targets via the stm32-usbd
crate.
enumset
Enable functions, which leverage enumset
.
This is especially usefull to get all set status events at once,
see for example crate::serial::Serial::triggered_events()
defmt
Currently these are only used for panicking calls, like
assert!
panic!
or unwrap()
. These are enabled using the defmt
filter.
For now defmt is mostly intended for internal development and testing
to further reduce panicking calls in this crate.
The support of this feature is subject to change as the development
of defmt is advancing.
To use this feature follow the Application Setup of the defmt-book
.
Re-exports
Modules
Analog to Digital Converter.
Controller Area Network.
Delays
Direct memory access (DMA) controller.
Flash memory
General Purpose Input / Output
Inter-Integrated Circuit (I2C) bus
Common Interrupt interface defintions shared between peipherals.
Peripheral access
Prelude
Pulse width modulation
Reset and Clock Control
Real Time Clock
Serial
Serial Peripheral Interface (SPI) bus
System configuration controller
Timers
USB peripheral.
Watchdog
Macros
Turns the non-blocking expression $e
into a blocking operation.
Enums
Attribute Macros
Enable use of interrupt macro.