Expand description
A collection of peripheral drivers for the MSP430 family of microcontrollers (primarily the MSP430FR2xxx/4xxx) with implementations of embedded_hal traits.
The documentation on docs.rs is built for the MSP430FR2355. To build the documentation for your device
add this crate as a dependency to your project (see: Feature Flags) then run cargo doc --open --package msp430-hal.
The github repository contains such projects for various devices under device_examples/.
§Usage
Requires msp430-elf-gcc installed and in $PATH to build
When using this crate as a dependency, make sure you include the appropriate memory.x file for
your microcontroller.
§Examples
The device-examples/ directory in the repository contains projects for various supported devices, each containing a typical
project structure and a number of examples that show how to use the HAL abstractions. These examples typically target the relevant dev board,
such as the MSP-EXP430FR2355 for the MSP430FR2355.
To flash the examples, make sure you have mspdebug with tilib support installed and in
$PATH. Invoke cargo run --example whatever from within the relevant project folder with the board plugged and the scripts should do
the trick, assuming your host is Linux and you are connected via Launchpad.
§Feature Flags
Exactly one device feature must be enabled to specify which microcontroller is present. More info can be found in the repository README.
An implementation of the pre-1.0 version of embedded-hal (e.g. 0.2.7 at time of writing) is
available behind the embedded-hal-02 feature flag. These traits are implemented on the same
structs as the current embedded-hal implementation, so with this feature enabled you may mix and
match crates that require the pre-1.0 version with those that require the latest version. It isn’t enabled by
default, as many of the trait names are similar (or identical) to their counterparts in the current
version, which can be confusing.
Support for defmt is available behind the defmt feature.
Re-exports§
pub use device_specific::pac;pub use embedded_hal as ehal;
Modules§
- adc
- Analog to Digital Converter (ADC)
- bak_mem
- Backup Memory. BAK_MEM_SIZE bytes of volatile memory that survives system resets.
- batch_
gpio - GPIO batch configuration.
- capture
- Capture ports
- clock
- Clock system for configuration of MCLK, SMCLK, and ACLK.
- crc
- Cyclic Redundancy Check (CRC).
- delay
- Embedded hal delay implementation
- ecomp
- Enhanced Comparator (eCOMP)
- fram
- FRAM controller
- gpio
- GPIO abstractions for configuring and controlling individual GPIO pins.
- i2c
- I2C
- info_
mem - Information Memory. INFO_MEM_SIZE bytes of non-volatile memory.
- lpm
- Low Power Mode (LPM) control
- pin_
mapping - Pin mapping strategies for peripherals.
- pmm
- Power management module
- prelude
- Prelude
- pwm
- PWM ports
- rtc
- Real time counter
- sac
- Smart Analog Combo L3 (SAC-L3)
- serial
- Serial UART
- spi
- SPI
- timer
- Countdown timers
- watchdog
- Watchdog timer, configurable as either a traditional watchdog or a 16-bit timer.