|
1 | | -//========================================================================================================================// |
2 | | -// PINS CONFIG // |
3 | | -//========================================================================================================================// |
4 | | -// |
5 | | -// You have 3 options to setup the pins (gpio numbers) and busses for the flight controller: |
6 | | -// |
7 | | -// 1) Default - #include <madflight_board.h> and see https://madflight.com for default pinout diagrams for the supported |
8 | | -// processor families. Default pinouts are defined in the board header files library/madflight/src/madflight_board_XXX.h |
9 | | -// |
10 | | -// 2) Header - #include the BetaFlight flight controller you want to use. See library/madflight/src for all available |
11 | | -// boards. For example: #include <madflight_zzz_MTKS-MATEKH743.h> |
12 | | -// |
13 | | -// 3) Custom - Do not include a board file here, and set your own board definition in the CUSTOM PINS section below. |
14 | | -// |
15 | | -//========================================================================================================================// |
16 | | - |
17 | | -#include <madflight_board.h> |
| 1 | +/*======================================================================================================================== |
| 2 | + MADFLIGHT CONFIG |
| 3 | +========================================================================================================================== |
18 | 4 |
|
| 5 | +MADFLIGHT_CONFIG is a multi-line raw string in with a key-value list. Anything after '#' or '/' is ignored as comment. |
19 | 6 |
|
20 | | -//========================================================================================================================// |
21 | | -// HARDWARE CONFIG // |
22 | | -//========================================================================================================================// |
23 | | -// |
24 | | -// Hardware configuration is a raw string with a key-value list. On a line, anything after '#' or '/' is ignored as comment |
25 | | -// |
26 | | -// You can also set these values from the CLI, for example "set imu_gizmo MPU6500" |
27 | | -// |
28 | | -//========================================================================================================================// |
29 | | - |
30 | | -#define MADFLIGHT_CONFIG R""( |
| 7 | +You have 4 options to setup the pins (gpio numbers) and serial/spi/i2c busses for the flight controller: |
31 | 8 |
|
32 | | -// IMU - Inertial Measurement Unit (acc/gyro) |
| 9 | + 1) Default - #include <madflight_board.h> and see https://madflight.com for default pinout diagrams for the supported |
| 10 | + processor families. Default pinouts are defined in the board header files library/madflight/src/madflight_board_XXX.h |
| 11 | + Leave lines with "pin_..." and "..._bus" commented in MADFLIGHT_CONFIG. |
| 12 | + |
| 13 | + 2) BetaFlight - #include the BetaFlight flight controller you want to use. See library/madflight/src for all available |
| 14 | + boards. For example: #include <madflight_zzz_MTKS-MATEKH743.h> |
33 | 15 |
|
34 | | -// Uncomment ONE bus: SPI or I2C |
35 | | -imu_spi_bus 0 // connect IMU to SPI bus 0 |
36 | | -//imu_i2c_bus 1 // connect IMU to I2C bus 1 |
| 16 | + 3) Override - Keep #include <madflight_board.h>, and uncomment lines in MADFLIGHT_CONFIG to override the board settings. |
| 17 | + |
| 18 | + 4) Custom - Remove #include <madflight_board.h>, and set the full configuration in MADFLIGHT_CONFIG below. |
37 | 19 |
|
38 | | -// IMPORTANT: the IMU sensor should be the ONLY sensor on the selected bus |
| 20 | +Pins and busses use zero-based numbering, i.e. imu_spi_bus 0 is the first spi bus. Use -1 to disable a pin or bus. |
39 | 21 |
|
40 | | -imu_gizmo NONE // options: NONE, BMI270, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250 |
41 | | -imu_align CW90 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP |
42 | | -imu_i2c_adr 0 // enter decimal i2c address, not hex (use 0 for default i2c address) |
| 22 | +You can also modify the configuration from the CLI, for example "set imu_gizmo MPU6500" or "set imu_spi_bus 1", then |
| 23 | +use "cwrite" to save the config to eeprom and reboot to use the new config. |
43 | 24 |
|
44 | | -// RCL - Remote Controller Link |
45 | | -rcl_gizmo NONE // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM, PWM |
46 | | -rcl_num_ch 8 // number of channels |
47 | | -rcl_deadband 0 // center stick deadband |
| 25 | +If things do not work as expected, have a good look at the startup messages! |
48 | 26 |
|
49 | | -// BAR - Barometer |
50 | | -bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611 |
51 | | -bar_i2c_adr 0 |
| 27 | +========================================================================================================================*/ |
52 | 28 |
|
53 | | -// MAG - Magnetometer |
54 | | -mag_gizmo NONE // options: NONE, QMC5883 |
55 | | -mag_i2c_adr 0 |
| 29 | +#include <madflight_board.h> |
56 | 30 |
|
57 | | -// BAT - Battery Monitor |
58 | | -bat_gizmo NONE // options: NONE, ADC, INA226, INA228 |
59 | | -bat_i2c_adr 0 |
| 31 | +#define MADFLIGHT_CONFIG R""( |
60 | 32 |
|
61 | | -// GPS |
62 | | -gps_gizmo NONE // options: NONE, UBLOX |
63 | | -gps_baud 0 // use 0 for auto baud |
| 33 | +//--- IMU --- Inertial Measurement Unit (use spi -OR- i2c bus) |
| 34 | +imu_gizmo MPU6500 // options: NONE, BMI270, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250 |
| 35 | +imu_bus_type SPI // options: SPI, I2C (not all combinations of gizmo and bus_type are supported) |
| 36 | +imu_align CW90 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP |
| 37 | +//imu_spi_bus -1 //spi |
| 38 | +//pin_imu_cs -1 //spi |
| 39 | +//pin_imu_int -1 //spi |
| 40 | +//imu_i2c_bus -1 //i2c |
| 41 | +//imu_i2c_adr 0 //i2c: enter decimal i2c address, not hex (use 0 for default i2c address) |
64 | 42 |
|
65 | | -// BBX - Black Box Data Logger |
66 | | -bbx_gizmo NONE // options: NONE, SDSPI, SDMMC |
| 43 | +// IMPORTANT: the IMU sensor should be the ONLY sensor on the selected bus |
67 | 44 |
|
68 | | -// RDR - Radar |
69 | | -rdr_gizmo NONE // options: NONE, LD2411S, LD2413, USD1 |
70 | | -rdr_baud 0 |
71 | 45 |
|
72 | | -// AHR - AHRS |
73 | | -ahr_gizmo MAHONY // options: MAHONY, MAHONY_BF, MADGWICK, VQF |
| 46 | +//--- RCL --- Remote Controller Link (use serial bus -OR- ppm pin) |
| 47 | +rcl_gizmo CRSF // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM |
| 48 | +rcl_num_ch 8 // number of channels |
| 49 | +rcl_deadband 0 // center stick deadband |
| 50 | +//rcl_ser_bus -1 |
| 51 | +//pin_rcl_ppm -1 |
| 52 | + |
| 53 | +//--- BAR --- Barometer |
| 54 | +bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611, HP203B |
| 55 | +//bar_i2c_adr 0 |
| 56 | +//bar_i2c_bus -1 |
| 57 | + |
| 58 | +//--- MAG --- Magnetometer |
| 59 | +mag_gizmo NONE // options: NONE, QMC5883, QMC6309, RM3100 |
| 60 | +//mag_i2c_adr 0 |
| 61 | +//mag_i2c_bus -1 |
| 62 | + |
| 63 | +//--- BAT --- Battery Monitor (use i2c bus -OR- adc pins) |
| 64 | +bat_gizmo NONE // options: NONE, ADC, INA226, INA228 |
| 65 | +//bat_i2c_adr 0 |
| 66 | +//bat_i2c_bus -1 |
| 67 | +//pin_bat_i -1 |
| 68 | +//pin_bat_v -1 |
| 69 | + |
| 70 | +//--- GPS --- |
| 71 | +gps_gizmo NONE // options: NONE, UBLOX |
| 72 | +//gps_baud 0 // use 0 for auto baud |
| 73 | +//gps_ser_bus -1 |
| 74 | + |
| 75 | +//--- BBX --- Black Box Data Logger (use spi -OR- mmc) |
| 76 | +bbx_gizmo NONE // options: NONE, SDSPI, SDMMC |
| 77 | +//pin_bbx_cs -1 // spi |
| 78 | +//bbx_spi_bus -1 // spi |
| 79 | +//pin_mmc_dat -1 // mmc |
| 80 | +//pin_mmc_clk -1 // mmc |
| 81 | +//pin_mmc_cmd -1 // mmc |
| 82 | + |
| 83 | +//--- RDR --- Radar (use serial bus -OR- trig+echo pins) |
| 84 | +rdr_gizmo NONE // options: NONE, LD2411S, LD2413, USD1, SR04 |
| 85 | +//rdr_baud 0 |
| 86 | +//rdr_ser_bus -1 |
| 87 | +//pin_rdr_trig -1 |
| 88 | +//pin_rdr_echo -1 |
| 89 | + |
| 90 | +//--- LED --- |
| 91 | +//led_on LOW_IS_OFF // options: LOW_IS_OFF, LOW_IS_ON |
| 92 | +//pin_led -1 |
| 93 | + |
| 94 | +//--- AHR --- AHRS (keep MAHONY, unless you want to experiment) |
| 95 | +ahr_gizmo MAHONY // options: MAHONY, MAHONY_BF, MADGWICK, VQF |
| 96 | + |
| 97 | +//--- Serial bus 0 --- |
| 98 | +//pin_ser0_rx -1 |
| 99 | +//pin_ser0_tx -1 |
| 100 | + |
| 101 | +//--- Serial bus 1 --- |
| 102 | +//pin_ser1_rx -1 |
| 103 | +//pin_ser1_tx -1 |
| 104 | + |
| 105 | +//--- SPI bus 0 --- |
| 106 | +//pin_spi0_miso -1 |
| 107 | +//pin_spi0_mosi -1 |
| 108 | +//pin_spi0_sclk -1 |
| 109 | + |
| 110 | +//--- SPI bus 1 --- |
| 111 | +//pin_spi1_miso -1 |
| 112 | +//pin_spi1_mosi -1 |
| 113 | +//pin_spi1_sclk -1 |
| 114 | + |
| 115 | +//--- I2C Bus 0 --- |
| 116 | +//pin_i2c0_sda -1 |
| 117 | +//pin_i2c0_scl -1 |
| 118 | + |
| 119 | +//--- I2C Bus 1 --- |
| 120 | +//pin_i2c1_sda -1 |
| 121 | +//pin_i2c1_scl -1 |
| 122 | + |
| 123 | +//--- OUT Pins --- |
| 124 | +//pin_out0 -1 |
| 125 | +//pin_out1 -1 |
| 126 | +//pin_out2 -1 |
| 127 | +//pin_out3 -1 |
| 128 | +//pin_out4 -1 |
| 129 | +//pin_out5 -1 |
| 130 | +//pin_out6 -1 |
| 131 | +//pin_out7 -1 |
| 132 | +//pin_out8 -1 |
| 133 | +//pin_out9 -1 |
| 134 | +//pin_out10 -1 |
| 135 | +//pin_out11 -1 |
| 136 | +//pin_out12 -1 |
| 137 | +//pin_out13 -1 |
| 138 | +//pin_out14 -1 |
| 139 | +//pin_out15 -1 |
74 | 140 |
|
75 | 141 | )"" // End of MADFLIGHT_CONFIG |
76 | 142 |
|
77 | 143 |
|
78 | | -//========================================================================================================================// |
79 | | -// CUSTOM PINS CONFIG // |
80 | | -//========================================================================================================================// |
81 | | - |
82 | | -/* <-- Add a / here to setup your custom pins below - Check datasheet that what you're doing is actually possible!!! |
83 | | -
|
84 | | -#define MADFLIGHT_BOARD R""( |
85 | | -
|
86 | | -// PINOUT |
87 | | -
|
88 | | -// Serial Pins |
89 | | -pin_ser0_rx -1 |
90 | | -pin_ser0_tx -1 |
91 | | -pin_ser0_inv -1 |
92 | | -pin_ser1_rx -1 |
93 | | -pin_ser1_tx -1 |
94 | | -pin_ser1_inv -1 |
95 | | -pin_ser2_rx -1 |
96 | | -pin_ser2_tx -1 |
97 | | -pin_ser2_inv -1 |
98 | | -pin_ser3_rx -1 |
99 | | -pin_ser3_tx -1 |
100 | | -pin_ser3_inv -1 |
101 | | -pin_ser4_rx -1 |
102 | | -pin_ser4_tx -1 |
103 | | -pin_ser4_inv -1 |
104 | | -pin_ser5_rx -1 |
105 | | -pin_ser5_tx -1 |
106 | | -pin_ser5_inv -1 |
107 | | -pin_ser6_rx -1 |
108 | | -pin_ser6_tx -1 |
109 | | -pin_ser6_inv -1 |
110 | | -pin_ser7_rx -1 |
111 | | -pin_ser7_tx -1 |
112 | | -pin_ser7_inv -1 |
113 | | -
|
114 | | -// SPI Pins |
115 | | -pin_spi0_miso -1 |
116 | | -pin_spi0_mosi -1 |
117 | | -pin_spi0_sclk -1 |
118 | | -pin_spi1_miso -1 |
119 | | -pin_spi1_mosi -1 |
120 | | -pin_spi1_sclk -1 |
121 | | -pin_spi2_miso -1 |
122 | | -pin_spi2_mosi -1 |
123 | | -pin_spi2_sclk -1 |
124 | | -pin_spi3_miso -1 |
125 | | -pin_spi3_mosi -1 |
126 | | -pin_spi3_sclk -1 |
127 | | -
|
128 | | -// I2C Pins |
129 | | -pin_i2c0_sda -1 |
130 | | -pin_i2c0_scl -1 |
131 | | -pin_i2c1_sda -1 |
132 | | -pin_i2c1_scl -1 |
133 | | -pin_i2c2_sda -1 |
134 | | -pin_i2c2_scl -1 |
135 | | -pin_i2c3_sda -1 |
136 | | -pin_i2c3_scl -1 |
137 | | -
|
138 | | -// OUT Pins |
139 | | -pin_out0 -1 |
140 | | -pin_out1 -1 |
141 | | -pin_out2 -1 |
142 | | -pin_out3 -1 |
143 | | -pin_out4 -1 |
144 | | -pin_out5 -1 |
145 | | -pin_out6 -1 |
146 | | -pin_out7 -1 |
147 | | -pin_out8 -1 |
148 | | -pin_out9 -1 |
149 | | -pin_out10 -1 |
150 | | -pin_out11 -1 |
151 | | -pin_out12 -1 |
152 | | -pin_out13 -1 |
153 | | -pin_out14 -1 |
154 | | -pin_out15 -1 |
155 | | -
|
156 | | -// Other Pins |
157 | | -pin_bat_i -1 |
158 | | -pin_bat_v -1 |
159 | | -pin_bbx_cs -1 |
160 | | -pin_imu_cs -1 |
161 | | -pin_imu_int -1 |
162 | | -pin_led -1 |
163 | | -led_on LOW_IS_ON |
164 | | -pin_mmc_dat -1 |
165 | | -pin_mmc_clk -1 |
166 | | -pin_mmc_cmd -1 |
167 | | -pin_rcl_ppm -1 |
168 | | -
|
169 | | -// BUSSES |
170 | | -
|
171 | | -// Serial Busses |
172 | | -rcl_ser_bus -1 |
173 | | -gps_ser_bus -1 |
174 | | -rdr_ser_bus -1 |
175 | | -
|
176 | | -// SPI Busses |
177 | | -imu_spi_bus -1 |
178 | | -bbx_spi_bus -1 |
179 | | -
|
180 | | -// I2C Busses |
181 | | -bar_i2c_bus -1 |
182 | | -mag_i2c_bus -1 |
183 | | -bat_i2c_bus -1 |
184 | | -imu_i2c_bus -1 |
185 | | -
|
186 | | -)"" // end of MADFLIGHT_BOARD */ |
187 | | - |
188 | 144 | //========================================================================================================================// |
189 | 145 | // COMPILER OPTIONS // |
190 | 146 | //========================================================================================================================// |
|
0 commit comments