Crate stm32_hal2[][src]

Modules

API for the ADC (Analog to Digital Converter)

Support for Controller Area Network (CAN) bus. Thinly wraps the bxCAN library. Note that this is currently for bxCAN only; different from the fdCAN used on newer families

This module contains clock configurations for various MCUs. They tend to be significantly different from one another, so we’ve feature-gated these files, rather than code within the files, to differentiate families.

Cyclic Redundancy Check (CRC) support

Support for the digital to Analog converter peripheral.

Direct Memory Access (DMA). This module handles initialization, and transfer configuration for DMA. The Dma::cfg_channel method is called by modules that use DMA.

Read and write onboard flash memory.

This module provides functionality for General Purpose Input and Output (GPIO) pins, including all GPIOx register functions, and interrupts. It includes implementations of embedded-hal pin abstraction.

Inter-Integrated Circuit (I2C) bus. Also supports SMBUS. Implements traits from embedded-hal.

This module contains code used to place the MCU in low power modes. Reference section 5.3.3: Low power modes of the L4 Reference Manual.

In the prelude, we export helper macros.

Interface to the real time clock. For more details, see ST AN4759

Serial Peripheral Interface (SPI) bus. Implements traits from embedded-hal.

Timers. Includes initialization, countdown functionality, interrupts, and PWM features.

Traits used across the library. These may find general use beyond this library, and this module may eventually be moved to a standalone crate.

This module allows for serial communication using the STM32 USART module. Supports Embedded HAL Read and Write traits.

USB support, including for simulated COM ports. This module is a thin wrapper required to work with the stm32_usbd crate. Requires the usb feature. Used on F303, L4x2, L4x3, L5, G0, and G4. F4, L4x5, L4x6 and H7 use USB use the usb_otg module. For G0 series, only available on G0B0, G0B1, G0C1, which the PAC doesn’t yet differentiate.

Macros

Syntax helper for getting global variables of the form Mutex<RefCell<Option>>> from an interrupt-free context - eg in interrupt handlers.

Syntax helper for setting global variables of the form Mutex<RefCell<Option>>>. eg in interrupt handlers. Ideal for non-copy-type variables that can’t be initialized immediatiately.

Syntax helper for setting global variables of the form Mutex<Cell<>>>. eg in interrupt handlers. Ideal for copy-type variables.

Enables and resets peripheral clocks on various RCC registesr. The first argument is a apb1, ahb2 etc to specify the reg block. The second is something like tim1, and the third is a pac::RCC.

Functions

Workaround due to debugger disconnecting in WFI (and low-power) modes. This affects most (all?) STM32 devices. In production on battery-powered devices that don’t use DMA, consider removing this, to prevent power use by the DMA clock. For why we enable the DMA clock, see STM32F446 errata, section 2.1.1.