File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
9
9
10
10
- Rearrange LED display modules under the same root module and change their
11
11
APIs to be more aligned with each other.
12
+ - Add BLE Beacon demo.
12
13
13
14
## [ 0.10.1] - 2021-05-25
14
15
@@ -35,7 +36,7 @@ Republished without changes to fix missing README.md in crates.io.
35
36
- Fix rustdoc warnings
36
37
- Upgrade nrf51-hal to 0.12.1
37
38
38
- [ Unreleased ] : https://github.com/nrf-rs/microbit/compare/v0.10.1...HEAD
39
+ [ unreleased ] : https://github.com/nrf-rs/microbit/compare/v0.10.1...HEAD
39
40
[ 0.10.1 ] : https://github.com/nrf-rs/microbit/releases/tag/v0.10.0...v0.10.1
40
41
[ 0.10.0 ] : https://github.com/nrf-rs/microbit/releases/tag/v0.9.0...v0.10.0
41
42
[ 0.9.0 ] : https://github.com/nrf-rs/microbit/compare/v0.8.0...v0.9.0
Original file line number Diff line number Diff line change 1
1
#![ no_main]
2
2
#![ no_std]
3
3
4
+ use defmt_rtt as _;
4
5
use panic_halt as _;
5
6
6
7
use cortex_m_rt:: entry;
@@ -30,17 +31,20 @@ fn main() -> ! {
30
31
let mut timer = Timer :: new ( p. TIMER0 ) ;
31
32
32
33
loop {
33
- defmt:: info!( "Local name" ) ;
34
+ // Broadcast local name
35
+ let local_name = "Rusty microbit" ;
36
+ defmt:: info!( "Local name: {}" , local_name) ;
34
37
let beacon = Beacon :: new (
35
38
device_address,
36
- & [ AdStructure :: CompleteLocalName ( "Rusty microbit" ) ] ,
39
+ & [ AdStructure :: CompleteLocalName ( local_name ) ] ,
37
40
)
38
41
. unwrap ( ) ;
39
42
beacon. broadcast ( & mut radio) ;
40
- timer. delay_ms ( 1_000_u16 ) ;
43
+ timer. delay_ms ( 100_u16 ) ;
41
44
45
+ // Broadcast data
42
46
let data = "Hello world" ;
43
- defmt:: info!( "{}" , data) ;
47
+ defmt:: info!( "Data: {}" , data) ;
44
48
let beacon = Beacon :: new (
45
49
device_address,
46
50
& [ AdStructure :: ManufacturerSpecificData {
@@ -50,7 +54,7 @@ fn main() -> ! {
50
54
)
51
55
. unwrap ( ) ;
52
56
beacon. broadcast ( & mut radio) ;
53
- timer. delay_ms ( 1_000_u16 ) ;
57
+ timer. delay_ms ( 500_u16 ) ;
54
58
}
55
59
}
56
60
You can’t perform that action at this time.
0 commit comments