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
70
71
72
73
74
75
76
77
//! The interface that [`Display`] needs to work with a timer.
//!
//! [`Display`]: crate::display::Display
/// The interface that [`Display`] needs to work with a timer.
///
/// The timer should count _ticks_ of a fixed size.
///
/// It should reset itself after the number of ticks passed to
/// `initialise_cycle()` have elapsed (the _primary cycle_), and signal an
/// interrupt.
///
/// It should also provide a _secondary alarm_ which can be programmed to
/// signal an interrupt at a specified point during the primary cycle.
///
/// If you provide a 'no-op' implementation of the secondary-alarm features,
/// the effect will be a display which treats brightness level 9 as on and all
/// other levels as off.
///
/// # Choosing the tick length
///
/// The cycle length is in fact always 375 ticks, so the display will be fully
/// refreshed after `MATRIX_ROWS`×375 ticks. Aiming for around 60 refreshes
/// per second is common.
///
/// For example, if there are three matrix rows you might use a tick period of
/// 16µs. Then the display will be refreshed every 18ms, or about 55 times a
/// second (this is the refresh rate used for the [micro:bit runtime][dal] and
/// the [micro:bit MicroPython port][micropython]).
///
///
/// [dal]: https://lancaster-university.github.io/microbit-docs/
/// [micropython]: https://microbit-micropython.readthedocs.io/
/// [`Display`]: crate::display::Display