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/mma8x5x : Expose Configurations to Kconfig #13926

Merged
merged 2 commits into from
Apr 23, 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.net
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ endmenu # Network Device Drivers
menu "Sensor Device Drivers"
rsource "ads101x/Kconfig"
rsource "hdc1000/Kconfig"
rsource "mma8x5x/Kconfig"
endmenu # Sensor Device Drivers
4 changes: 2 additions & 2 deletions drivers/include/mma8x5x.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ extern "C" {
* The address value depends on the state of SA0 Address Pin in the case of MMA845x series.
* For more details refer Table 1 in datasheet (MMA8451Q/MMA8452Q/MMA8453Q)
*/
#ifndef MMA8X5X_I2C_ADDRESS
#define MMA8X5X_I2C_ADDRESS 0x1D
#ifndef CONFIG_MMA8X5X_I2C_ADDRESS
#define CONFIG_MMA8X5X_I2C_ADDRESS 0x1D
#endif
/** @} */

Expand Down
26 changes: 26 additions & 0 deletions drivers/mma8x5x/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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_MMA8X5X
bool "Configure MMA8X5X driver"
depends on MODULE_MMA8X5X
help
Configure the MMA8X5X driver using Kconfig.

if KCONFIG_MODULE_MMA8X5X

config MMA8X5X_I2C_ADDRESS
hex "Default I2C address"
range 0x1C 0x1D
default 0x1D
help
The address value depends on the state of SA0 Address Pin
in the case of MMA845x series sensors.
For more details refer Table 1 in datasheet
(MMA8451Q/MMA8452Q/MMA8453Q)
Default value corresponds to SA0 connected to VCC.

endif # KCONFIG_MODULE_MMA8X5X
2 changes: 1 addition & 1 deletion drivers/mma8x5x/include/mma8x5x_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extern "C" {
#define MMA8X5X_PARAM_I2C (I2C_DEV(0))
#endif
#ifndef MMA8X5X_PARAM_ADDR
#define MMA8X5X_PARAM_ADDR (MMA8X5X_I2C_ADDRESS)
#define MMA8X5X_PARAM_ADDR (CONFIG_MMA8X5X_I2C_ADDRESS)
#endif
#ifndef MMA8X5X_PARAM_RATE
#define MMA8X5X_PARAM_RATE (MMA8X5X_RATE_200HZ)
Expand Down