Skip to content

Commit

Permalink
Merge pull request nrf-rs#122 from videbar/update-non-blocking-displa…
Browse files Browse the repository at this point in the history
…y-documentation

Updated non-blocking display documenation and added Changelog entry
  • Loading branch information
therealprof authored Jan 2, 2024
2 parents 66a9f3c + f3618dc commit c7fbd9a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

- Fix faulty doc test in `blocking.rs`
- Update the non-blocking display documentation to better explain when methods
should be called from within a critical section
- Bump example dependencies to latest versions to fix build
- Update examples to use RTIC 1.0
- Add ADC for micro:bit V1
Expand Down
9 changes: 9 additions & 0 deletions microbit-common/src/display/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
//! connector. That means that
//!
//! ```no_run
//! # use microbit_common as microbit;
//! # use microbit::{
//! # Board,
//! # hal,
//! # display::blocking::Display,
//! # };
//! # let board = Board::take().unwrap();
//! # let mut timer = hal::Timer::new(board.TIMER0);
//! # let mut display = Display::new(board.display_pins);
//! display.show(
//! &mut timer,
//! [
Expand Down
20 changes: 16 additions & 4 deletions microbit-common/src/display/nonblocking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ impl<T: Instance> Display<T> {
/// Call this in an interrupt handler for the timer you're using. This method
/// takes care of updating the LED display and clearing the timer's event registers
///
/// This must be called from within a [critical
/// This may be called at any time, so long as the code calling it is not interrupting, or
/// interruptable by `tiny_led_matrix::Display::handle_event()`. Within safe code, the borrow
/// checker ensures that this requirement is fulfilled. When writing unsafe code, this method
/// should be called from within a [critical
/// section](https://docs.rs/cortex-m/0.7.2/cortex_m/interrupt/fn.free.html).
pub fn handle_display_event(&mut self) {
self.display
Expand All @@ -220,7 +223,10 @@ impl<T: Instance> Display<T> {

/// Show a new image
///
/// This must be called from within a [critical
/// This may be called at any time, so long as the code calling it is not interrupting, or
/// interruptable by `tiny_led_matrix::Display::handle_event()`. Within safe code, the borrow
/// checker ensures that this requirement is fulfilled. When writing unsafe code, this method
/// should be called from within a [critical
/// section](https://docs.rs/cortex-m/0.7.2/cortex_m/interrupt/fn.free.html).
///
/// ## Example
Expand All @@ -241,7 +247,10 @@ impl<T: Instance> Display<T> {

/// Clear the display
///
/// This must be called from within a [critical
/// This may be called at any time, so long as the code calling it is not interrupting, or
/// interruptable by `tiny_led_matrix::Display::handle_event()`. Within safe code, the borrow
/// checker ensures that this requirement is fulfilled. When writing unsafe code, this method
/// should be called from within a [critical
/// section](https://docs.rs/cortex-m/0.7.2/cortex_m/interrupt/fn.free.html).
pub fn clear(&mut self) {
self.display.set_frame(&MicrobitFrame::default());
Expand All @@ -253,7 +262,10 @@ impl<T: Instance> Display<T> {
/// This may be useful if performance is a concern as calling `set` on the frame
/// can be done outside the critical section.
///
/// This must be called from within a [critical
/// This may be called at any time, so long as the code calling it is not interrupting, or
/// interruptable by `tiny_led_matrix::Display::handle_event()`. Within safe code, the borrow
/// checker ensures that this requirement is fulfilled. When writing unsafe code, this method
/// should be called from within a [critical
/// section](https://docs.rs/cortex-m/0.7.2/cortex_m/interrupt/fn.free.html).
///
/// ## Example
Expand Down

0 comments on commit c7fbd9a

Please sign in to comment.