You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2017/10/18 22:38:12 UTC

[mynewt-core] branch master updated: Check the int2 pin num before init

This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 8a4447a  Check the int2 pin num before init
8a4447a is described below

commit 8a4447abd9279b92e61a155dfa09eddbbff803e8
Author: Vipul Rahane <vi...@apache.org>
AuthorDate: Wed Oct 18 15:36:23 2017 -0700

    Check the int2 pin num before init
---
 hw/drivers/sensors/bma253/src/bma253.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/hw/drivers/sensors/bma253/src/bma253.c b/hw/drivers/sensors/bma253/src/bma253.c
index cd8761c..729d7e5 100644
--- a/hw/drivers/sensors/bma253/src/bma253.c
+++ b/hw/drivers/sensors/bma253/src/bma253.c
@@ -3492,16 +3492,19 @@ int bma253_config(struct bma253 * bma253, struct bma253_cfg * cfg)
 			       HAL_GPIO_PULL_NONE);
 	if (rc != 0)
 		return rc;
-	rc = hal_gpio_irq_init(cfg->int_pin2_num,
-			       interrupt_handler,
-			       bma253->ints + BMA253_INT_PIN_2,
-			       gpio_trig,
-			       HAL_GPIO_PULL_NONE);
-	if (rc != 0)
-		return rc;
+
+  if (cfg->int_pin2_num) {
+	    rc = hal_gpio_irq_init(cfg->int_pin2_num,
+			           interrupt_handler,
+			           bma253->ints + BMA253_INT_PIN_2,
+	    		       gpio_trig,
+    			       HAL_GPIO_PULL_NONE);
+    	if (rc != 0)
+	        return rc;
+	    hal_gpio_irq_enable(cfg->int_pin2_num);
+  }
 
 	hal_gpio_irq_enable(cfg->int_pin1_num);
-	hal_gpio_irq_enable(cfg->int_pin2_num);
 
 	rc = sensor_set_type_mask(sensor, cfg->sensor_mask);
 	if (rc != 0)

-- 
To stop receiving notification emails like this one, please contact
['"commits@mynewt.apache.org" <co...@mynewt.apache.org>'].