|
18 | 18 | //!
|
19 | 19 | //! # Usage
|
20 | 20 | //!
|
| 21 | +//! `svd2rust` supports Cortex-M and MSP430 microcontrollers. The generated |
| 22 | +//! crate can be tailored for either architecture using the `--target` flag. The |
| 23 | +//! flag accepts "cortex-m", "msp430" and "none" as values. "none" can be used |
| 24 | +//! to generate a crate that's architecture agnostic and that should work for |
| 25 | +//! architectures that `svd2rust` doesn't currently know about like the Cortex-A |
| 26 | +//! architecture. |
| 27 | +//! |
| 28 | +//! If the `--target` flag is omitted `svd2rust` assumes the target is the |
| 29 | +//! Cortex-M architecture. |
| 30 | +//! |
21 | 31 | //! ```
|
22 | 32 | //! $ svd2rust -i STM32F30x.svd | rustfmt | tee src/lib.rs
|
23 |
| -//! //! Peripheral access API for STM32F30X microcontrollers (generated using svd2rust v0.11.0) |
| 33 | +//! //! Peripheral access API for STM32F30X microcontrollers |
| 34 | +//! //! (generated using svd2rust v0.11.0) |
24 | 35 | //!
|
25 | 36 | //! #![deny(missing_docs)]
|
26 | 37 | //! #![deny(warnings)]
|
|
79 | 90 | //!
|
80 | 91 | //! The generated crate depends on:
|
81 | 92 | //!
|
82 |
| -//! - [`cortex-m-rt`](https://crates.io/crates/cortex-m-rt) v0.3.x |
83 |
| -//! - [`cortex-m`](https://crates.io/crates/cortex-m) v0.3.x |
| 93 | +//! - [`bare-metal`](https://crates.io/crates/bare-metal) v0.1.x |
84 | 94 | //! - [`vcell`](https://crates.io/crates/vcell) v0.1.x
|
| 95 | +//! - [`cortex-m-rt`](https://crates.io/crates/cortex-m-rt) v0.3.x if targeting |
| 96 | +//! the Cortex-M architecture. |
| 97 | +//! - [`cortex-m`](https://crates.io/crates/cortex-m) v0.3.x if targeting the |
| 98 | +//! Cortex-M architecture. |
| 99 | +//! - [`msp430`](https://crates.io/crates/msp430) v0.1.x if targeting the MSP430 |
| 100 | +//! architecture. |
| 101 | +//! - [`msp430-rt`](https://crates.io/crates/msp430-rt) v0.1.x if targeting the |
| 102 | +//! MSP430 architecture. |
85 | 103 | //!
|
86 | 104 | //! # Peripheral API
|
87 | 105 | //!
|
|
365 | 383 | /// must have signature `fn()`.
|
366 | 384 | ///
|
367 | 385 | /// Optionally, a third argument may be used to declare interrupt local data.
|
368 |
| -/// The handler will have exclusive access to this data on each invocation. If |
369 |
| -/// the third argument is used then the signature of the handler function must |
370 |
| -/// be `fn(&mut $NAME::Local)` where `$NAME` is the first argument passed to the |
371 |
| -/// macro. |
| 386 | +/// The handler will have exclusive access to these *local* variables on each |
| 387 | +/// invocation. If the third argument is used then the signature of the handler |
| 388 | +/// function must be `fn(&mut $NAME::Locals)` where `$NAME` is the first argument |
| 389 | +/// passed to the macro. |
372 | 390 | ///
|
373 | 391 | /// # Example
|
374 | 392 | ///
|
|
379 | 397 | /// print!(".");
|
380 | 398 | /// }
|
381 | 399 | ///
|
382 |
| -/// interrupt!(TIM3, tick, local: { |
| 400 | +/// interrupt!(TIM3, tick, locals: { |
383 | 401 | /// tick: bool = false;
|
384 | 402 | /// });
|
385 | 403 | ///
|
386 |
| -/// fn tick(local: &mut TIM3::Local) { |
387 |
| -/// local.tick = !local.tick; |
| 404 | +/// fn tick(locals: &mut TIM3::Locals) { |
| 405 | +/// locals.tick = !locals.tick; |
388 | 406 | ///
|
389 |
| -/// if local.tick { |
| 407 | +/// if locals.tick { |
390 | 408 | /// println!("Tick");
|
391 | 409 | /// } else {
|
392 | 410 | /// println!("Tock");
|
|
395 | 413 | /// ```
|
396 | 414 | #[macro_export]
|
397 | 415 | macro_rules! interrupt {
|
398 |
| - ($NAME:ident, $body:path) => {}; |
399 |
| - ($NAME:ident, $body:path, local: { |
| 416 | + ($NAME:ident, $path:path) => {}; |
| 417 | + ($NAME:ident, $path:path, locals: { |
400 | 418 | $($lvar:ident: $lty:ty = $lval:expr;)+
|
401 | 419 | }) => {};
|
402 | 420 | }
|
0 commit comments