Skip to content

Commit

Permalink
fix(examples): ble broadcaster name
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf committed Nov 2, 2023
1 parent c40eb30 commit a957bb2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
25 changes: 7 additions & 18 deletions examples/embassy-ble-broadcaster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,19 @@ static mut SCAN_RSP_DATA: [u8; 16] = [
];
// GAP - Advertisement data (max size = 31 bytes, though this is
// best kept short to conserve power while advertisting)
static mut ADVERT_DATA: [u8; 30] = [
// Flags; this sets the device to use limited discoverable
// mode (advertises for 30 seconds at a time) instead of general
// discoverable mode (advertises indefinitely)
static mut ADVERT_DATA: [u8; 22] = [
0x02, // length of this data
GAP_ADTYPE_FLAGS,
GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
// Broadcast of the data
// len

// https://www.bluetooth.com/specifications/assigned-numbers/
0x04, // length of this data including the data type byte
GAP_ADTYPE_MANUFACTURER_SPECIFIC, // manufacturer specific advertisement data type
0xD7,
0x07, // 0x07D7, Nanjing Qinheng Microelectronics Co., Ltd.
0x01,
// len
0x0a,

0x0a, // len
GAP_ADTYPE_LOCAL_NAME_SHORT,
b'c',
b'h',
Expand All @@ -64,18 +61,10 @@ static mut ADVERT_DATA: [u8; 30] = [
b'h',
b'a',
b'l',
// len
0x02,

0x02, // len
GAP_ADTYPE_POWER_LEVEL,
0, // 0dBm
7,
GAP_ADTYPE_LOCAL_NAME_COMPLETE,
b'a',
b'n',
b'd',
b'e',
b'l',
b'f',
];

#[embassy_executor::task]
Expand Down
3 changes: 1 addition & 2 deletions src/ble/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ pub fn init(config: Config) -> Result<(), NonZeroU8> {
cfg.rcCB = None; // use LSE, no calibrate
cfg.tsCB = Some(get_raw_temperature);

// No need to HAL_SLEEP
// WakeUpTIme, sleepCB
// No need to set HAL_SLEEP(WakeUpTIme, sleepCB)

cfg.MacAddr = config.mac_addr.0;

Expand Down

0 comments on commit a957bb2

Please sign in to comment.