[package] edition = "2021" rust-version = "1.62" authors = ["Daniel Egger "] categories = ["embedded", "hardware-support", "no-std"] description = "Peripheral access API for STM32F4 series microcontrollers" documentation = "https://docs.rs/stm32f4xx-hal" keywords = ["arm", "cortex-m", "stm32f4xx", "hal"] license = "0BSD" name = "stm32f4xx-hal" readme = "README.md" repository = "https://github.com/stm32-rs/stm32f4xx-hal" version = "0.22.1" [package.metadata.docs.rs] features = [ "stm32f429", "usb_fs", "can", "i2s", "fsmc_lcd", "rtic1", "defmt", "sdio-host", ] targets = ["thumbv7em-none-eabihf"] [dependencies] defmt = { version = "0.3.5", optional = true } bxcan = { version = "0.7", optional = true } cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] } cortex-m-rt = "0.7.3" nb = "1.1" rand_core = "0.6.4" synopsys-usb-otg = { version = "0.4.0", features = [ "cortex-m", ], optional = true } sdio-host = { version = "0.9.0", optional = true } embedded-dma = "0.2.0" embedded-display-controller = { version = "^0.2.0", optional = true } bare-metal = { version = "1" } void = { default-features = false, version = "1.0.2" } display-interface = { version = "0.5.0", optional = true } display-interface-04 = { package = "display-interface", version = "0.4.1", optional = true } fugit = "0.3.7" fugit-timer = "0.1.3" # rtic1 rtic-monotonic = { version = "1.0", optional = true } systick-monotonic = { version = "1.0.1", optional = true } cortex-m-rtic = { version = "1.1.4", features = [ "test-critical-section", ], optional = true } # rtic2 rtic-time = { version = "2.0", optional = true } embedded-hal-async = { version = "1.0", optional = true } rtic = { version = "2.0.1", features = ["thumbv7-backend"], optional = true } atomic-polyfill = { version = "1.0.3", optional = true } stm32-fmc = { version = "0.3.2", optional = true } enumflags2 = "0.7.8" embedded-storage = "0.3" document-features = "0.2" micromath = { version = "2.1.0", optional = true } [dependencies.stm32f4] package = "stm32f4-staging" version = "0.16.1" features = ["atomics"] [dependencies.time] version = "0.3.14" default-features = false [dependencies.embedded-hal-02] package = "embedded-hal" version = "0.2.7" features = ["unproven"] [dependencies.embedded-hal] version = "1.0" [dependencies.embedded-hal-nb] version = "1.0" [dependencies.embedded-io] version = "0.6.1" [dependencies.stm32_i2s_v12x] version = "0.5.0" optional = true [dev-dependencies] defmt = "0.3.4" defmt-rtt = "0.4.0" panic-probe = { version = "0.3.0", features = ["print-defmt"] } panic-semihosting = "0.6.0" cortex-m-semihosting = "0.5.0" heapless = "0.8" panic-halt = "0.2.0" ssd1306 = "0.8.4" embedded-graphics = "0.8.1" embedded-graphics-07 = { package = "embedded-graphics", version = "0.7.1" } usb-device = "0.3.1" usbd-serial = "0.2.0" micromath = "2" dwt-systick-monotonic = "1.1" st7789 = "0.7.0" rtt-target = { version = "0.5.0" } display-interface-spi = "0.4.1" ist7920 = "0.1.1" smart-leds = "0.3.0" ws2812-spi = { version = "0.4.0", features = [] } hd44780-driver = "0.4.0" display-interface = "0.5" display-interface-04 = { package = "display-interface", version = "0.4.1" } ft6x06 = "0.1.2" otm8009a = "0.1" ushell = "0.3.5" [dev-dependencies.time] version = "0.3" default-features = false features = ["macros"] [features] #! Use one of the supported STM32-serie related features: #! `stm32f401`, `stm32f405`, `stm32f407`, `stm32f415`, `stm32f417`, `stm32f410`, #! `stm32f411`, `stm32f412`, `stm32f413`, `stm32f423`, `stm32f427`, `stm32f429`, #! `stm32f437`, `stm32f439`, `stm32f446`, `stm32f469`, `stm32f479`. # Note: stm32f4 has only one feature for some very similar device families, # so it's intended for e.g. stm32f405/415 to both enable stm32f4/stm32f405. stm32f401 = ["stm32f4/stm32f401", "gpio-f401"] stm32f405 = ["stm32f4/stm32f405", "gpio-f417"] stm32f407 = ["stm32f4/stm32f407", "gpio-f417"] stm32f415 = ["stm32f4/stm32f405", "gpio-f417", "cryp"] stm32f417 = ["stm32f4/stm32f407", "gpio-f417", "cryp"] stm32f410 = ["stm32f4/stm32f410", "gpio-f410"] stm32f411 = ["stm32f4/stm32f411", "gpio-f411"] stm32f412 = ["stm32f4/stm32f412", "gpio-f412"] stm32f413 = ["stm32f4/stm32f413", "gpio-f413"] stm32f423 = ["stm32f4/stm32f413", "gpio-f413", "aes"] stm32f427 = ["stm32f4/stm32f427", "gpio-f427", "fsmc"] stm32f429 = ["stm32f4/stm32f429", "gpio-f427", "fmc"] stm32f437 = ["stm32f4/stm32f427", "gpio-f427", "fsmc", "cryp"] stm32f439 = ["stm32f4/stm32f429", "gpio-f427", "fmc", "cryp"] stm32f446 = ["stm32f4/stm32f446", "gpio-f446"] stm32f469 = ["stm32f4/stm32f469", "gpio-f469"] stm32f479 = ["stm32f4/stm32f469", "gpio-f469", "cryp"] gpio-f401 = [ "gpiod", "gpioe", "i2c3", "otg-fs", "sdio", "spi3", "spi4", "tim1", "tim2", "tim3", "tim4", "tim5", "tim9", "tim10", "tim11", "rcc_shared_m" ] gpio-f410 = [ "dac", "fmpi2c1", "lptim1", "spi5", "tim1", "tim5", "tim6", "tim9", "tim11", ] gpio-f411 = [ "gpiod", "gpioe", # "gpioi", "i2c3", "otg-fs", "sdio", "tim1", "tim2", "tim3", "tim4", "tim5", "tim9", "tim10", "tim11", "spi3", "spi4", "spi5", ] gpio-f412 = [ "gpiod", "gpioe", "gpiof", "gpiog", "can1", "can2", "dfsdm1", "fmpi2c1", "fsmc", "i2c3", "quadspi", "otg-fs", "rng", "sdio", "spi3", "spi4", "spi5", "tim1", "tim2", "tim3", "tim4", "tim5", "tim6", "tim7", "tim8", "tim9", "tim10", "tim11", "tim12", "tim13", "tim14", "usart3", "rcc_i2s_apb", ] gpio-f413 = [ "gpiod", "gpioe", "gpiof", "gpiog", "can1", "can2", "can3", "dac", "dfsdm1", "dfsdm2", "fsmc", "fmpi2c1", "i2c3", "lptim1", "quadspi", "otg-fs", "rng", "sai1", "sdio", "spi3", "spi4", "spi5", "tim1", "tim2", "tim3", "tim4", "tim5", "tim6", "tim7", "tim8", "tim9", "tim10", "tim11", "tim12", "tim13", "tim14", "usart3", "uart4", "uart5", "uart7", "uart8", "uart9", "uart10", "rcc_i2s_apb", ] gpio-f417 = [ "gpiod", "gpioe", "gpiof", "gpiog", "gpioi", "adc2", "adc3", "can1", "can2", "dac", "dcmi", "eth", "fsmc", "i2c3", "otg-fs", "otg-hs", "rng", "sdio", "spi3", "tim1", "tim2", "tim3", "tim4", "tim5", "tim6", "tim7", "tim8", "tim9", "tim10", "tim11", "tim12", "tim13", "tim14", "usart3", "uart4", "uart5", "rcc_shared_m" ] gpio-f427 = [ "gpiod", "gpioe", "gpiof", "gpiog", "gpioi", "gpioj", "gpiok", "adc2", "adc3", "can1", "can2", "dac", "dcmi", "dma2d", "eth", "i2c3", "ltdc", "otg-fs", "otg-hs", "rng", "sai1", "sdio", "spi3", "spi4", "spi5", "spi6", "tim1", "tim2", "tim3", "tim4", "tim5", "tim6", "tim7", "tim8", "tim9", "tim10", "tim11", "tim12", "tim13", "tim14", "usart3", "uart4", "uart5", "uart7", "uart8", "rcc_shared_m" ] gpio-f446 = [ "gpiod", "gpioe", "gpiof", "gpiog", "adc2", "adc3", "can1", "can2", "dac", "dcmi", "fmpi2c1", "fmc", "i2c3", "quadspi", "otg-fs", "otg-hs", "sai1", "sai2", "sdio", "spi3", "spi4", "spdifrx", "tim1", "tim2", "tim3", "tim4", "tim5", "tim6", "tim7", "tim8", "tim9", "tim10", "tim11", "tim12", "tim13", "tim14", "usart3", "uart4", "uart5", "rcc_i2s_apb", ] gpio-f469 = [ "gpiod", "gpioe", "gpiof", "gpiog", "gpioi", "gpioj", "gpiok", "adc2", "adc3", "can1", "can2", "dac", "dma2d", "dcmi", "dsihost", "eth", "fmc", "i2c3", "ltdc", "quadspi", "otg-fs", "otg-hs", "rng", "sai1", "sdio", "spi3", "spi4", "spi5", "spi6", "tim1", "tim2", "tim3", "tim4", "tim5", "tim6", "tim7", "tim8", "tim9", "tim10", "tim11", "tim12", "tim13", "tim14", "usart3", "uart4", "uart5", "uart7", "uart8", "rcc_shared_m" ] ## Support monotonic timers and other stuff that can be used by [RTICv1 framework](https://crates.io/crates/cortex-m-rtic) rtic1 = ["dep:rtic-monotonic", "dep:systick-monotonic", "cortex-m-rtic"] ## Support monotonic timers and other stuff that can be used by [RTICv2 framework](https://crates.io/crates/rtic) ## ## Requires nightly rust compiler rtic2 = [ "dep:rtic-time", "dep:rtic", "dep:atomic-polyfill", "dep:embedded-hal-async", ] rtic-tim2 = [] rtic-tim3 = [] rtic-tim4 = [] rtic-tim5 = [] ## Implementation of `defmt::Format` for public enums and structures. See [defmt](https://crates.io/crates/defmt) defmt = ["dep:defmt", "stm32f4/defmt", "fugit/defmt", "nb/defmt-0-3"] ## bxCAN peripheral support. See [bxcan](https://crates.io/crates/bxcan) can = ["dep:bxcan"] ## I2S peripheral support. See [stm32_i2s_v12x](https://crates.io/crates/stm32_i2s_v12x) i2s = ["dep:stm32_i2s_v12x"] ## USB OTG-FS peripheral support. See [synopsys-usb-otg](https://crates.io/crates/synopsys-usb-otg) usb_fs = ["dep:synopsys-usb-otg", "synopsys-usb-otg/fs"] ## USB OTG-HS peripheral support. See [synopsys-usb-otg](https://crates.io/crates/synopsys-usb-otg) usb_hs = ["dep:synopsys-usb-otg", "synopsys-usb-otg/hs"] ## LCD support via FMC/FSMC peripheral. See [display-interface](https://crates.io/crates/display-interface) fsmc_lcd = ["dep:display-interface", "dep:display-interface-04"] ## SDIO peripheral support. See [sdio-host](https://crates.io/crates/sdio-host) sdio-host = ["dep:sdio-host"] # Next features are for internal use only!!! dfsdm = [] sai = [] rcc_shared_m = [] rcc_i2s_apb = [] adc2 = [] adc3 = [] aes = [] can1 = [] can2 = [] can3 = [] cryp = [] dac = [] dcmi = [] dfsdm1 = ["dfsdm"] dfsdm2 = ["dfsdm"] dma2d = [] dsihost = ["embedded-display-controller"] eth = [] fmc = [] fsmc = [] fmpi2c1 = [] gpiod = [] gpioe = [] gpiof = [] gpiog = [] gpioi = [] gpioj = [] gpiok = [] i2c3 = [] lptim1 = [] ltdc = ["dep:micromath"] quadspi = [] otg-fs = [] otg-hs = [] rng = [] sai1 = ["sai"] sai2 = ["sai"] sdio = [] spi3 = [] spi4 = [] spi5 = [] spi6 = [] spdifrx = [] tim1 = [] tim2 = [] tim3 = [] tim4 = [] tim5 = [] tim6 = [] tim7 = [] tim8 = [] tim9 = [] tim10 = [] tim11 = [] tim12 = [] tim13 = [] tim14 = [] usart3 = [] uart4 = [] uart5 = [] uart7 = [] uart8 = [] uart9 = [] uart10 = [] [profile.dev] debug = true lto = true [profile.release] debug = true lto = true opt-level = "s" # Keep examples sorted [[example]] name = "analog-stopwatch-with-spi-ssd1306" required-features = ["spi4", "tim2", "gpioe", "gpiog"] # stm32f429 [[example]] name = "blinky-timer-irq" required-features = ["tim2"] # stm32f411 [[example]] name = "can-send" required-features = ["can", "stm32f405"] [[example]] name = "delay-syst-blinky" required-features = [] # stm32f411 [[example]] name = "delay-timer-blinky" required-features = [] # stm32f411 [[example]] name = "display-touch" required-features = ["fsmc_lcd", "stm32f412"] #or stm32f413 [[example]] name = "dwt-blinky" required-features = ["gpiog"] # "stm32f429" [[example]] name = "dynamic-gpio" required-features = [] [[example]] name = "f413disco-lcd-ferris" required-features = [ "gpiod", "gpioe", "gpiof", "gpiog", "fsmc", "fsmc_lcd", ] # stm32f413 [[example]] name = "f469disco-lcd-test" required-features = ["stm32f469", "defmt"] [[example]] name = "hd44780" required-features = [] [[example]] name = "i2s-audio-out" required-features = ["stm32f411", "i2s"] [[example]] name = "ist7920-bidi-normal-spi" required-features = [] [[example]] name = "pwm" required-features = [] [[example]] name = "pwm-input" required-features = ["tim8"] # stm32f446 [[example]] name = "pwm-sinus" required-features = ["stm32f411"] [[example]] name = "qei" required-features = ["tim2"] # stm32f411 [[example]] name = "qspi-w25q" required-features = ["stm32f412"] [[example]] name = "rng-display" required-features = ["rng"] # stm32f407 [[example]] name = "rtc" required-features = [] [[example]] name = "rtc_alarm" required-features = ["stm32f411"] [[example]] name = "rtic-adc-dma" required-features = ["rtic1"] # stm32f401 [[example]] name = "rtic-button" required-features = ["stm32f411", "rtic1"] # stm32f411 [[example]] name = "rtic-i2s-audio-in-out" required-features = ["stm32f411", "i2s", "rtic1"] [[example]] name = "rtic-dual-i2s-audio-in-out" required-features = ["stm32f411", "i2s", "rtic1"] [[example]] name = "rtic-serial-dma-rx-idle" required-features = ["stm32f411", "rtic1"] [[example]] name = "rtic-spi-slave-dma" required-features = ["stm32f411", "rtic1"] [[example]] name = "rtic-tick" required-features = ["tim2", "rtic1"] [[example]] name = "rtic2-tick" required-features = ["rtic2", "rtic-tim3"] [[example]] name = "rtic-usart-shell" required-features = ["stm32f411", "rtic1"] # stm32f411 [[example]] name = "rtic-usart-shell-ssd1306" required-features = ["stm32f411", "rtic1"] # stm32f411 [[example]] name = "rtic-usb-cdc-echo" required-features = ["stm32f411", "rtic1", "otg-fs", "usb_fs"] # stm32f411 [[example]] name = "sai-duplex" required-features = ["stm32f429"] [[example]] name = "sd" required-features = ["gpiod", "sdio", "sdio-host"] # stm32f405 [[example]] name = "serial" required-features = [] [[example]] name = "serial-9bit" required-features = ["gpiod"] # stm32f411 [[example]] name = "serial-dma" required-features = ["stm32f407"] [[example]] name = "spi-dma" required-features = ["stm32f411"] [[example]] name = "uart-dma" required-features = ["stm32f405"] [[example]] name = "ssd1306-image" required-features = [] # stm32f411 [[example]] name = "st7789-lcd" required-features = ["fsmc", "fsmc_lcd"] # stm32f412 [[example]] name = "stopwatch-with-ssd1306-and-interrupts" required-features = ["tim2"] # stm32f411 [[example]] name = "stopwatch-with-ssd1306-and-interrupts-and-dma-i2c" required-features = ["tim2", "stm32f411"] # stm32f411 [[example]] name = "ltdc-screen" required-features = ["stm32f429"] [[example]] name = "timer-periph" required-features = [] [[example]] name = "timer-syst" required-features = [] [[example]] name = "usb-serial-irq" required-features = ["otg-fs", "usb_fs"] # stm32f407 [[example]] name = "usb-serial-poll" required-features = ["otg-fs", "usb_fs"] # stm32f401 [[example]] name = "ws2812-spi" required-features = [] [[example]] name = "fmc-sdram" required-features = ["stm32f469", "stm32-fmc"]