Skip to content

Commit

Permalink
usbfs: add support for the USBFS peripheral
Browse files Browse the repository at this point in the history
Adds support for the USB full speed device peripheral.

Implements the `Device` function using the [usb-device](https://github.com/rust-embedded-community/usb-device) crate.

Creates a new `usbfs` module to allow for adding the `OTG` and `Host`
functions in later work.
  • Loading branch information
rmsyn committed Jun 8, 2023
1 parent d9dd6f1 commit 4e1c110
Show file tree
Hide file tree
Showing 4 changed files with 1,203 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ void = { version = "1.0.2", default-features = false }
cast = { version = "0.2.3", default-features = false }
vcell = "0.1.2"
embedded-dma = "0.1.2"
critical-section = "1.1.0"
usb-device = "0.2.9"

[dependencies.gd32vf103-pac]
version = "0.5.0"
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ pub mod signature;
pub mod spi;
pub mod time;
pub mod timer;
pub mod usbfs;
pub mod watchdog;
16 changes: 16 additions & 0 deletions src/usbfs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! USB full-speed
pub mod device;

/// Settings for port speed.
///
/// In Host mode, either setting is acceptable.
///
/// In Device mode, port speed is fixed to full-speed.
#[repr(u8)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PortSpeed {
FullSpeedHost = 0b01,
LowSpeedHost = 0b10,
FullSpeedDevice = 0b11,
}
Loading

0 comments on commit 4e1c110

Please sign in to comment.