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

[RFC] Board config: SPI & I2C config simplifications #14156

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion boards/emlid/navio2/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ px4_add_board(
distance_sensor # all available distance sensor drivers
gps
#imu # all available imu drivers
imu/mpu9250
#imu/mpu9250
imu/st/lsm9ds1
linux_pwm_out
#magnetometer # all available magnetometer drivers
Expand Down
2 changes: 1 addition & 1 deletion boards/emlid/navio2/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
############################################################################

add_library(drivers_board
empty.c
spi.cpp
)
10 changes: 5 additions & 5 deletions boards/emlid/navio2/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@


// SPI
#define PX4_SPI_BUS_SENSORS 0
#define PX4_SPIDEV_UBLOX PX4_MK_SPI_SEL(PX4_SPI_BUS_SENSORS, 0) // spidev0.0 - ublox m8n
#define PX4_SPIDEV_MPU PX4_MK_SPI_SEL(PX4_SPI_BUS_SENSORS, 1) // spidev0.1 - mpu9250
#define PX4_SPIDEV_LSM9DS1_M PX4_MK_SPI_SEL(PX4_SPI_BUS_SENSORS, 2) // spidev0.2 - lsm9ds1 mag
#define PX4_SPIDEV_LSM9DS1_AG PX4_MK_SPI_SEL(PX4_SPI_BUS_SENSORS, 3) // spidev0.3 - lsm9ds1 accel/gyro
//#define PX4_SPI_BUS_SENSORS 0
//#define PX4_SPIDEV_UBLOX PX4_MK_SPI_SEL(PX4_SPI_BUS_SENSORS, 0) // spidev0.0 - ublox m8n
//#define PX4_SPIDEV_MPU PX4_MK_SPI_SEL(PX4_SPI_BUS_SENSORS, 1) // spidev0.1 - mpu9250
//#define PX4_SPIDEV_LSM9DS1_M PX4_MK_SPI_SEL(PX4_SPI_BUS_SENSORS, 2) // spidev0.2 - lsm9ds1 mag
//#define PX4_SPIDEV_LSM9DS1_AG PX4_MK_SPI_SEL(PX4_SPI_BUS_SENSORS, 3) // spidev0.3 - lsm9ds1 accel/gyro


// ADC channels:
Expand Down
Empty file removed boards/emlid/navio2/src/empty.c
Empty file.
44 changes: 44 additions & 0 deletions boards/emlid/navio2/src/spi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/****************************************************************************
*
* Copyright (C) 2020 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/

#include <px4_arch/spi_hw_description.h>
#include <drivers/drv_sensor.h>

constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = {
initSPIBus(0, {
// spidev0.0 - ublox m8n
initSPIDevice(DRV_GYR_DEVTYPE_MPU9250, 1),
initSPIDevice(DRV_MAG_DEVTYPE_ST_LSM9DS1_M, 2),
initSPIDevice(DRV_IMU_DEVTYPE_ST_LSM9DS1_AG, 3),
}),
};
40 changes: 20 additions & 20 deletions boards/px4/fmu-v3/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,35 @@ px4_add_board(
TEL4:/dev/ttyS6
DRIVERS
adc
barometer # all available barometer drivers
batt_smbus
barometer/ms5611 # all available barometer drivers
#batt_smbus
camera_capture
camera_trigger
differential_pressure # all available differential pressure drivers
distance_sensor # all available distance sensor drivers
#differential_pressure # all available differential pressure drivers
#distance_sensor # all available distance sensor drivers
dshot
gps
#heater
#imu # all available imu drivers
imu/adis16448
imu/adis16477
imu/adis16497
imu/l3gd20
imu/lsm303d
#imu/adis16448
#imu/adis16477
#imu/adis16497
#imu/l3gd20
#imu/lsm303d
imu/mpu6000
imu/mpu9250
imu/icm20948
irlock
lights/blinkm
lights/rgbled
lights/rgbled_ncp5623c
#imu/mpu9250
#imu/icm20948
#irlock
#lights/blinkm
#lights/rgbled
#lights/rgbled_ncp5623c
#lights/rgbled_pwm
magnetometer # all available magnetometer drivers
#magnetometer # all available magnetometer drivers
mkblctrl
#optical_flow # all available optical flow drivers
optical_flow/px4flow
#optical_flow/px4flow
#osd
pca9685
#pca9685
#power_monitor/ina226
#protocol_splitter
pwm_input
Expand All @@ -56,7 +56,7 @@ px4_add_board(
px4io
roboclaw
tap_esc
telemetry # all available telemetry drivers
#telemetry # all available telemetry drivers
test_ppm
tone_alarm
uavcan
Expand Down Expand Up @@ -110,7 +110,7 @@ px4_add_board(
reflect
sd_bench
shutdown
tests # tests and test runner
#tests # tests and test runner
top
topic_listener
tune_control
Expand Down
4 changes: 2 additions & 2 deletions boards/px4/fmu-v3/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

add_library(drivers_board
can.c
i2c.c
i2c.cpp
init.c
led.c
spi.c
spi.cpp
timer_config.cpp
usb.c
manifest.c
Expand Down
Loading