vtx: fix VTX_SETTINGS_POWER_COUNT and add dummy entries to saPowerNames
[inav.git] / src / main / target / common_hardware.c
blob0169e8099bfc0e57f7e57b37070b6cb64e548995
1 /*
2 * This file is part of INAV.
4 * INAV is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * INAV is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with INAV. If not, see <http://www.gnu.org/licenses/>.
18 #include <platform.h>
19 #include "drivers/io.h"
20 #include "drivers/bus.h"
21 #include "drivers/sensor.h"
23 #if !defined(USE_TARGET_HARDWARE_DESCRIPTORS)
25 /** IMU **/
26 #if !defined(USE_TARGET_IMU_HARDWARE_DESCRIPTORS)
28 #if !defined(MPU_ADDRESS)
29 #define MPU_ADDRESS 0x68
30 #endif
32 #if defined(USE_IMU_MPU6000)
33 BUSDEV_REGISTER_SPI(busdev_mpu6000, DEVHW_MPU6000, MPU6000_SPI_BUS, MPU6000_CS_PIN, NONE, DEVFLAGS_NONE, IMU_MPU6000_ALIGN);
34 #endif
36 #if defined(USE_IMU_MPU6500)
37 #if defined(MPU6500_SPI_BUS)
38 BUSDEV_REGISTER_SPI(busdev_mpu6500, DEVHW_MPU6500, MPU6500_SPI_BUS, MPU6500_CS_PIN, NONE, DEVFLAGS_NONE, IMU_MPU6500_ALIGN);
39 #elif defined(MPU6500_I2C_BUS)
40 BUSDEV_REGISTER_I2C(busdev_mpu6500, DEVHW_MPU6500, MPU6500_I2C_BUS, MPU_ADDRESS, NONE, DEVFLAGS_NONE, IMU_MPU6500_ALIGN);
41 #endif
42 #endif
44 #if defined(USE_IMU_MPU9250)
45 #if defined(MPU9250_SPI_BUS)
46 BUSDEV_REGISTER_SPI(busdev_mpu9250, DEVHW_MPU9250, MPU9250_SPI_BUS, MPU9250_CS_PIN, NONE, DEVFLAGS_NONE, IMU_MPU9250_ALIGN);
47 #elif defined(MPU9250_I2C_BUS)
48 BUSDEV_REGISTER_I2C(busdev_mpu9250, DEVHW_MPU9250, MPU9250_I2C_BUS, MPU_ADDRESS, NONE, DEVFLAGS_NONE, IMU_MPU9250_ALIGN);
49 #endif
50 #endif
52 #if defined(USE_IMU_ICM20689)
53 BUSDEV_REGISTER_SPI(busdev_icm20689, DEVHW_ICM20689, ICM20689_SPI_BUS, ICM20689_CS_PIN, NONE, DEVFLAGS_NONE, IMU_ICM20689_ALIGN);
54 #endif
56 #if defined(USE_IMU_ICM42605)
57 BUSDEV_REGISTER_SPI(busdev_icm42605, DEVHW_ICM42605, ICM42605_SPI_BUS, ICM42605_CS_PIN, NONE, DEVFLAGS_NONE, IMU_ICM42605_ALIGN);
58 #endif
60 #if defined(USE_IMU_BMI160)
61 #if defined(BMI160_SPI_BUS)
62 BUSDEV_REGISTER_SPI(busdev_bmi160, DEVHW_BMI160, BMI160_SPI_BUS, BMI160_CS_PIN, NONE, DEVFLAGS_NONE, IMU_BMI160_ALIGN);
63 #elif defined(BMI160_I2C_BUS)
64 BUSDEV_REGISTER_I2C(busdev_bmi160, DEVHW_BMI160, BMI160_I2C_BUS, 0x68, NONE, DEVFLAGS_NONE, IMU_BMI160_ALIGN);
65 #endif
66 #endif
68 #if defined(USE_IMU_BMI088)
69 #if defined(BMI088_SPI_BUS)
70 BUSDEV_REGISTER_SPI(busdev_bmi088_gyro, DEVHW_BMI088_GYRO, BMI088_SPI_BUS, BMI088_GYRO_CS_PIN, NONE, DEVFLAGS_NONE, IMU_BMI088_ALIGN);
71 BUSDEV_REGISTER_SPI(busdev_bmi088_acc, DEVHW_BMI088_ACC, BMI088_SPI_BUS, BMI088_ACC_CS_PIN, NONE, DEVFLAGS_NONE, IMU_BMI088_ALIGN);
72 #elif defined(BMI088_I2C_BUS)
73 BUSDEV_REGISTER_I2C(busdev_bmi088, DEVHW_BMI088, BMI088_I2C_BUS, 0x68, NONE, DEVFLAGS_NONE, IMU_BMI088_ALIGN);
74 #endif
75 #endif
77 #if defined(USE_IMU_BMI270)
78 BUSDEV_REGISTER_SPI(busdev_bmi270, DEVHW_BMI270, BMI270_SPI_BUS, BMI270_CS_PIN, NONE, DEVFLAGS_NONE, IMU_BMI270_ALIGN);
79 #endif
81 #if defined(USE_IMU_LSM6DXX)
82 BUSDEV_REGISTER_SPI(busdev_lsm6dxx, DEVHW_LSM6D, LSM6DXX_SPI_BUS, LSM6DXX_CS_PIN, NONE, DEVFLAGS_NONE, IMU_LSM6DXX_ALIGN);
83 #endif
85 #endif
88 /** BAROMETERS **/
90 #if defined(USE_BARO_BMP085)
91 #if !defined(BMP085_I2C_BUS)
92 #define BMP085_I2C_BUS BARO_I2C_BUS
93 #endif
94 #if !defined(BMP085_I2C_ADDR)
95 #define BMP085_I2C_ADDR (0x77)
96 #endif
97 BUSDEV_REGISTER_I2C(busdev_bmp085, DEVHW_BMP085, BMP085_I2C_BUS, BMP085_I2C_ADDR, NONE, DEVFLAGS_NONE, 0);
98 #endif
100 #if defined(USE_BARO_BMP280)
101 #if defined(BMP280_SPI_BUS)
102 BUSDEV_REGISTER_SPI(busdev_bmp280, DEVHW_BMP280, BMP280_SPI_BUS, BMP280_CS_PIN, NONE, DEVFLAGS_NONE, 0);
103 #elif defined(BMP280_I2C_BUS) || defined(BARO_I2C_BUS)
104 #if !defined(BMP280_I2C_BUS)
105 #define BMP280_I2C_BUS BARO_I2C_BUS
106 #endif
107 #if !defined(BMP280_I2C_ADDR)
108 #define BMP280_I2C_ADDR (0x76)
109 #endif
110 BUSDEV_REGISTER_I2C(busdev_bmp280, DEVHW_BMP280, BMP280_I2C_BUS, BMP280_I2C_ADDR, NONE, DEVFLAGS_NONE, 0);
111 #endif
112 #endif
114 #if defined(USE_BARO_BMP388)
115 #if defined(BMP388_SPI_BUS)
116 BUSDEV_REGISTER_SPI(busdev_bmp388, DEVHW_BMP388, BMP388_SPI_BUS, BMP388_CS_PIN, NONE, DEVFLAGS_NONE, 0);
117 #elif defined(BMP388_I2C_BUS) || defined(BARO_I2C_BUS)
118 #if !defined(BMP388_I2C_BUS)
119 #define BMP388_I2C_BUS BARO_I2C_BUS
120 #endif
121 #if !defined(BMP388_I2C_ADDR)
122 #define BMP388_I2C_ADDR (0x76)
123 #endif
124 BUSDEV_REGISTER_I2C(busdev_bmp388, DEVHW_BMP388, BMP388_I2C_BUS, BMP388_I2C_ADDR, NONE, DEVFLAGS_NONE, 0);
125 #endif
126 #endif
128 #if defined(USE_BARO_SPL06)
129 #if defined(SPL06_SPI_BUS)
130 BUSDEV_REGISTER_SPI(busdev_spl06, DEVHW_SPL06, SPL06_SPI_BUS, SPL06_CS_PIN, NONE, DEVFLAGS_NONE, 0);
131 #elif defined(SPL06_I2C_BUS) || defined(BARO_I2C_BUS)
132 #if !defined(SPL06_I2C_BUS)
133 #define SPL06_I2C_BUS BARO_I2C_BUS
134 #endif
135 #if !defined(SPL06_I2C_ADDR)
136 #define SPL06_I2C_ADDR (0x76)
137 #endif
138 BUSDEV_REGISTER_I2C(busdev_spl06, DEVHW_SPL06, SPL06_I2C_BUS, SPL06_I2C_ADDR, NONE, DEVFLAGS_NONE, 0);
139 #endif
140 #endif
142 #if defined(USE_BARO_LPS25H)
143 #if defined(LPS25H_SPI_BUS)
144 BUSDEV_REGISTER_SPI(busdev_lps25h, DEVHW_LPS25H, LPS25H_SPI_BUS, LPS25H_CS_PIN, NONE, DEVFLAGS_NONE, 0);
145 #endif
146 #endif
148 #if defined(USE_BARO_MS5607)
149 #if !defined(MS5607_I2C_BUS)
150 #define MS5607_I2C_BUS BARO_I2C_BUS
151 #endif
152 #if !defined(MS5607_I2C_ADDR)
153 #define MS5607_I2C_ADDR (0x77)
154 #endif
155 BUSDEV_REGISTER_I2C(busdev_ms5607, DEVHW_MS5607, MS5607_I2C_BUS, MS5607_I2C_ADDR, NONE, DEVFLAGS_USE_RAW_REGISTERS, 0);
156 #endif
158 #if defined(USE_BARO_MS5611)
159 #if defined(MS5611_SPI_BUS)
160 BUSDEV_REGISTER_SPI(busdev_ms5611, DEVHW_MS5611, MS5611_SPI_BUS, MS5611_CS_PIN, NONE, DEVFLAGS_USE_RAW_REGISTERS, 0);
161 #elif defined(MS5611_I2C_BUS) || defined(BARO_I2C_BUS)
162 #if !defined(MS5611_I2C_BUS)
163 #define MS5611_I2C_BUS BARO_I2C_BUS
164 #endif
165 #if !defined(MS5611_I2C_ADDR)
166 #define MS5611_I2C_ADDR (0x77)
167 #endif
168 BUSDEV_REGISTER_I2C(busdev_ms5611, DEVHW_MS5611, MS5611_I2C_BUS, MS5611_I2C_ADDR, NONE, DEVFLAGS_USE_RAW_REGISTERS, 0);
169 #endif
170 #endif
172 #if defined(USE_BARO_DPS310)
173 #if defined(DPS310_SPI_BUS)
174 BUSDEV_REGISTER_SPI(busdev_dps310, DEVHW_DPS310, DPS310_SPI_BUS, DPS310_CS_PIN, NONE, DEVFLAGS_NONE, 0);
175 #elif defined(DPS310_I2C_BUS) || defined(BARO_I2C_BUS)
176 #if !defined(DPS310_I2C_BUS)
177 #define DPS310_I2C_BUS BARO_I2C_BUS
178 #endif
179 #if !defined(DPS310_I2C_ADDR)
180 #define DPS310_I2C_ADDR (0x76)
181 #endif
182 BUSDEV_REGISTER_I2C(busdev_dps310, DEVHW_DPS310, DPS310_I2C_BUS, DPS310_I2C_ADDR, NONE, DEVFLAGS_NONE, 0);
183 #endif
184 #endif
186 #if defined(USE_BARO_B2SMPB)
187 #if defined(B2SMPB_SPI_BUS)
188 BUSDEV_REGISTER_SPI(busdev_b2smpb, DEVHW_B2SMPB, B2SMPB_SPI_BUS, B2SMPB_CS_PIN, NONE, DEVFLAGS_NONE, 0);
189 #elif defined(B2SMPB_I2C_BUS) || defined(BARO_I2C_BUS)
190 #if !defined(B2SMPB_I2C_BUS)
191 #define B2SMPB_I2C_BUS BARO_I2C_BUS
192 #endif
193 #if !defined(B2SMPB_I2C_ADDR)
194 #define B2SMPB_I2C_ADDR (0x70)
195 #endif
196 BUSDEV_REGISTER_I2C(busdev_b2smpb, DEVHW_B2SMPB, B2SMPB_I2C_BUS, B2SMPB_I2C_ADDR, NONE, DEVFLAGS_NONE, 0);
197 #endif
198 #endif
200 /** COMPASS SENSORS **/
201 #if !defined(USE_TARGET_MAG_HARDWARE_DESCRIPTORS)
202 #if defined(USE_MAG_HMC5883)
203 #if !defined(HMC5883_I2C_BUS)
204 #define HMC5883_I2C_BUS MAG_I2C_BUS
205 #endif
206 BUSDEV_REGISTER_I2C(busdev_hmc5883, DEVHW_HMC5883, HMC5883_I2C_BUS, 0x1E, NONE, DEVFLAGS_NONE, 0);
207 #endif
209 #if defined(USE_MAG_QMC5883)
210 #if !defined(QMC5883_I2C_BUS)
211 #define QMC5883_I2C_BUS MAG_I2C_BUS
212 #endif
213 BUSDEV_REGISTER_I2C(busdev_qmc5883, DEVHW_QMC5883, QMC5883_I2C_BUS, 0x0D, NONE, DEVFLAGS_NONE, 0);
214 #endif
216 #if defined(USE_MAG_AK8963)
217 #if defined(AK8963_SPI_BUS)
218 BUSDEV_REGISTER_SPI(busdev_ak8963, DEVHW_AK8963, AK8963_SPI_BUS, AK8963_CS_PIN, NONE, DEVFLAGS_NONE, 0);
219 #elif defined(AK8963_I2C_BUS) || defined(MAG_I2C_BUS)
220 #if !defined(AK8963_I2C_BUS)
221 #define AK8963_I2C_BUS MAG_I2C_BUS
222 #endif
223 BUSDEV_REGISTER_I2C(busdev_ak8963, DEVHW_AK8963, AK8963_I2C_BUS, 0x0C, NONE, DEVFLAGS_NONE, 0);
224 #endif
225 #endif
227 #if defined(USE_MAG_AK8975)
228 #if defined(AK8975_SPI_BUS)
229 BUSDEV_REGISTER_SPI(busdev_ak8975, DEVHW_AK8975, AK8975_SPI_BUS, AK8975_CS_PIN, NONE, DEVFLAGS_NONE, 0);
230 #elif defined(AK8975_I2C_BUS) || defined(MAG_I2C_BUS)
231 #if !defined(AK8975_I2C_BUS)
232 #define AK8975_I2C_BUS MAG_I2C_BUS
233 #endif
234 BUSDEV_REGISTER_I2C(busdev_ak8975, DEVHW_AK8975, AK8975_I2C_BUS, 0x0C, NONE, DEVFLAGS_NONE, 0);
235 #endif
236 #endif
238 #if defined(USE_MAG_MAG3110)
239 #if !defined(MAG3110_I2C_BUS)
240 #define MAG3110_I2C_BUS MAG_I2C_BUS
241 #endif
242 BUSDEV_REGISTER_I2C(busdev_mag3110, DEVHW_MAG3110, MAG3110_I2C_BUS, 0x0E, NONE, DEVFLAGS_NONE, 0);
243 #endif
245 #if defined(USE_MAG_LIS3MDL)
246 #if !defined(LIS3MDL_I2C_BUS)
247 #define LIS3MDL_I2C_BUS MAG_I2C_BUS
248 #endif
249 BUSDEV_REGISTER_I2C(busdev_lis3mdl, DEVHW_LIS3MDL, LIS3MDL_I2C_BUS, 0x1E, NONE, DEVFLAGS_NONE, 0);
250 // ST LIS3MDL address can be changed by connecting it's SDO/SA1 pin to either supply or ground.
251 // BUSDEV_REGISTER_I2C(busdev_lis3mdl, DEVHW_LIS3MDL, LIS3MDL_I2C_BUS, 0x1C, NONE, DEVFLAGS_NONE);
252 #endif
254 #if defined(USE_MAG_IST8310)
255 #if !defined(IST8310_I2C_BUS)
256 #define IST8310_I2C_BUS MAG_I2C_BUS
257 #endif
258 BUSDEV_REGISTER_I2C(busdev_ist8310_0, DEVHW_IST8310_0, IST8310_I2C_BUS, 0x0C, NONE, DEVFLAGS_NONE, 0);
259 BUSDEV_REGISTER_I2C(busdev_ist8310_1, DEVHW_IST8310_1, IST8310_I2C_BUS, 0x0E, NONE, DEVFLAGS_NONE, 0);
260 #endif
262 #if defined(USE_MAG_IST8308)
263 #if !defined(IST8308_I2C_BUS)
264 #define IST8308_I2C_BUS MAG_I2C_BUS
265 #endif
266 BUSDEV_REGISTER_I2C(busdev_ist8308, DEVHW_IST8308, IST8308_I2C_BUS, 0x0C, NONE, DEVFLAGS_NONE, 0);
267 #endif
269 #if defined(USE_MAG_RM3100)
270 #if defined(RM3100_SPI_BUS)
271 BUSDEV_REGISTER_SPI(busdev_rm3100, DEVHW_RM3100, RM3100_SPI_BUS, RM3100_CS_PIN, NONE, DEVFLAGS_NONE, 0);
272 #endif
273 #endif
275 #if defined(USE_MAG_VCM5883)
276 #if !defined(VCM5883_I2C_BUS)
277 #define VCM5883_I2C_BUS MAG_I2C_BUS
278 #endif
279 BUSDEV_REGISTER_I2C(busdev_vcm5883, DEVHW_VCM5883, VCM5883_I2C_BUS, 0x0C, NONE, DEVFLAGS_NONE, 0);
280 #endif
282 #if defined(USE_MAG_MLX90393)
283 #if !defined(MLX90393_I2C_BUS)
284 #define MLX90393_I2C_BUS MAG_I2C_BUS
285 #endif
286 BUSDEV_REGISTER_I2C(busdev_mlx90393, DEVHW_MLX90393, MLX90393_I2C_BUS, 0x0C, NONE, DEVFLAGS_NONE, 0);
287 #endif
289 #endif
292 /** 1-Wire IF **/
294 #ifdef USE_1WIRE
296 #if defined(TEMPERATURE_I2C_BUS) && !defined(DS2482_I2C_BUS)
297 #define DS2482_I2C_BUS TEMPERATURE_I2C_BUS
298 #endif
300 #if defined(USE_1WIRE_DS2482) && defined(DS2482_I2C_BUS)
301 BUSDEV_REGISTER_I2C(busdev_ds2482, DEVHW_DS2482, DS2482_I2C_BUS, 0x18, NONE, DEVFLAGS_USE_RAW_REGISTERS, 0);
302 #endif
304 #endif
307 /** TEMP SENSORS **/
309 #if defined(TEMPERATURE_I2C_BUS) && !defined(LM75_I2C_BUS)
310 #define LM75_I2C_BUS TEMPERATURE_I2C_BUS
311 #endif
313 #if defined(USE_TEMPERATURE_LM75) && defined(LM75_I2C_BUS)
314 BUSDEV_REGISTER_I2C(busdev_lm75_0, DEVHW_LM75_0, LM75_I2C_BUS, 0x48, NONE, DEVFLAGS_NONE, 0);
315 BUSDEV_REGISTER_I2C(busdev_lm75_1, DEVHW_LM75_1, LM75_I2C_BUS, 0x49, NONE, DEVFLAGS_NONE, 0);
316 BUSDEV_REGISTER_I2C(busdev_lm75_2, DEVHW_LM75_2, LM75_I2C_BUS, 0x4A, NONE, DEVFLAGS_NONE, 0);
317 BUSDEV_REGISTER_I2C(busdev_lm75_3, DEVHW_LM75_3, LM75_I2C_BUS, 0x4B, NONE, DEVFLAGS_NONE, 0);
318 BUSDEV_REGISTER_I2C(busdev_lm75_4, DEVHW_LM75_4, LM75_I2C_BUS, 0x4C, NONE, DEVFLAGS_NONE, 0);
319 BUSDEV_REGISTER_I2C(busdev_lm75_5, DEVHW_LM75_5, LM75_I2C_BUS, 0x4D, NONE, DEVFLAGS_NONE, 0);
320 BUSDEV_REGISTER_I2C(busdev_lm75_6, DEVHW_LM75_6, LM75_I2C_BUS, 0x4E, NONE, DEVFLAGS_NONE, 0);
321 BUSDEV_REGISTER_I2C(busdev_lm75_7, DEVHW_LM75_7, LM75_I2C_BUS, 0x4F, NONE, DEVFLAGS_NONE, 0);
322 #endif
325 /** RANGEFINDER SENSORS **/
327 #if defined(USE_RANGEFINDER_SRF10)
328 #if !defined(SRF10_I2C_BUS)
329 #define SRF10_I2C_BUS RANGEFINDER_I2C_BUS
330 #endif
331 #if defined(SRF10_I2C_BUS)
332 BUSDEV_REGISTER_I2C(busdev_srf10, DEVHW_SRF10, SRF10_I2C_BUS, 0x70, NONE, DEVFLAGS_NONE, 0);
333 #endif
334 #endif
336 #if defined(USE_RANGEFINDER_VL53L0X)
337 #if !defined(VL53L0X_I2C_BUS) && defined(RANGEFINDER_I2C_BUS)
338 #define VL53L0X_I2C_BUS RANGEFINDER_I2C_BUS
339 #endif
341 #if defined(VL53L0X_I2C_BUS)
342 BUSDEV_REGISTER_I2C(busdev_vl53l0x, DEVHW_VL53L0X, VL53L0X_I2C_BUS, 0x29, NONE, DEVFLAGS_NONE, 0);
343 #endif
344 #endif
346 #if defined(USE_RANGEFINDER_VL53L1X)
347 #if !defined(VL53L1X_I2C_BUS) && defined(RANGEFINDER_I2C_BUS)
348 #define VL53L1X_I2C_BUS RANGEFINDER_I2C_BUS
349 #endif
351 #if defined(VL53L1X_I2C_BUS)
352 BUSDEV_REGISTER_I2C(busdev_vl53l1x, DEVHW_VL53L1X, VL53L1X_I2C_BUS, 0x29, NONE, DEVFLAGS_USE_RAW_REGISTERS, 0);
353 #endif
354 #endif
356 #if defined(USE_RANGEFINDER_US42)
357 #if !defined(US42_I2C_BUS) && defined(RANGEFINDER_I2C_BUS)
358 #define US42_I2C_BUS RANGEFINDER_I2C_BUS
359 #endif
360 #if defined(US42_I2C_BUS)
361 BUSDEV_REGISTER_I2C(busdev_us42, DEVHW_US42, US42_I2C_BUS, 0x70, NONE, DEVFLAGS_USE_RAW_REGISTERS, 0); // Requires null data to passthrough
362 #endif
363 #endif
365 #if defined(USE_RANGEFINDER_TERARANGER_EVO_I2C)
366 #if !defined(TERARANGER_EVO_I2C_BUS) && defined(RANGEFINDER_I2C_BUS)
367 #define TERARANGER_EVO_I2C_BUS RANGEFINDER_I2C_BUS
368 #endif
369 #if defined(TERARANGER_EVO_I2C_BUS)
370 BUSDEV_REGISTER_I2C(busdev_teraranger_evo, DEVHW_TERARANGER_EVO_I2C, TERARANGER_EVO_I2C_BUS, 0x31, NONE, DEVFLAGS_NONE, 0);
371 #endif
372 #endif
374 #if defined(USE_RANGEFINDER_TOF10120_I2C) && (defined(TOF10120_I2C_BUS) || defined(RANGEFINDER_I2C_BUS))
375 #if !defined(TOF10120_I2C_BUS)
376 #define TOF10120_I2C_BUS RANGEFINDER_I2C_BUS
377 #endif
378 #if defined(TOF10120_I2C_BUS)
379 BUSDEV_REGISTER_I2C(busdev_tof10120, DEVHW_TOF10120_I2C, TOF10120_I2C_BUS, 0x52, NONE, DEVFLAGS_USE_RAW_REGISTERS, 0);
380 #endif
381 #endif
383 /** AIRSPEED SENSORS **/
385 #if defined(PITOT_I2C_BUS) && !defined(MS4525_I2C_BUS)
386 #define MS4525_I2C_BUS PITOT_I2C_BUS
387 #endif
389 #if defined(USE_PITOT_MS4525) && defined(MS4525_I2C_BUS)
390 BUSDEV_REGISTER_I2C(busdev_ms4525, DEVHW_MS4525, MS4525_I2C_BUS, 0x28, NONE, DEVFLAGS_USE_RAW_REGISTERS, 0); // Requires 0xFF to passthrough
391 #endif
394 #if defined(PITOT_I2C_BUS) && !defined(DLVR_I2C_BUS)
395 #define DLVR_I2C_BUS PITOT_I2C_BUS
396 #endif
398 #if defined(USE_PITOT_DLVR) && defined(DLVR_I2C_BUS)
399 BUSDEV_REGISTER_I2C(busdev_dlvr, DEVHW_DLVR, DLVR_I2C_BUS, 0x28, NONE, DEVFLAGS_USE_RAW_REGISTERS, 0); // Requires 0xFF to passthrough
400 #endif
402 /** OTHER HARDWARE **/
404 #if defined(USE_MAX7456)
405 BUSDEV_REGISTER_SPI(busdev_max7456, DEVHW_MAX7456, MAX7456_SPI_BUS, MAX7456_CS_PIN, NONE, DEVFLAGS_USE_RAW_REGISTERS | DEVFLAGS_SPI_MODE_0, 0);
406 #endif
408 #if defined(USE_FLASH_M25P16) && defined(M25P16_SPI_BUS)
409 BUSDEV_REGISTER_SPI(busdev_m25p16, DEVHW_M25P16, M25P16_SPI_BUS, M25P16_CS_PIN, NONE, DEVFLAGS_NONE, 0);
410 #endif
412 #if defined(USE_FLASH_W25N01G)
413 BUSDEV_REGISTER_SPI(busdev_w25n01g, DEVHW_W25N01G, W25N01G_SPI_BUS, W25N01G_CS_PIN, NONE, DEVFLAGS_NONE, 0);
414 #endif
416 #if defined(USE_SDCARD) && defined(USE_SDCARD_SPI)
417 BUSDEV_REGISTER_SPI(busdev_sdcard_spi, DEVHW_SDCARD, SDCARD_SPI_BUS, SDCARD_CS_PIN, NONE, DEVFLAGS_SPI_MODE_0, 0);
418 #endif
421 // FIXME(digitalentity): This is unnecessary at the moment as SDIO is not part of BusDevice infrastructure
422 #if defined(USE_SDCARD) && defined(USE_SDCARD_SDIO)
423 BUSDEV_REGISTER_SDIO(busdev_sdcard_sdio,DEVHW_SDCARD, SDCARD_SDIO_BUS, SDCARD_CS_PIN, NONE, DEVFLAGS_USE_MANUAL_DEVICE_SELECT);
424 #endif
427 #if defined(USE_OLED_UG2864)
428 #if !defined(UG2864_I2C_BUS)
429 #define UG2864_I2C_BUS BUS_I2C1
430 #endif
431 BUSDEV_REGISTER_I2C(busdev_ug2864, DEVHW_UG2864, UG2864_I2C_BUS, 0x3C, NONE, DEVFLAGS_NONE, 0);
432 #endif
434 #if defined(USE_IRLOCK) && defined(USE_I2C)
435 #if !defined(IRLOCK_I2C_BUS) && defined(EXTERNAL_I2C_BUS)
436 #define IRLOCK_I2C_BUS EXTERNAL_I2C_BUS
437 #else
438 #define IRLOCK_I2C_BUS BUS_I2C1
439 #endif
440 BUSDEV_REGISTER_I2C(busdev_irlock, DEVHW_IRLOCK, IRLOCK_I2C_BUS, 0x54, NONE, DEVFLAGS_USE_RAW_REGISTERS);
441 #endif
443 #if defined(USE_I2C) && defined(USE_I2C_IO_EXPANDER)
445 #if !defined(PCF8574_I2C_BUS) && defined(EXTERNAL_I2C_BUS)
446 #define PCF8574_I2C_BUS EXTERNAL_I2C_BUS
447 #endif
449 #if !defined(PCF8574_I2C_BUS) && defined(DEFAULT_I2C_BUS)
450 #define PCF8574_I2C_BUS DEFAULT_I2C_BUS
451 #endif
453 #if !defined(PCF8574_I2C_BUS)
454 #define PCF8574_I2C_BUS BUS_I2C1
455 #endif
457 BUSDEV_REGISTER_I2C(busdev_pcf8574, DEVHW_PCF8574, PCF8574_I2C_BUS, 0x20, NONE, DEVFLAGS_NONE, 0);
458 #endif
460 #endif // USE_TARGET_HARDWARE_DESCRIPTORS