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

Minor changes in the rp2xx howto document #761

Merged
merged 2 commits into from
Apr 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions docs/pico_sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@ Follow the Raspberry Pi Foundation's
setup a proper development environment on your host PC (the machine that
will build your project).

It is important to remember that the pico-sdk repository should exist in the same directory that the RF24 repository (or your project's directory) exists.
Either set an environment variable named `PICO_SDK_PATH` that points to your
local clone of the pico-sdk or put the pico-sdk next to the `RF24` folder or
the folder containing your project using the `RF24` library:
Comment on lines +10 to +11
Copy link
Member

Choose a reason for hiding this comment

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

I'm ok with RF24 being in inline code blocks, but I just wanted to mention that doxygen automatically adjusts all instances of the word "RF24" as a hyperlink to the RF24 class' docs.

Copy link
Author

Choose a reason for hiding this comment

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

Oh, missed that when doing the corrections. Please feel free to change to quotation marks.


path/to/github/repos/
pico-sdk/
RF24/

Alternatively, the RF24 repository (and optionally the RF24Network and RF24Mesh
repositories) can be included into your project's "lib" folder as copies or
git submodules. for more detail, see the below instructions to incorporate RF24 libs into your project.
git submodules. For more detail, see the below instructions to incorporate
RF24 libs into your project.

## Building the RF24 examples for the Pico SDK
1. Create a "build" directory in the RF24 repository's root directory, then navigate to
the new "build" directory.
1. Create a "build" directory in the RF24 repository's root directory and
navigate to it:
```shell
cd RF24
mkdir build
Expand Down Expand Up @@ -72,12 +75,19 @@ In order to use the RF24 libraries in your RP2040 based project:
include(../lib/RF24Mesh/CMakeLists.txt)
```
3. In the same CMakeLists.txt file from step 2, add the RF24 libraries into the
`target_link_libraries` configuration.
`target_link_libraries` configuration:
```txt
target_include_directories(target_name PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(${CMAKE_PROJECT_NAME}
# ... Your project's other libraries ...
RF24
RF24Network
RF24Mesh
)
```
If you are using tinyUSB, this line (or similar) should already exist:
```txt
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR})
2bndy5 marked this conversation as resolved.
Show resolved Hide resolved
```
Where `target_name` is specified prior to this call using
[`add_executable()`](https://cmake.org/cmake/help/latest/command/add_executable.html#command:add_executable)
4. Finally, remember to include the necessary RF24* libraries' header files in your
project's source code where applicable.
```cpp
Expand Down Expand Up @@ -125,7 +135,7 @@ void main()
To specify the default SPI pins used at build time, you can use either:
1. declare these pins in the CMakeLists.txt file
```txt
target_compile_definitions(target_name
target_compile_definitions(${CMAKE_PROJECT_NAME}
PUBLIC PICO_DEFAULT_SPI=0 # can only be 0 or 1 (as in `spi0` or `spi1`)
PUBLIC PICO_DEFAULT_SPI_SCK_PIN=2 # depends on which SPI bus (0 or 1) is being used
PUBLIC PICO_DEFAULT_SPI_TX_PIN=3 # depends on which SPI bus (0 or 1) is being used
Expand Down