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

examples: NonArduino: Raspberry Pi Pico #941

Merged
merged 1 commit into from
Jan 27, 2024

Conversation

cameron-goddard
Copy link
Contributor

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.

Copy link
Owner

@jgromes jgromes left a 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();
Copy link
Owner

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()

Comment on lines +60 to +64
gpio_init(RFM_NSS);
gpio_init(RFM_RST);

gpio_set_dir(RFM_NSS, GPIO_OUT);
gpio_set_dir(RFM_RST, GPIO_OUT);
Copy link
Owner

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.

Comment on lines +66 to +71
// reset the RF module

sleep_ms(10);
gpio_put(RFM_RST, 0);
sleep_ms(10);
gpio_put(RFM_RST, 1);
Copy link
Owner

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)
Copy link
Owner

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.

@jgromes
Copy link
Owner

jgromes commented Jan 22, 2024

One more thing, it would be nice to have at least build.sh and clean.sh scripts.

@jgromes jgromes merged commit 33f1ef7 into jgromes:master Jan 27, 2024
28 checks passed
@jgromes
Copy link
Owner

jgromes commented Jan 27, 2024

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!

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