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
Add ability to get full address bytes & address type to nrf52 Ficr #2074
Conversation
chips/nrf52/src/ficr.rs
Outdated
@@ -376,6 +383,28 @@ impl Ficr { | |||
regs.deviceaddr0.read(DeviceAddress0::DEVICEADDRESS) | |||
} | |||
|
|||
pub fn full_address(&self) -> [u8; 6] { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
dc05764
to
e487d96
Compare
This is following a rebase on top of tock#2074, which now uses `address()` rather than `full_address()` for retrieving the device address.
bors r+ |
This is following a rebase on top of tock#2074, which now uses `address()` rather than `full_address()` for retrieving the device address.
This is following a rebase on top of #2074, which now uses `address()` rather than `full_address()` for retrieving the device address.
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
/docs
, or no updates are required.Formatting
make prepush
.