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/04/19 01:59:39 UTC

[1/2] incubator-mynewt-core git commit: MYNEWT-731 Crash in config_init_fcb()

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/master 813463edf -> 73c8953be


MYNEWT-731 Crash in config_init_fcb()

- While specifying the flash layout NRF52840 and NRF52832 need to be
  distinguished. Seperate structs are define for each oen now.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/a1a0647f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/a1a0647f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/a1a0647f

Branch: refs/heads/master
Commit: a1a0647f89856a0246ec24182c9ca72139d102aa
Parents: 813463e
Author: Vipul Rahane <vi...@apache.org>
Authored: Tue Apr 18 18:47:32 2017 -0700
Committer: Vipul Rahane <vi...@apache.org>
Committed: Tue Apr 18 18:47:32 2017 -0700

----------------------------------------------------------------------
 hw/mcu/nordic/nrf52xxx/src/hal_flash.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1a0647f/hw/mcu/nordic/nrf52xxx/src/hal_flash.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_flash.c b/hw/mcu/nordic/nrf52xxx/src/hal_flash.c
index 7d3410b..57a8ee0 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_flash.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_flash.c
@@ -43,6 +43,15 @@ static const struct hal_flash_funcs nrf52k_flash_funcs = {
     .hff_init = nrf52k_flash_init
 };
 
+#ifdef NRF52840_XXAA
+const struct hal_flash nrf52k_flash_dev = {
+    .hf_itf = &nrf52k_flash_funcs,
+    .hf_base_addr = 0x00000000,
+    .hf_size = 1024 * 1024,	/* XXX read from factory info? */
+    .hf_sector_cnt = 256,	/* XXX read from factory info? */
+    .hf_align = 1
+};
+#elif defined(NRF52832_XXAA)
 const struct hal_flash nrf52k_flash_dev = {
     .hf_itf = &nrf52k_flash_funcs,
     .hf_base_addr = 0x00000000,
@@ -50,6 +59,9 @@ const struct hal_flash nrf52k_flash_dev = {
     .hf_sector_cnt = 128,	/* XXX read from factory info? */
     .hf_align = 1
 };
+#else
+#error "Must define hal_flash struct for NRF52 type"
+#endif
 
 #define NRF52K_FLASH_READY() (NRF_NVMC->READY == NVMC_READY_READY_Ready)
 


[2/2] incubator-mynewt-core git commit: No Ticket: Add sensor device creation in NRF52840

Posted by vi...@apache.org.
No Ticket: Add sensor device creation in NRF52840

- Also, change name of init functiosn so that they
  don't have "slinky_" prefix in them.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/73c8953b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/73c8953b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/73c8953b

Branch: refs/heads/master
Commit: 73c8953be37e8e3b3603b4539fa37208199dcfcc
Parents: a1a0647
Author: Vipul Rahane <vi...@apache.org>
Authored: Tue Apr 18 18:55:58 2017 -0700
Committer: Vipul Rahane <vi...@apache.org>
Committed: Tue Apr 18 18:55:58 2017 -0700

----------------------------------------------------------------------
 hw/bsp/nrf52840pdk/src/hal_bsp.c | 86 +++++++++++++++++++++++++++++++++++
 hw/bsp/nrf52dk/src/hal_bsp.c     | 14 +++---
 2 files changed, 93 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/73c8953b/hw/bsp/nrf52840pdk/src/hal_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52840pdk/src/hal_bsp.c b/hw/bsp/nrf52840pdk/src/hal_bsp.c
index a0c78b8..bf2dd36 100644
--- a/hw/bsp/nrf52840pdk/src/hal_bsp.c
+++ b/hw/bsp/nrf52840pdk/src/hal_bsp.c
@@ -35,6 +35,36 @@
 #include "uart_hal/uart_hal.h"
 #include "os/os_dev.h"
 #include "bsp.h"
+#if MYNEWT_VAL(LSM303DLHC_PRESENT)
+#include <lsm303dlhc/lsm303dlhc.h>
+static struct lsm303dlhc lsm303dlhc;
+#endif
+#if MYNEWT_VAL(BNO055_PRESENT)
+#include <bno055/bno055.h>
+#endif
+#if MYNEWT_VAL(TSL2561_PRESENT)
+#include <tsl2561/tsl2561.h>
+#endif
+#if MYNEWT_VAL(TCS34725_PRESENT)
+#include <tcs34725/tcs34725.h>
+#endif
+
+#if MYNEWT_VAL(LSM303DLHC_PRESENT)
+static struct lsm303dlhc lsm303dlhc;
+#endif
+
+#if MYNEWT_VAL(BNO055_PRESENT)
+static struct bno055 bno055;
+#endif
+
+#if MYNEWT_VAL(TSL2561_PRESENT)
+static struct tsl2561 tsl2561;
+#endif
+
+#if MYNEWT_VAL(TCS34725_PRESENT)
+static struct tcs34725 tcs34725;
+#endif
+
 
 #if MYNEWT_VAL(UART_0)
 static struct uart_dev os_bsp_uart0;
@@ -144,6 +174,61 @@ hal_bsp_get_nvic_priority(int irq_num, uint32_t pri)
     return cfg_pri;
 }
 
+#if MYNEWT_VAL(LSM303DLHC_PRESENT) || MYNEWT_VAL(BNO055_PRESENT)
+static int
+accel_init(struct os_dev *dev, void *arg)
+{
+   return (0);
+}
+#endif
+
+#if MYNEWT_VAL(TSL2561_PRESENT)
+static int
+light_init(struct os_dev *dev, void *arg)
+{
+    return (0);
+}
+#endif
+
+#if MYNEWT_VAL(TCS34725_PRESENT)
+static int
+color_init(struct os_dev *dev, void *arg)
+{
+    return (0);
+}
+#endif
+
+static void
+sensor_dev_create(void)
+{
+    int rc;
+
+    (void)rc;
+#if MYNEWT_VAL(LSM303DLHC_PRESENT)
+    rc = os_dev_create((struct os_dev *) &lsm303dlhc, "accel0",
+      OS_DEV_INIT_PRIMARY, 0, accel_init, NULL);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(BNO055_PRESENT)
+    rc = os_dev_create((struct os_dev *) &bno055, "accel1",
+      OS_DEV_INIT_PRIMARY, 0, accel_init, NULL);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(TSL2561_PRESENT)
+    rc = os_dev_create((struct os_dev *) &tsl2561, "light0",
+      OS_DEV_INIT_PRIMARY, 0, light_init, NULL);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(TCS34725_PRESENT)
+    rc = os_dev_create((struct os_dev *) &tcs34725, "color0",
+      OS_DEV_INIT_PRIMARY, 0, color_init, NULL);
+    assert(rc == 0);
+#endif
+}
+
 void
 hal_bsp_init(void)
 {
@@ -206,4 +291,5 @@ hal_bsp_init(void)
     assert(rc == 0);
 #endif
 
+    sensor_dev_create();
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/73c8953b/hw/bsp/nrf52dk/src/hal_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/src/hal_bsp.c b/hw/bsp/nrf52dk/src/hal_bsp.c
index 4a2a2a1..c0031b1 100644
--- a/hw/bsp/nrf52dk/src/hal_bsp.c
+++ b/hw/bsp/nrf52dk/src/hal_bsp.c
@@ -182,7 +182,7 @@ hal_bsp_get_nvic_priority(int irq_num, uint32_t pri)
 
 #if MYNEWT_VAL(LSM303DLHC_PRESENT) || MYNEWT_VAL(BNO055_PRESENT)
 static int
-slinky_accel_init(struct os_dev *dev, void *arg)
+accel_init(struct os_dev *dev, void *arg)
 {
    return (0);
 }
@@ -190,7 +190,7 @@ slinky_accel_init(struct os_dev *dev, void *arg)
 
 #if MYNEWT_VAL(TSL2561_PRESENT)
 static int
-slinky_light_init(struct os_dev *dev, void *arg)
+light_init(struct os_dev *dev, void *arg)
 {
     return (0);
 }
@@ -198,7 +198,7 @@ slinky_light_init(struct os_dev *dev, void *arg)
 
 #if MYNEWT_VAL(TCS34725_PRESENT)
 static int
-slinky_color_init(struct os_dev *dev, void *arg)
+color_init(struct os_dev *dev, void *arg)
 {
     return (0);
 }
@@ -212,25 +212,25 @@ sensor_dev_create(void)
     (void)rc;
 #if MYNEWT_VAL(LSM303DLHC_PRESENT)
     rc = os_dev_create((struct os_dev *) &lsm303dlhc, "accel0",
-      OS_DEV_INIT_PRIMARY, 0, slinky_accel_init, NULL);
+      OS_DEV_INIT_PRIMARY, 0, accel_init, NULL);
     assert(rc == 0);
 #endif
 
 #if MYNEWT_VAL(BNO055_PRESENT)
     rc = os_dev_create((struct os_dev *) &bno055, "accel1",
-      OS_DEV_INIT_PRIMARY, 0, slinky_accel_init, NULL);
+      OS_DEV_INIT_PRIMARY, 0, accel_init, NULL);
     assert(rc == 0);
 #endif
 
 #if MYNEWT_VAL(TSL2561_PRESENT)
     rc = os_dev_create((struct os_dev *) &tsl2561, "light0",
-      OS_DEV_INIT_PRIMARY, 0, slinky_light_init, NULL);
+      OS_DEV_INIT_PRIMARY, 0, light_init, NULL);
     assert(rc == 0);
 #endif
 
 #if MYNEWT_VAL(TCS34725_PRESENT)
     rc = os_dev_create((struct os_dev *) &tcs34725, "color0",
-      OS_DEV_INIT_PRIMARY, 0, slinky_color_init, NULL);
+      OS_DEV_INIT_PRIMARY, 0, color_init, NULL);
     assert(rc == 0);
 #endif