Expand description
Hardware abstraction layer for the GD32E23x series (Cortex-M23), built on top
of the gd32e2 peripheral access crate.
Only the GD32E230 is implemented so far; the crate is named for the family it
is meant to grow into.
The API leans on the type system: a method that makes no sense for the hardware fails to compile.
§Chip variants
One feature names the part being built for, and exactly one must be enabled.
A feature is the part number with an x in each field the code cannot see, so
gd32e230g8xx is every G8 part: the letter is the bonded pin count (F 20, E 24,
G 28, K 32, C 48), the digit the flash code (4 = 16K flash and 4K SRAM, 6 = 32K
and 6K, 8 = 64K and 8K), and the last x the temperature grade. Only the 32-pin
parts spell their package out — a QFN32 (gd32e230k8ux) carries VSS on its
thermal pad and gives the two freed pins to PB2 and PB8, an LQFP32
(gd32e230k8tx) does not.
§Getting started
Clocks come first: freezing the tree is what produces the Rcu
every other module takes, and it enables each peripheral’s clock as that
peripheral is constructed.
let dp = pac::Peripherals::take().unwrap();
let mut fmc = dp.fmc.constrain();
let config = ClockConfig::default().sysclk(SysClk::Pll(PllFreq::Mhz48));
let mut rcu = dp.rcu.constrain().freeze(&mut fmc, config);
let parts = dp.gpioa.split(&mut rcu);
let mut led = parts.pa5.into_output();
led.set_high().unwrap();Re-exports§
pub use gd32e2::gd32e230 as pac;
Modules§
- adc
- 12-bit analog-to-digital converter.
- cmp
- Analog comparator.
- crc
- Hardware CRC calculation unit.
- dma
- Direct memory access: five independent channels moving data without the core.
- exti
- External interrupts and events.
- fmc
- Flash memory controller.
- gpio
- General-purpose I/O.
- i2c
- I²C master.
- prelude
- One import for the traits whose methods this HAL is used through.
- rcu
- Reset and clock unit: the system clock tree and per-peripheral clock gating.
- spi
- SPI master.
- syscfg
- System configuration: the registers that wire peripherals to each other rather than to the outside world.
- time
- Typed units for frequencies and durations, aliased from
fugit. - timer
- Timers: the counter core shared by every TIMER peripheral.
- usart
- Asynchronous serial (USART), blocking and non-blocking.
- watchdog
- The chip’s two watchdogs.