-
Notifications
You must be signed in to change notification settings - Fork 409
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
examples: NonArduino: Raspberry Pi Pico #941
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.
Thank you for the contribution! I left some comments (nothing major), though there is one point that should be addressed - CI. I can add it, but I need to know how to install the SDK. Do you have some pointers how to do that?
EDIT: Oops, missed the link in the original post. That's enough, I can add the CI after merging this :)
|
||
|
||
int main() { | ||
stdio_init_all(); |
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.
It's probably not needed to call this here, as stdio_init_all()
is called from PicoHal::init()
, which is in turn called in Module::init()
as the first step in radio.begin()
gpio_init(RFM_NSS); | ||
gpio_init(RFM_RST); | ||
|
||
gpio_set_dir(RFM_NSS, GPIO_OUT); | ||
gpio_set_dir(RFM_RST, GPIO_OUT); |
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.
Pin direction configuration is handled by the library. However, if it requires a call to gpio_init
, I would propose to move this call to PicoHal::pinMode
.
// reset the RF module | ||
|
||
sleep_ms(10); | ||
gpio_put(RFM_RST, 0); | ||
sleep_ms(10); | ||
gpio_put(RFM_RST, 1); |
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.
Again, this is not needed, the module will be reset during radio.begin()
.
Just trying to remove the redundant portions of code ;)
// and implement all of its virtual methods | ||
class PicoHal : public RadioLibHal { | ||
public: | ||
PicoHal(spi_inst_t *spiChannel, uint32_t misoPin, uint32_t mosiPin, uint32_t sckPin, uint32_t spiSpeed = 500 * 1000) |
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.
The default SPI speed is quite low (500 kHz vs 2 MHz in Arduino). Is there a specific reason for that? Asking because of #938.
One more thing, it would be nice to have at least build.sh and clean.sh scripts. |
To not block this further, I merged this despite the open points and will fix them in master. @cameron-goddard thank you for the contribution! |
Add support for the Raspberry Pi Pico with the native Pico SDK instead of through the Arduino core.
This has been tested with a Pico and an SX1276 radio module.