summaryrefslogtreecommitdiff
path: root/include/rp2040_micro.h
diff options
context:
space:
mode:
authorDawsyn Schraiber <[email protected]>2025-06-20 00:10:22 -0400
committerGitHub <[email protected]>2025-06-20 00:10:22 -0400
commit5375c6d876f115a2bd75ec45796e5333ba928082 (patch)
tree51d8701b6e0b10b3171c8a146304a3accf57d150 /include/rp2040_micro.h
parente07f105022f3ad6e3c6ee2dfe4cc01eb91c1f373 (diff)
downloadactive-drag-system-5375c6d876f115a2bd75ec45796e5333ba928082.tar.gz
active-drag-system-5375c6d876f115a2bd75ec45796e5333ba928082.tar.bz2
active-drag-system-5375c6d876f115a2bd75ec45796e5333ba928082.zip
Big Kahuna - IREC 2025 - Dawsyn's Final Commit (#16)HEADmain
# Dawsyn's Final Commit This one is a little emotional as this is my final commit in this repository and as a member of Rocketry at Virginia Tech. This merges the changes seen in the branch known as 'big_kahuna' into main. This is the version of the ADS software as seen on [Roadkill](https://drive.google.com/file/d/120BvI-0ntliHo6i9UxcCn2pXAl-JsdP_/view?usp=drive_link) in the 2025 IREC competition. There are bound to be bugs, but I have found it useful to have the final competition version to be the one present on main at the end of every academic year. Hopefully this is useful to the next lead. ## Primary Changes + NEW I2C drivers to support sensors present on new ADS custom PCB + NEW logging library found in separate repository and pulled in as submodule ([pico-logger](https://github.com/rocketryvt/pico-logger)) + No longer dependent on different flash chip from one used for code storage! Compile executable as RP2040 'copy-to-ram' type to increase flash read/write speeds! + NEW fixed-point libraries to allow for increased performance and sensor sampling speeds on RP2040 that lacks FPU + FreeRTOS Simultaneous Multi-processing (SMP) architecture for task handling and easier introduction / testing of new features + Serial monitor / command system with task performance monitoring commands + WORKING Kalman filter that takes altitude from barometer as measurement and z-axis acceleration from IMU as control to generate state vector containing filtered altitude and vertical velocity + NEW CFD equations from the Ben-ogrithm (to replace the Chen-ogrithm) that includes: + Apogee prediction model that takes current drag force, altitude, and vertical velocity + Current Drag Force equation based on current deployment and vertical velocity to use for Apogee Prediction model + Desired Drag force equation based on current altitude and vertical velocity to generate what drag force is needed to reach 10K ft + Deployment percentage equation based on current velocity and desired drag force to map to flap deployment percentage
Diffstat (limited to 'include/rp2040_micro.h')
-rw-r--r--include/rp2040_micro.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/include/rp2040_micro.h b/include/rp2040_micro.h
new file mode 100644
index 0000000..1ac6382
--- /dev/null
+++ b/include/rp2040_micro.h
@@ -0,0 +1,111 @@
+// -----------------------------------------------------
+// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
+// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
+// -----------------------------------------------------
+
+
+#ifndef _BOARDS_RP2040_MICRO_H
+#define _BOARDS_RP2040_MICRO_H
+
+// For board detection
+#define RP2040_MICRO_H
+
+// --- UART ---
+#ifndef PICO_DEFAULT_UART
+#define PICO_DEFAULT_UART 0
+#endif
+#ifndef PICO_DEFAULT_UART_TX_PIN
+#define PICO_DEFAULT_UART_TX_PIN 12
+#endif
+#ifndef PICO_DEFAULT_UART_RX_PIN
+#define PICO_DEFAULT_UART_RX_PIN 13
+#endif
+
+// --- LED ---
+#ifndef PICO_DEFAULT_LED_PIN
+#define PICO_DEFAULT_LED_PIN 25
+#endif
+// no PICO_DEFAULT_WS2812_PIN
+
+// --- I2C ---
+#ifndef PICO_DEFAULT_I2C
+#define PICO_DEFAULT_I2C 0
+#endif
+#ifndef PICO_DEFAULT_I2C_SDA_PIN
+#define PICO_DEFAULT_I2C_SDA_PIN 20
+#endif
+#ifndef PICO_DEFAULT_I2C_SCL_PIN
+#define PICO_DEFAULT_I2C_SCL_PIN 21
+#endif
+
+// --- SPI ---
+#ifndef PICO_DEFAULT_SPI
+#define PICO_DEFAULT_SPI 0
+#endif
+#ifndef PICO_DEFAULT_SPI_SCK_PIN
+#define PICO_DEFAULT_SPI_SCK_PIN 18
+#endif
+#ifndef PICO_DEFAULT_SPI_TX_PIN
+#define PICO_DEFAULT_SPI_TX_PIN 19
+#endif
+#ifndef PICO_DEFAULT_SPI_RX_PIN
+#define PICO_DEFAULT_SPI_RX_PIN 16
+#endif
+#ifndef PICO_DEFAULT_SPI_CSN_PIN
+#define PICO_DEFAULT_SPI_CSN_PIN 17
+#endif
+
+// --- MISC ---
+#ifndef MICRO_DEFAULT_PWM
+#define MICRO_DEFAULT_PWM 7
+#endif
+
+#ifndef MICRO_DEFAULT_SERVO_ENABLE
+#define MICRO_DEFAULT_SERVO_ENABLE 4
+#endif
+
+#ifndef MICRO_DEFAULT_CLK_OUTPUT
+#define MICRO_DEFAULT_CLK_OUTPUT 23
+#endif
+
+#ifndef MICRO_IMU_INTTERUPT
+#define MICRO_IMU_INTERRUPT 22
+#endif
+
+#ifndef MICRO_ACCEL_INTERRUPT_0
+#define MICRO_ACCEL_INTERRUPT_0 19
+#endif
+
+#ifndef MICRO_ACCEL_INTERRUPT_1
+#define MICRO_ACCEL_INTERRUPT_1 18
+#endif
+
+#ifndef MICRO_MAG_INTERRUPT
+#define MICRO_MAG_INTERRUPT 17
+#endif
+
+#ifndef MICRO_BUZZER
+#define MICRO_BUZZER 0
+#endif
+
+// --- FLASH ---
+
+#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
+
+#ifndef PICO_FLASH_SPI_CLKDIV
+#define PICO_FLASH_SPI_CLKDIV 2
+#endif
+
+#ifndef PICO_FLASH_SIZE_BYTES
+#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
+#endif
+
+// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads)
+#define PICO_SMPS_MODE_PIN 23
+
+// All boards have B1 RP2040
+#ifndef PICO_RP2040_B0_SUPPORTED
+#define PICO_RP2040_B0_SUPPORTED 0
+#endif
+
+#endif