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

drivers/ bmx055 : Expose Configurations to Kconfig #13998

Merged
merged 2 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ rsource "Kconfig.net"

menu "Sensor Device Drivers"
rsource "ads101x/Kconfig"
rsource "bmx055/Kconfig"
rsource "fxos8700/Kconfig"
rsource "hdc1000/Kconfig"
rsource "mag3110/Kconfig"
Expand Down
42 changes: 42 additions & 0 deletions drivers/bmx055/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright (c) 2020 Freie Universitaet Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
menuconfig KCONFIG_MODULE_BMX055
bool "Configure BMX055 driver"
depends on MODULE_BMX055
help
Configure the BMX055 driver using Kconfig.

if KCONFIG_MODULE_BMX055

config BMX055_MAG_ADDR_DEFAULT
hex "I2C Address of magnetometer"
range 0x10 0x13
default 0x10
help
The address depends on the state of SDO1, SDO2 and CSB3 pins.
For more information refer to the section 'Inter-Integrated
Circuit (I²C)' in the datasheet.

config BMX055_ACC_ADDR_DEFAULT
hex "I2C Address of accelerometer"
range 0x18 0x19
default 0x18
help
The address depends on the state of SDO1, SDO2 and CSB3 pins.
For more information refer to the section 'Inter-Integrated
Circuit (I²C)' in the datasheet.

config BMX055_GYRO_ADDR_DEFAULT
hex "I2C Address of gyroscope"
range 0x68 0x69
default 0x68
help
The address depends on the state of SDO1, SDO2 and CSB3 pins.
For more information refer to the section 'Inter-Integrated
Circuit (I²C)' in the datasheet.

endif # KCONFIG_MODULE_BMX055
6 changes: 3 additions & 3 deletions drivers/bmx055/include/bmx055_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ extern "C" {
#define BMX055_PARAM_I2C I2C_DEV(0)
#endif
#ifndef BMX055_PARAM_MAG_ADDR
#define BMX055_PARAM_MAG_ADDR BMX055_MAG_ADDR_DEFAULT
#define BMX055_PARAM_MAG_ADDR CONFIG_BMX055_MAG_ADDR_DEFAULT
#endif
#ifndef BMX055_PARAM_ACC_ADDR
#define BMX055_PARAM_ACC_ADDR BMX055_ACC_ADDR_DEFAULT
#define BMX055_PARAM_ACC_ADDR CONFIG_BMX055_ACC_ADDR_DEFAULT
#endif
#ifndef BMX055_PARAM_GYRO_ADDR
#define BMX055_PARAM_GYRO_ADDR BMX055_GYRO_ADDR_DEFAULT
#define BMX055_PARAM_GYRO_ADDR CONFIG_BMX055_GYRO_ADDR_DEFAULT
#endif
#ifndef BMX055_PARAM_INT1
#define BMX055_PARAM_INT1 GPIO_PIN(0, 0)
Expand Down
27 changes: 15 additions & 12 deletions drivers/include/bmx055.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,34 @@ extern "C" {
/**
* @brief Magnetometer default address
*
* The address depends on part number of SDO1, SDO2 and CSB3.
* For more information on SerialBus Address, refer section 11.2 in datasheet.
* The address depends on the state of SDO1, SDO2 and CSB3 pins.
* For more information refer to the section 'Inter-Integrated
* Circuit (I²C)' in the datasheet.
*/
#ifndef BMX055_MAG_ADDR_DEFAULT
#define BMX055_MAG_ADDR_DEFAULT (0x10U)
#ifndef CONFIG_BMX055_MAG_ADDR_DEFAULT
#define CONFIG_BMX055_MAG_ADDR_DEFAULT (0x10U)
#endif

/**
* @brief Accelerometer default address
*
* The address depends on part number of SDO1, SDO2 and CSB3.
* For more information on SerialBus Address, refer section 11.2 in datasheet.
* The address depends on the state of SDO1, SDO2 and CSB3 pins.
* For more information refer to the section 'Inter-Integrated
* Circuit (I²C)' in the datasheet.
*/
#ifndef BMX055_ACC_ADDR_DEFAULT
#define BMX055_ACC_ADDR_DEFAULT (0x18U)
#ifndef CONFIG_BMX055_ACC_ADDR_DEFAULT
#define CONFIG_BMX055_ACC_ADDR_DEFAULT (0x18U)
#endif

/**
* @brief Gyroscope default address
*
* The address depends on part number of SDO1, SDO2 and CSB3.
* For more information on SerialBus Address, refer section 11.2 in datasheet.
* The address depends on the state of SDO1, SDO2 and CSB3 pins.
* For more information refer to the section 'Inter-Integrated
* Circuit (I²C)' in the datasheet.
*/
#ifndef BMX055_GYRO_ADDR_DEFAULT
#define BMX055_GYRO_ADDR_DEFAULT (0x68U)
#ifndef CONFIG_BMX055_GYRO_ADDR_DEFAULT
#define CONFIG_BMX055_GYRO_ADDR_DEFAULT (0x68U)
#endif
/** @} */

Expand Down