1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! # msp430-periph
//!
//! Peripheral definition for all MSP430s
//!
//! # Usage
//!
//! Since this crate includes 625 devices and 336 peripherals, everything is feature-gated.
//! That means you have to enable every microcontroller and peripheral you want to use, for example:
//!
//! ```
//! [dependencies.msp430-periph]
//! version = "0.0.3"
//! features = [
//!     # your microcontroller
//!     "msp430fr5969",
//!     # every peripheral you need
//!     "watchdog_timer_2",
//!     "pmm_4",
//!     "portb_3i1",
//!     "portb_3i2",
//! ]
//! ```
//!
//! There is also an `-all` version of microcontroller features to enable all peripherals from this microcontroller:
//!
//! ```
//! [dependencies]
//! msp430-periph = { version = "0.0.3", features = [ "msp430fr5969-all" ] }
//! ```
//!
//! To use with the `msp430-rt` runtime, also enable the `rt` feature. No `memory.x` files are needed.
//!
//! # Documentation
//!
//! It is not reasonable to build documentation for the whole crate with all features enabled. You can either look at the
//! source code or build documentation for the features you use by running `cargo doc --open` in your project directory.
//! To locally build documentation only for this crate, run `cargo doc -p msp430-periph --no-deps --open`

#![no_std]
#![allow(bad_style)]
#![recursion_limit="512"]
#![cfg_attr(feature = "rt", feature(abi_msp430_interrupt))]

pub use utils;

/// All devices
///
/// Each devices needs to be enabled by its feature flag.
/// The feature flag with `-all` appended alse enables all related peripherals
///
/// There is also a `device-all` flag, that you likely shouldn't use
pub mod devices;

/// All peripherals
///
/// Each peripherals needs to be enabled by its feature flag.
/// Peripherals are also enabled by the _`devices`_`-all` feature flag.
///
/// There is also a `periph-all` flag, that you likely shouldn't use
pub mod peripherals;

#[cfg(feature = "rt")]
include!(concat!(env!("OUT_DIR"), "/use_interrupt.rs"));

#[cfg(feature = "rt")]
union Vector {
    _handler: unsafe extern "msp430-interrupt" fn(),
    _reserved: u16,
}