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 nrf52-hal-common crate #5

Merged
merged 2 commits into from
Sep 13, 2018
Merged

add nrf52-hal-common crate #5

merged 2 commits into from
Sep 13, 2018

Conversation

wez
Copy link
Member

@wez wez commented Aug 28, 2018

This commit takes what I believe to be the lowest maintenance approach
to sharing a common implementation between two device crates.

The common crate has a set of features that cause the underlying
svd2rust generated device crate to be imported as target_device.
The implementation in that crate then targets target_device rather
than directly using either nrf52 or nrf523840.

This avoids littering the module with conditional code and/or macros.

The consuming hal crates re-export the items from the common crate
and augment with any other additional functionality.

One downside to this approach is that the nrf-hal-common crate cannot
be successfully compiled when multiple targets are built. This is
fine in practice but does mean that building in a workspace will
fail when that workspace enables multiple devices.

For that reason this commit adjusts the travis config to build the
crates individually.

Refs: jamesmunns/nrf52-hal#9

This commit takes what I believe to be the lowest maintenance approach
to sharing a common implementation between two device crates.

The common crate has a set of features that cause the underlying
svd2rust generated device crate to be imported as `target_device`.
The implementation in that crate then targets `target_device` rather
than directly using either `nrf52` or `nrf523840`.

This avoids littering the module with conditional code and/or macros.

The consuming hal crates re-export the items from the common crate
and augment with any other additional functionality.

One downside to this approach is that the `nrf-hal-common` crate cannot
be successfully compiled when multiple targets are built.  This is
fine in practice but does mean that building in a workspace will
fail when that workspace enables multiple devices.

For that reason this commit adjusts the travis config to build the
crates individually.
nrf52-hal-common/src/spim.rs Outdated Show resolved Hide resolved
@hannobraun
Copy link
Contributor

Sorry, I'm a bit swamped right now. I'll take a look as soon as I take a chance, probably later this week.

@hannobraun
Copy link
Contributor

@wez I haven't forgotten this. Still busy though. I expect to have time to review next week. Very sorry to keep this hanging for so long!

Copy link
Contributor

@hannobraun hannobraun left a comment

Choose a reason for hiding this comment

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

If found a few things to complain about (as is my wont), but nothing major. Overall, this looks great!

Thank you for doing this @wez, and sorry again that I wasn't able to review this sooner.

nrf52-hal-common/Cargo.toml Outdated Show resolved Hide resolved
nrf52-hal-common/Cargo.toml Outdated Show resolved Hide resolved
nrf52-hal-common/src/lib.rs Outdated Show resolved Hide resolved
nrf52-hal-common/src/spim.rs Outdated Show resolved Hide resolved
@hannobraun
Copy link
Contributor

Thanks again, @wez! I don't know if anyone else wants to take a look, but from my perspective, this is good to merge.

@hannobraun
Copy link
Contributor

I'm just going to merge this now. This has been open long enough, and I need to make some changes for my downstream project that are currently being complicated by all the open pull requests :)

@hannobraun hannobraun merged commit 68628ab into master Sep 13, 2018
@hannobraun hannobraun deleted the common branch September 13, 2018 09:36
hargoniX pushed a commit to hargoniX/nrf-hal that referenced this pull request Jul 28, 2021
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.

2 participants