3
3
4
4
extern crate panic_halt;
5
5
// github.com therealprof / microbit
6
+ use core:: fmt:: Write ;
6
7
use cortex_m_rt:: entry;
7
8
use microbit:: led:: Display ;
8
9
//use microbit::hal::i2c;
9
10
use nrf51:: Peripherals ;
10
11
use nrf51_hal:: delay:: Delay ;
11
12
use nrf51_hal:: prelude:: * ;
13
+ use nrf51_hal:: serial:: { Serial , BAUD115200 } ;
12
14
13
15
#[ entry]
14
16
fn main ( ) -> ! {
17
+ // let vector = vec![1, 3, 4, 5, 3]; // cannot find macro `vec!` in this scope
18
+ let _vc = [ 1 , 2 , 3 , 4 , 5 ] ;
19
+ let _mx = _vc. iter ( ) . max ( ) . unwrap ( ) ;
20
+
21
+
15
22
if let Some ( p) = Peripherals :: take ( ) {
23
+ let gpio = p. GPIO . split ( ) ;
24
+ let tx_pin = gpio. pin24 . into_push_pull_output ( ) . downgrade ( ) ;
25
+ let rx_pin = gpio. pin25 . into_floating_input ( ) . downgrade ( ) ;
26
+ let ( mut tx, _) = Serial :: uart0 ( p. UART0 , tx_pin, rx_pin, BAUD115200 ) . split ( ) ;
27
+ write ! ( tx, "test output message\n \r " ) . unwrap ( ) ;
16
28
let mut delay = Delay :: new ( p. TIMER0 ) ;
17
- let gpio = p. GPIO . split ( ) ;
29
+ // let gpio = p.GPIO.split();
18
30
let col1 = gpio. pin4 . into_push_pull_output ( ) ;
19
31
let col2 = gpio. pin5 . into_push_pull_output ( ) ;
20
32
let col3 = gpio. pin6 . into_push_pull_output ( ) ;
@@ -30,7 +42,8 @@ fn main() -> ! {
30
42
let mut leds = Display :: new (
31
43
col1, col2, col3, col4, col5, col6, col7, col8, col9, row1, row2, row3,
32
44
) ;
33
-
45
+ //https://www.mathworks.com/help/supportpkg/microbit/ref/5x5ledmatrix.html
46
+ //https://microbit.org/guide/hardware/leds/
34
47
let checker_a = [
35
48
[ 1 , 0 , 1 , 0 , 1 ] ,
36
49
[ 0 , 1 , 0 , 1 , 0 ] ,
0 commit comments