msp430_hal/lib.rs
1//! A collection of peripheral drivers for the MSP430 family of microcontrollers (primarily the [MSP430FR2xxx/4xxx](http://www.ti.com/lit/ug/slau445i/slau445i.pdf)) with implementations of [`embedded_hal`] traits.
2//!
3//! The documentation on docs.rs is built for the MSP430FR2355. To build the documentation for your device
4//! add this crate as a dependency to your project (see: [Feature Flags](#feature-flags)) then run `cargo doc --open --package msp430-hal`.
5//! The github repository contains such projects for various devices under `device_examples/`.
6//!
7//! [`embedded_hal`]: https://github.com/rust-embedded/embedded-hal
8//!
9//! # Usage
10//!
11//! Requires `msp430-elf-gcc` installed and in $PATH to build
12//!
13//! When using this crate as a dependency, make sure you include the appropriate `memory.x` file for
14//! your microcontroller.
15//!
16//! # Examples
17//!
18//! The `device-examples/` directory in the repository contains projects for various supported devices, each containing a typical
19//! project structure and a number of examples that show how to use the HAL abstractions. These examples typically target the relevant dev board,
20//! such as the MSP-EXP430FR2355 for the MSP430FR2355.
21//!
22//! To flash the examples, make sure you have `mspdebug` with `tilib` support installed and in
23//! $PATH. Invoke `cargo run --example whatever` from within the relevant project folder with the board plugged and the scripts should do
24//! the trick, assuming your host is Linux and you are connected via Launchpad.
25//!
26//! # Feature Flags
27//!
28//! Exactly one device feature must be enabled to specify which microcontroller is present.
29//! More info can be found in the repository README.
30//!
31//! An implementation of the pre-1.0 version of embedded-hal (e.g. 0.2.7 at time of writing) is
32//! available behind the `embedded-hal-02` feature flag. These traits are implemented on the same
33//! structs as the current embedded-hal implementation, so with this feature enabled you may mix and
34//! match crates that require the pre-1.0 version with those that require the latest version. It isn't enabled by
35//! default, as many of the trait names are similar (or identical) to their counterparts in the current
36//! version, which can be confusing.
37//!
38//! Support for defmt is available behind the `defmt` feature.
39
40#![no_std]
41#![allow(incomplete_features)] // Enable specialization without warnings
42#![feature(specialization)]
43#![feature(asm_experimental_arch)]
44#![allow(stable_features)] // Feature flags used on older compiler versions
45#![feature(const_option)]
46#![deny(missing_docs)]
47
48pub mod bak_mem;
49pub mod batch_gpio;
50pub mod capture;
51pub mod clock;
52pub mod crc;
53pub mod delay;
54pub mod fram;
55pub mod gpio;
56pub mod lpm;
57pub mod pin_mapping;
58pub mod pmm;
59pub mod prelude;
60pub mod pwm;
61pub mod rtc;
62pub mod serial;
63pub mod spi;
64pub mod timer;
65pub mod watchdog;
66
67#[cfg(feature = "adc")]
68pub mod adc;
69
70#[cfg(feature = "ecomp")]
71pub mod ecomp;
72
73#[cfg(feature = "eusci_b")]
74pub mod i2c;
75
76#[cfg(feature = "info_mem")]
77pub mod info_mem;
78
79#[cfg(feature = "sac")]
80#[path = "sac_l3.rs"]
81pub mod sac;
82
83#[cfg(feature = "sac_l1")]
84#[path = "sac_l1.rs"]
85pub mod sac;
86
87mod device_specific;
88mod hw_traits;
89mod util;
90
91pub use device_specific::pac;
92
93/// PAC with non-standard peripheral names corrected
94pub(crate) use device_specific::_pac;
95
96#[cfg(feature = "embedded-hal-02")]
97pub use embedded_hal_02 as ehal_02;
98
99pub use embedded_hal as ehal;