-
Notifications
You must be signed in to change notification settings - Fork 139
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
Added beginnings of an nRF52840 hal #1
Conversation
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.
❤️ I have a couple of non-blocking questions
nrf52840-hal/Cargo.toml
Outdated
@@ -0,0 +1,35 @@ | |||
[package] | |||
name = "nrf52840-embedded-hal" |
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.
Should we keep this a bit shorter? nrf52840-hal
?
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.
Sure
nrf52840-hal/memory.x
Outdated
{ | ||
/* NOTE K = KiBi = 1024 bytes */ | ||
/* TODO Adjust these memory regions to match your device memory layout */ | ||
FLASH : ORIGIN = 0x00000000, LENGTH = 950K |
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.
These seem a little smaller than I was expecting; are these adjusted for the softdevice?
https://github.com/particle-iot/nrf5_sdk/blob/6177fb3797962aaa091e04fa363bfb93a55eb7ef/modules/nrfx/mdk/nrf52840_xxaa.ld#L8
the memory.x in the hal should probably not factor in the softdevice and that should probably be something that is handled in the "application" crate.
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.
No, actually a good catch. When I first tried to get my dev board working I had a real mare of a time. Thinking back I think I reduced the sizes to try and prevent this weird issue I was having, I can't for the life of me remember my rationale. I'll put it back and remove the TODO.
nrf52840-hal/src/gpio.rs
Outdated
@@ -0,0 +1,365 @@ | |||
//! General Purpose Input / Output |
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.
this file looks similar to nrf52-hal/src/gpio.rs
... is it close enough that you could copy that over this one and maybe tweak the use nrf52;
lines to use nrf52840
?
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.
That's because it was originally a copy of an earlier version. I've updated it and made a couple of tweaks for the 52840. Couldn't get the GPIOs on P1 to work with the macro though due to the shared module p0, and I'm not sure of the best way to fix it.
c27152f
to
e64d099
Compare
449254c
to
4b0a38d
Compare
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.
looks good to me!
// the same module. Not sure the best way to deal with P1 only implementing half the pins | ||
// either | ||
// =========================================================================== | ||
//gpio!(P1, p0, P1_Pin [ |
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.
Once jamesmunns/nrf52-hal#8 is a bit further along, I think this will get a bit easier
* Add extension trait for tasks and events * Easier to maintain structure * Implement other crates, fix regex a bit * That's gross, but it works * Apply suggestions from code review Co-authored-by: Thales <[email protected]> * Remove nrf9160 impls * More inline always Co-authored-by: Thales <[email protected]>
ieee802154.rs: add CCA-Energy Detection
This is just all the old hal code I had for the 52840, edited just to get the GPIO stuff working. I don't mind if you would rather get rid of this and start again.