Skip to content

Commit

Permalink
feat(devboard): Add support for RP2040 (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZ-Cat authored Feb 9, 2024
1 parent a70ef2e commit a464f1f
Show file tree
Hide file tree
Showing 26 changed files with 63 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ body:
- Arduino MKR WiFi 1010
- Arduino MKR ZERO
- Arduino Nano 33 IoT
- Arduino Nano RP2040 Connect
- Arduino Zero
- Espressif ESP32-C3 DevKitC-02
- Espressif ESP32-C3 DevKitM-1
- Espressif ESP32-S3 DevKitC-1-N8
- Raspberry Pi Pico RP2040
- Seeed Studio Xiao ESP32-C3
- Seeed Studio Xiao ESP32-S3
- Seeed Studio XIAO SAMD21
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ CRSF for Arduino is compatible with these development boards:
- SparkFun ESP32 Thing
- SparkFun ESP32 Thing Plus
- SparkFun ESP32-S2 Thing Plus
- RP2040 based boards:
- Arduino Nano RP2040 Connect
- Raspberry Pi Pico RP2040
- SAMD21 based boards:
- Adafruit Feather M0 and all of its variants, including the Adafruit Feather M0 Express
- Adafruit ItsyBitsy M0 Express
Expand Down
2 changes: 1 addition & 1 deletion examples/flight_modes/flight_modes.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief Example of how to read flight modes from a receiver.
* @version 1.0.0
* @date 2024-2-6
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion examples/link_stats/link_stats.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief Example of how to read link statistics from a receiver.
* @version 1.0.0
* @date 2024-2-6
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion examples/platformio/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief This is the main development file for CRSF for Arduino.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion examples/rc_channels/rc_channels.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief Example of how to read rc channels from a receiver.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion examples/telemetry/telemetry.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief Example of how to send telemetry back to your RC handset using CRSF for Arduino.
* @version 1.0.0
* @date 2024-2-6
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
10 changes: 1 addition & 9 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ core_dir = .pio/core
extra_configs =
targets/common.ini
targets/unified_esp32.ini
targets/unified_rp2040.ini
targets/unified_samd21.ini
targets/unified_samd51.ini
targets/unified_teensy3x.ini
Expand All @@ -25,14 +26,5 @@ test_dir =

; [env:development]
; board = adafruit_metro_m4
; build_src_filter =
; +<../examples/platformio/main.cpp>
; +<hal/CompatibilityTable/*.cpp>
; +<SerialReceiver/*.cpp>
; +<SerialReceiver/CRC/*.cpp>
; +<SerialReceiver/CRSF/*.cpp>
; +<SerialReceiver/SerialBuffer/*.cpp>
; +<SerialReceiver/Telemetry/*.cpp>
; +<*.cpp>
; build_type = debug
; platform = [email protected]
4 changes: 2 additions & 2 deletions src/CFA_Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief This is the configuration file for CRSF for Arduino.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down Expand Up @@ -37,7 +37,7 @@ namespace crsfForArduinoConfig
Versioning is done using Semantic Versioning 2.0.0.
See https://semver.org/ for more information. */
#define CRSFFORARDUINO_VERSION "1.0.0"
#define CRSFFORARDUINO_VERSION_DATE "2024-2-7"
#define CRSFFORARDUINO_VERSION_DATE "2024-2-9"
#define CRSFFORARDUINO_VERSION_MAJOR 1
#define CRSFFORARDUINO_VERSION_MINOR 0
#define CRSFFORARDUINO_VERSION_PATCH 0
Expand Down
2 changes: 1 addition & 1 deletion src/CRSFforArduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino.
* It is intended to be used by the user in their sketches.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/CRSFforArduino.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @brief This is the Sketch Layer, which is a simplified API for CRSF for Arduino.
* It is intended to be used by the user in their sketches.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/CRC/CRC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief A generic CRC8 implementation for the CRSF for Arduino library.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/CRC/CRC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief A generic CRC8 implementation for the CRSF for Arduino library.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/CRSF/CRSF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief This decodes CRSF frames from a serial port.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/CRSF/CRSF.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief This decodes CRSF frames from a serial port.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/CRSF/CRSFProtocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief This file contains enums and structs for the CRSF protocol.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/SerialBuffer/SerialBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief A generic serial buffer for the CRSF for Arduino library.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/SerialBuffer/SerialBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief A generic serial buffer for the CRSF for Arduino library.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/SerialReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief The Serial Receiver layer for the CRSF for Arduino library.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/SerialReceiver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief The Serial Receiver layer for the CRSF for Arduino library.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/Telemetry/Telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief This encodes data into CRSF telemetry frames for transmission to the RC handset.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/SerialReceiver/Telemetry/Telemetry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief This encodes data into CRSF telemetry frames for transmission to the RC handset.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down
18 changes: 17 additions & 1 deletion src/hal/CompatibilityTable/CompatibilityTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down Expand Up @@ -95,6 +95,22 @@ namespace hal
device.type.devboard = DEVBOARD_IS_PERMISSIVELY_INCOMPATIBLE_UNKNOWN_BOARD;
#endif

// Raspberry Pi RP2040 Architecture
#elif defined(ARDUINO_ARCH_RP2040)

// Arduino Nano RP2040 Connect
#if defined(ARDUINO_NANO_RP2040_CONNECT)
device.type.devboard = DEVBOARD_ARDUINO_NANO_RP2040_CONNECT;

// Raspberry Pi Pico
#elif defined(ARDUINO_RASPBERRY_PI_PICO)
device.type.devboard = DEVBOARD_RASPBERRYPI_PICO;
#else
// The architecture and chip is known, but the board is not.
#warning "The target board is unknown. Please enable CRSF_DEBUG_ENABLED and CRSF_DEBUG_ENABLE_COMPATIBILITY_TABLE_OUTPUT in CFA_Config.hpp for more information."
device.type.devboard = DEVBOARD_IS_PERMISSIVELY_INCOMPATIBLE_UNKNOWN_BOARD;
#endif

// Arduino SAMD Architecture
#elif defined(ARDUINO_ARCH_SAMD)

Expand Down
10 changes: 9 additions & 1 deletion src/hal/CompatibilityTable/CompatibilityTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Cassandra "ZZ Cat" Robinson ([email protected])
* @brief The Compatibility Table determines if the target development board is compatible with CRSF for Arduino.
* @version 1.0.0
* @date 2024-2-7
* @date 2024-2-9
*
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
Expand Down Expand Up @@ -82,6 +82,9 @@ namespace hal
// Arduino ESP32 boards.
DEVBOARD_ARDUINO_NANO_ESP32,

// Arduino RP2040 boards.
DEVBOARD_ARDUINO_NANO_RP2040_CONNECT,

// Arduino SAMD21 boards.
DEVBOARD_ARDUINO_MKR1000,
DEVBOARD_ARDUINO_MKRFOX1200,
Expand All @@ -99,6 +102,9 @@ namespace hal
DEVBOARD_ESPRESSIF_ESP32C3_DEVKIT,
DEVBOARD_ESPRESSIF_ESP32S3_DEVKIT,

// Raspberry Pi RP2040 boards.
DEVBOARD_RASPBERRYPI_PICO,

// Seeed Studio boards.
DEVBOARD_SEEEDSTUDIO_XIAO_ESP32C3,
DEVBOARD_SEEEDSTUDIO_XIAO_ESP32S3,
Expand Down Expand Up @@ -160,6 +166,7 @@ namespace hal
"Adafruit Metro M4 Express",
"Adafruit Feather M4 CAN",
"Arduino Nano ESP32",
"Arduino Nano RP2040 Connect",
"Arduino MKR1000",
"Arduino MKRFOX1200",
"Arduino MKRGSM1400",
Expand All @@ -173,6 +180,7 @@ namespace hal
"Arduino Zero",
"Espressif ESP32-C3 DevKit",
"Espressif ESP32-S3 DevKit",
"Raspberry Pi Pico",
"Seeed Studio Xiao ESP32-C3",
"Seeed Studio Xiao ESP32-S3",
"Seeed Studio Xiao SAMD21",
Expand Down
10 changes: 4 additions & 6 deletions targets/common.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ build_flags =
[env_common_esp32]
platform = [email protected]

[env_common_rp2040]
platform = [email protected]

[env_common_samd21]
platform = [email protected]

Expand All @@ -28,12 +31,7 @@ platform = [email protected]
framework = arduino
build_src_filter =
+<../examples/platformio/main.cpp>
+<hal/CompatibilityTable/*.cpp>
+<SerialReceiver/*.cpp>
+<SerialReceiver/CRC/*.cpp>
+<SerialReceiver/CRSF/*.cpp>
+<SerialReceiver/SerialBuffer/*.cpp>
+<SerialReceiver/Telemetry/*.cpp>
+<*/*/*.cpp>
+<*.cpp>
build_unflags =
-Os
Expand Down
7 changes: 7 additions & 0 deletions targets/unified_rp2040.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[env:arduino_nano_rp2040_connect]
extends = env_common_rp2040
board = nanorp2040connect

[env:raspberrypi_pico_rp2040]
extends = env_common_rp2040
board = pico

0 comments on commit a464f1f

Please sign in to comment.