Crate py32f0xx_hal

Crate py32f0xx_hal 

Source
Expand description

§HAL for the py32f0xx family of microcontrollers

This is an implementation of the embedded-hal traits for the py32f0xx family of microcontrollers.

§Usage

This crate supports multiple microcontrollers in the py32f0xx family. Which specific microcontroller you want to build for has to be specified with a feature, for example py32f030.

If no microcontroller is specified, the crate will not compile.

The currently supported variants are

  • py32f002a
  • py32f002b
  • py32f003
  • py32f030

§Commonly used setup

Almost all peripherals require references to some registers in RCC. The following code shows how to set up those registers

// Get access to the device specific peripherals from the peripheral access crate
let mut dp = pac::Peripherals::take().unwrap();

// Freeze the configuration of all the clocks in the system and store the frozen frequencies in
// `clocks`
let clocks = dp.RCC.configure.freeze(&mut dp.FLASH);

§Usage examples

See the examples folder.

Most of the examples require the following additional dependencies

[dependencies]
cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.3"
# Panic behaviour, see https://crates.io/keywords/panic-impl for alternatives
panic-halt = "0.2.0"

Modules§

adc
API for the Analog to Digital converter
dma
API for the Direct Memory Access peripheral
gpio
General Purpose I/Os
i2c
API for the integrated I2C peripheral
pac
Peripheral access API for PY32F030XX microcontrollers (generated using svd2rust v0.28.0 (27eebb4 2022-12-25))
prelude
Collection of traits that should be in scope when using this crate
rcc
System Clocks setup and configuration
rtc
Real time clock
serial
API for the integrated USART ports
spi
API for the integrated SPI peripherals
time
Time units
timer
API for the integrated timers
watchdog
API for the IWDG (Watchdog)