You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/04/07 18:44:43 UTC
[09/50] [abbrv] incubator-mynewt-core git commit: Redbear Blend2: add
i2c_0 to syscfg/hal_bsp
Redbear Blend2: add i2c_0 to syscfg/hal_bsp
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/35ed009d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/35ed009d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/35ed009d
Branch: refs/heads/master
Commit: 35ed009d7d1db2e0794ea9f2da0491944354e9a6
Parents: 807f0ab
Author: El Jeffo <mi...@x2o.net>
Authored: Thu Mar 30 02:17:33 2017 +0900
Committer: William San Filippo <wi...@runtime.io>
Committed: Thu Mar 30 16:59:10 2017 -0700
----------------------------------------------------------------------
hw/bsp/rb-blend2/src/hal_bsp.c | 13 +++++++++++++
hw/bsp/rb-blend2/syscfg.yml | 4 ++++
2 files changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/35ed009d/hw/bsp/rb-blend2/src/hal_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/rb-blend2/src/hal_bsp.c b/hw/bsp/rb-blend2/src/hal_bsp.c
index 125d4bd..6d66bdc 100644
--- a/hw/bsp/rb-blend2/src/hal_bsp.c
+++ b/hw/bsp/rb-blend2/src/hal_bsp.c
@@ -75,6 +75,14 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = {
};
#endif
+#if MYNEWT_VAL(I2C_0)
+static const struct nrf52_hal_i2c_cfg hal_i2c_cfg = {
+ .scl_pin = 27,
+ .sda_pin = 26,
+ .i2c_frequency = 100 /* 100 kHz */
+};
+#endif
+
/*
* What memory to include in coredump.
*/
@@ -191,4 +199,9 @@ hal_bsp_init(void)
rc = hal_spi_init(0, (void *)&os_bsp_spi0s_cfg, HAL_SPI_TYPE_SLAVE);
assert(rc == 0);
#endif
+
+#if MYNEWT_VAL(I2C_0)
+ rc = hal_i2c_init(0, (void *)&hal_i2c_cfg);
+ assert(rc == 0);
+#endif
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/35ed009d/hw/bsp/rb-blend2/syscfg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/rb-blend2/syscfg.yml b/hw/bsp/rb-blend2/syscfg.yml
index 2309a59..27c5a96 100644
--- a/hw/bsp/rb-blend2/syscfg.yml
+++ b/hw/bsp/rb-blend2/syscfg.yml
@@ -87,6 +87,10 @@ syscfg.defs:
description: 'NRF52 RTC 0'
value: 0
+ I2C_0:
+ description: 'NRF52 I2C (TWI) interface 0'
+ value: '0'
+
syscfg.vals:
CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS
REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG