Crate sifli_hal

Crate sifli_hal 

Source
Expand description

§SiFli HAL

Crates.io Crates.io docs.rs Support status

中文 | English

Rust Hardware Abstraction Layer (HAL) and Embassy driver for SiFli MCUs.

[!WARNING]

This project is working-in-progress and not ready for production use.

§Let’s GO!

Introduction to Embedded Rust

Get Started

examples

Flash and Debug Guide

§Status

HAL Implementation Status (Click to expand/collapse)
  • ✅: Supported & Tested
  • 🌗: Partially Supported & Tested
  • ❓: Written, needs example/test
  • 📝: Planned & WIP
  • ❌: Not supported by Hardware (N/A)
  • ➕: Async Feature
Peripheral Feature sf32lb52x 56x 58x
hcpu
PAC (Peripheral Access Crate) 🌗
Startup & Interrupt
Flash Table 🌗
embassy GPTIM Time Driver
ATIM Time Driver (#5)
Embassy Peripheral Singleton
RCC Peripheral RCC Codegen (enable, freq...)
Read current RCC tree
RCC tree Configure 🌗
Modify frequency in same DVFS mode
GPIO Blinky
PinMux Codegen & AF Config
IO Mode & AonPE Config 🌗
EXTI ➕
USART Blocking
Buffered(Interrupt) ➕
DMA ➕
RingBuffered(DMA) ➕
DMA Transfer(P2M, M2P)
RingBuffer
ExtDMA
USB
(see also:musb)
embassy-usb
Device: HID, CDC_ACM ...
HOST / OTG
GPADC Blocking
Interrupt ➕
Timer Trigger
VBAT & External Channel
Multi Channel & Slot
Differential Input
DMA ➕
Calibration
PMU DVFS Upscale
DVFS Downscale
Charge Modoule
Buck & LDO 🌗
Audio AudCodec/ADC, DAC
AudPrc/Channel, Mixer, Volume
I2S/DMA, Master, Slave
PDM
I2C
SPI
Mailbox
BT
BLE
LCDC/Layer, SPI, DBI
ePicasso

§Features

  • defmt, log: Debug log output.

  • sf32lb52x: Target chip selection. Currently, only sf32lb52x is supported.

  • set-msplim: Set the MSPLIM register in __pre_init. This register must be set before the main function’s stack setup (since the bootloader may have already configured it to a different value), otherwise, it will cause a HardFault SiFli-SDK #32.

    This feature will be removed after cortex-m-rt #580 is released.

  • time-driver-xxx: Timer configuration for time-driver. It requires at least two capture/compare channels. For the sf32lb52x hcpu, only atim1 (TODO: #5), gptim1, and gptim2 are available.

  • unchecked-overclocking: Enable this feature to disable the overclocking check. DO NOT ENABLE THIS FEATURE UNLESS YOU KNOW WHAT YOU’RE DOING.

§License

This project is under Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0).

Re-exports§

pub use config::Config;

Modules§

adc
ADC (Analog-to-Digital Converter)
config
HAL configuration for SiFli
dma
Direct Memory Access (DMA)
gpio
GPIO driver.
interrupt
Interrupt definitions.
lcdc
mode
Operating modes for peripherals.
peripherals
Types for the peripheral singletons.
pmu
rcc
time
Time units
timer
usart
Universal Synchronous/Asynchronous Receiver Transmitter (USART, UART, LPUART)
usb

Macros§

bind_interrupts
Macro to bind interrupts to handlers.
into_ref
Convenience converting into reference.

Structs§

PeripheralRef
An exclusive reference to a peripheral.
Peripherals
Struct containing all the peripheral singletons.

Traits§

Peripheral
Trait for any type that can be used as a peripheral of type P.

Functions§

blocking_delay_us
Performs a busy-wait delay for a specified number of microseconds.
cortex_m_blocking_delay_us
Performs a busy-wait delay for a specified number of microseconds, using the cortex-m::asm::delay function.
init
Initialize the sifli-hal with the provided configuration.

Attribute Macros§

interrupt