1#![doc = "Peripheral access API for CH32V30X microcontrollers (generated using svd2rust v0.21.0 ( ))\n\nYou can find an overview of the generated API [here].\n\nAPI features to be included in the [next]
2svd2rust release can be generated by cloning the svd2rust [repository], checking out the above commit, and running `cargo doc --open`.\n\n[here]: https://docs.rs/svd2rust/0.21.0/svd2rust/#peripheral-api\n[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased\n[repository]: https://github.com/rust-embedded/svd2rust"]
3#![deny(const_err)]
4#![deny(dead_code)]
5#![deny(improper_ctypes)]
6#![deny(missing_docs)]
7#![deny(no_mangle_generic_items)]
8#![deny(non_shorthand_field_patterns)]
9#![deny(overflowing_literals)]
10#![deny(path_statements)]
11#![deny(patterns_in_fns_without_body)]
12#![deny(private_in_public)]
13#![deny(unconditional_recursion)]
14#![deny(unused_allocation)]
15#![deny(unused_comparisons)]
16#![deny(unused_parens)]
17#![deny(while_true)]
18#![allow(non_camel_case_types)]
19#![allow(non_snake_case)]
20#![no_std]
21use core::marker::PhantomData;
22use core::ops::Deref;
23#[allow(unused_imports)]
24use generic::*;
25#[doc = r"Common register and bit access and modify traits"]
26pub mod generic;
27#[cfg(feature = "rt")]
28extern "C" {}
29#[doc(hidden)]
30pub union Vector {
31 pub _handler: unsafe extern "C" fn(),
32 pub _reserved: usize,
33}
34#[cfg(feature = "rt")]
35#[doc(hidden)]
36#[no_mangle]
37pub static __EXTERNAL_INTERRUPTS: [Vector; 0] = [];
38#[no_mangle]
39static mut DEVICE_PERIPHERALS: bool = false;
40#[doc = r"All the peripherals"]
41#[allow(non_snake_case)]
42pub struct Peripherals {}
43impl Peripherals {
44 #[doc = r"Returns all the peripherals *once*"]
45 #[inline]
46 pub fn take() -> Option<Self> {
47 riscv::interrupt::free(|_| {
48 if unsafe { DEVICE_PERIPHERALS } {
49 None
50 } else {
51 Some(unsafe { Peripherals::steal() })
52 }
53 })
54 }
55 #[doc = r"Unchecked version of `Peripherals::take`"]
56 #[inline]
57 pub unsafe fn steal() -> Self {
58 DEVICE_PERIPHERALS = true;
59 Peripherals {}
60 }
61}