Skip to content

Commit

Permalink
Merge pull request #14000 from akshaim/Kconfig_lpsxxx
Browse files Browse the repository at this point in the history
drivers/lpsxxx : Expose Configurations to Kconfig
  • Loading branch information
leandrolanzieri authored May 5, 2020
2 parents 1fe30c1 + a084383 commit 28eedd6
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
1 change: 1 addition & 0 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ rsource "ads101x/Kconfig"
rsource "bmx055/Kconfig"
rsource "fxos8700/Kconfig"
rsource "hdc1000/Kconfig"
rsource "lpsxxx/Kconfig"
rsource "mag3110/Kconfig"
rsource "mma8x5x/Kconfig"
rsource "opt3001/Kconfig"
Expand Down
11 changes: 6 additions & 5 deletions drivers/include/lpsxxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ extern "C" {
/**
* @brief The sensors default I2C address
*
* Default address corresponds to SDO/SA0 pad connected to ground. If SDO/SA0
* pad is connected to power supply, I2C address is 0x5C.
* Refer to 'I2C Operation' section on the datasheet
* The address depends on the status of SDO/SA0 Pin. Default
* address corresponds to SDO/SA0 connected to VDD. For more
* information refer to the section 'I2C operation' in the
* datasheet.
*/
#ifndef LPSXXX_DEFAULT_ADDRESS
#define LPSXXX_DEFAULT_ADDRESS (0x5d)
#ifndef CONFIG_LPSXXX_DEFAULT_ADDRESS
#define CONFIG_LPSXXX_DEFAULT_ADDRESS (0x5d)
#endif
/** @} */

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

if KCONFIG_MODULE_LPSXXX

config LPSXXX_DEFAULT_ADDRESS
hex "Default I2C address"
range 0x5c 0x5d
default 0x5d
help
The address depends on the status of SDO/SA0 Pin. Default
address corresponds to SDO/SA0 connected to VDD. For more
information refer to the section 'I2C operation' in the
datasheet.

endif # KCONFIG_MODULE_LPSXXX
2 changes: 1 addition & 1 deletion drivers/lpsxxx/include/lpsxxx_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern "C" {
#define LPSXXX_PARAM_I2C I2C_DEV(0)
#endif
#ifndef LPSXXX_PARAM_ADDR
#define LPSXXX_PARAM_ADDR (LPSXXX_DEFAULT_ADDRESS)
#define LPSXXX_PARAM_ADDR (CONFIG_LPSXXX_DEFAULT_ADDRESS)
#endif
#ifndef LPSXXX_PARAM_RATE
#define LPSXXX_PARAM_RATE (LPSXXX_DEFAULT_RATE)
Expand Down

0 comments on commit 28eedd6

Please sign in to comment.