Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to get full address bytes & address type to nrf52 Ficr #2074

Merged
merged 1 commit into from Aug 21, 2020

Conversation

daboross
Copy link
Contributor

Pull Request Overview

This adds the ability to get the full address as bytes (as opposed to part of the address, or the full address as a string), and a secondary function to get the address type.

I'm mainly interested in using this in order to use the device's address as the device's Bluetooth LE address.

I added the "full_address" function alongside the existing address function for backwards compatibility, but I think it might be better overall to expose just one function returning a [u8; 6]. As far as I can tell from the documentation, deviceaddr0 and deviceaddr1 are always meant to be used as a pair?

Testing Strategy

Printing the device address & address type on a local nrf52840dk module

TODO or Help Wanted

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

@@ -376,6 +383,28 @@ impl Ficr {
regs.deviceaddr0.read(DeviceAddress0::DEVICEADDRESS)
}

pub fn full_address(&self) -> [u8; 6] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just call this address() and remove the address function that exists? I'm not sure what the old version is for, and make allcheck still works after I deleted it.

Otherwise looks good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I've renamed it!

And thanks for looking over this!

This changes the `Ficr::address` function to retrieve the full address
as bytes (as opposed to the first 32bits of a 48bit address), and adds
a new function `Ficr::address_type` to retrieve the address type. I'm
adding these mainly so we can easily use the device's builtin address
as its BLE address.

Signed-off-by: David Ross <David.Ross@wdc.com>
@daboross daboross force-pushed the add-nrf52-full-device-address-and-type branch from dc05764 to e487d96 Compare August 14, 2020 19:08
daboross pushed a commit to daboross/tock that referenced this pull request Aug 15, 2020
This is following a rebase on top of
tock#2074, which now uses `address()`
rather than `full_address()` for retrieving the device address.
@daboross daboross mentioned this pull request Aug 15, 2020
15 tasks
@ppannuto
Copy link
Member

bors r+

@bors bors bot merged commit 517ab5a into tock:master Aug 21, 2020
alistair23 pushed a commit to alistair23/tock that referenced this pull request Dec 4, 2020
This is following a rebase on top of
tock#2074, which now uses `address()`
rather than `full_address()` for retrieving the device address.
bradjc pushed a commit that referenced this pull request Dec 9, 2020
This is following a rebase on top of
#2074, which now uses `address()`
rather than `full_address()` for retrieving the device address.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants