From 4cfbe50c0d27211c28750900f3592523cda3be5d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 1 Feb 2016 18:02:56 -0600 Subject: [PATCH] I2C: Fix some compile time issues found with tools/testbuild.sh --- arch | 2 +- drivers/sensors/lis331dl.c | 49 ++++++++++++++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/arch b/arch index 867f8d6f49..af40d03532 160000 --- a/arch +++ b/arch @@ -1 +1 @@ -Subproject commit 867f8d6f49f9bec687e98bfb2bedba81e017e90a +Subproject commit af40d03532135c9010c508336828cd09c3c9b273 diff --git a/drivers/sensors/lis331dl.c b/drivers/sensors/lis331dl.c index c563d53080..f94a3b2ec2 100644 --- a/drivers/sensors/lis331dl.c +++ b/drivers/sensors/lis331dl.c @@ -56,7 +56,7 @@ ****************************************************************************/ #ifndef CONFIG_LIS331DL_I2C_FREQUENCY -# define CONFIG_LIS331DL_I2C_FREQUENCY +# define CONFIG_LIS331DL_I2C_FREQUENCY 100000 #endif /* LIS331DL Internal Registers **********************************************/ @@ -111,7 +111,10 @@ struct lis331dl_dev_s ****************************************************************************/ /**************************************************************************** - * LIS331DL Access with range check + * Name: lis331dl_access + * + * Description: + * LIS331DL Access with range check * * Input Parameters: * dev LIS331 DL Private Structure @@ -128,16 +131,16 @@ struct lis331dl_dev_s static int lis331dl_access(FAR struct lis331dl_dev_s *dev, uint8_t subaddr, FAR uint8_t *buf, int length) { - uint16_t flags = 0; + uint16_t flags; int retval; if (length > 0) { - flags = I2C_M_READ; + flags = I2C_M_READ; } else { - flags = I2C_M_NORESTART; + flags = I2C_M_NORESTART; length = -length; } @@ -210,6 +213,10 @@ static int lis331dl_access(FAR struct lis331dl_dev_s *dev, uint8_t subaddr, return retval; } +/**************************************************************************** + * Name: lis331dl_readregs + ****************************************************************************/ + static int lis331dl_readregs(FAR struct lis331dl_dev_s *dev) { if (lis331dl_access(dev, ST_LIS331DL_CTRL_REG1, &dev->cr1, 3) != 3) @@ -224,6 +231,10 @@ static int lis331dl_readregs(FAR struct lis331dl_dev_s *dev) * Public Functions ****************************************************************************/ +/**************************************************************************** + * Name: lis331dl_init + ****************************************************************************/ + FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_master_s *i2c, uint16_t address) { @@ -285,6 +296,10 @@ FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_master_s *i2c, return NULL; } +/**************************************************************************** + * Name: lis331dl_deinit + ****************************************************************************/ + int lis331dl_deinit(FAR struct lis331dl_dev_s * dev) { ASSERT(dev); @@ -295,6 +310,10 @@ int lis331dl_deinit(FAR struct lis331dl_dev_s * dev) return OK; } +/**************************************************************************** + * Name: lis331dl_powerup + ****************************************************************************/ + int lis331dl_powerup(FAR struct lis331dl_dev_s * dev) { dev->cr1 = ST_LIS331DL_CR1_PD | @@ -310,6 +329,10 @@ int lis331dl_powerup(FAR struct lis331dl_dev_s * dev) return ERROR; } +/**************************************************************************** + * Name: lis331dl_powerdown + ****************************************************************************/ + int lis331dl_powerdown(FAR struct lis331dl_dev_s * dev) { dev->cr1 = ST_LIS331DL_CR1_ZEN | ST_LIS331DL_CR1_YEN | ST_LIS331DL_CR1_XEN; @@ -324,6 +347,10 @@ int lis331dl_powerdown(FAR struct lis331dl_dev_s * dev) return ERROR; } +/**************************************************************************** + * Name: lis331dl_setconversion + ****************************************************************************/ + int lis331dl_setconversion(FAR struct lis331dl_dev_s * dev, bool full, bool fast) { dev->cr1 = ST_LIS331DL_CR1_PD | @@ -338,6 +365,10 @@ int lis331dl_setconversion(FAR struct lis331dl_dev_s * dev, bool full, bool fast return ERROR; } +/**************************************************************************** + * Name: lis331dl_getprecision + ****************************************************************************/ + int lis331dl_getprecision(FAR struct lis331dl_dev_s * dev) { if (dev->cr1 & ST_LIS331DL_CR1_FS) @@ -348,6 +379,10 @@ int lis331dl_getprecision(FAR struct lis331dl_dev_s * dev) return 2300/127; /* typ. 2.3g full scale */ } +/**************************************************************************** + * Name: lis331dl_getsamplerate + ****************************************************************************/ + int lis331dl_getsamplerate(FAR struct lis331dl_dev_s * dev) { if (dev->cr1 & ST_LIS331DL_CR1_DR) @@ -358,6 +393,10 @@ int lis331dl_getsamplerate(FAR struct lis331dl_dev_s * dev) return 100; } +/**************************************************************************** + * Name: lis331dl_getreadings + ****************************************************************************/ + FAR const struct lis331dl_vector_s * lis331dl_getreadings(FAR struct lis331dl_dev_s * dev) {