You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2017/03/23 22:35:16 UTC
[1/2] incubator-mynewt-core git commit: Expose I2C0 on STM32F4
Discovery board
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop eed3250d1 -> 22e0edd10
Expose I2C0 on STM32F4 Discovery board
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/e82d1fc2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/e82d1fc2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/e82d1fc2
Branch: refs/heads/develop
Commit: e82d1fc242bb6b041cb15a8e4c9dea997228298f
Parents: f5b3bf6
Author: Antoine Albertelli <an...@antoinealb.net>
Authored: Thu Mar 23 23:16:48 2017 +0100
Committer: Antoine Albertelli <an...@antoinealb.net>
Committed: Thu Mar 23 23:19:36 2017 +0100
----------------------------------------------------------------------
hw/bsp/stm32f4discovery/src/hal_bsp.c | 22 ++++++++++++++++++++++
hw/bsp/stm32f4discovery/syscfg.yml | 4 ++++
2 files changed, 26 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e82d1fc2/hw/bsp/stm32f4discovery/src/hal_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/stm32f4discovery/src/hal_bsp.c b/hw/bsp/stm32f4discovery/src/hal_bsp.c
index 5e5c3bd..a8d611a 100644
--- a/hw/bsp/stm32f4discovery/src/hal_bsp.c
+++ b/hw/bsp/stm32f4discovery/src/hal_bsp.c
@@ -34,6 +34,8 @@
#include <stm32f407xx.h>
#include <stm32f4xx_hal_gpio_ex.h>
#include <mcu/stm32f4_bsp.h>
+#include "mcu/stm32f4xx_mynewt_hal.h"
+#include "hal/hal_i2c.h"
#include "bsp/bsp.h"
@@ -55,6 +57,20 @@ static const struct stm32f4_uart_cfg uart_cfg[UART_CNT] = {
};
#endif
+#if MYNEWT_VAL(I2C_0)
+static struct stm32f4_hal_i2c_cfg i2c_cfg0 = {
+ .hic_i2c = I2C1,
+ .hic_rcc_reg = &RCC->APB1ENR,
+ .hic_rcc_dev = RCC_APB1ENR_I2C1EN,
+ .hic_pin_sda = MCU_GPIO_PORTB(9), /* PB9 */
+ .hic_pin_scl = MCU_GPIO_PORTB(8), /* PB8 */
+ .hic_pin_af = GPIO_AF4_I2C1,
+ .hic_10bit = 0,
+ .hic_speed = 100000 /* 100kHz */
+};
+#endif
+
+
static const struct hal_bsp_mem_dump dump_cfg[] = {
[0] = {
.hbmd_start = &_ram_start,
@@ -100,6 +116,12 @@ hal_bsp_init(void)
#if MYNEWT_VAL(TIMER_0)
hal_timer_init(0, TIM9);
#endif
+
+#if MYNEWT_VAL(I2C_0)
+ rc = hal_i2c_init(0, &i2c_cfg0);
+ assert(rc == 0);
+#endif
+
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e82d1fc2/hw/bsp/stm32f4discovery/syscfg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/stm32f4discovery/syscfg.yml b/hw/bsp/stm32f4discovery/syscfg.yml
index 5df91a7..2cddf03 100644
--- a/hw/bsp/stm32f4discovery/syscfg.yml
+++ b/hw/bsp/stm32f4discovery/syscfg.yml
@@ -24,6 +24,10 @@ syscfg.defs:
TIMER_0:
description: 'Timer 0'
value: 0
+ I2C_0:
+ description: 'I2C 0'
+ value: 0
+
syscfg.vals:
REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG
[2/2] incubator-mynewt-core git commit: This closes #213.
Posted by ma...@apache.org.
This closes #213.
Merge branch 'stm32f4-discovery-i2c0' of https://github.com/antoinealb/incubator-mynewt-core into develop
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/22e0edd1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/22e0edd1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/22e0edd1
Branch: refs/heads/develop
Commit: 22e0edd108aef57138be36be971f0d0cea519904
Parents: eed3250 e82d1fc
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu Mar 23 15:31:33 2017 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Mar 23 15:31:33 2017 -0700
----------------------------------------------------------------------
hw/bsp/stm32f4discovery/src/hal_bsp.c | 22 ++++++++++++++++++++++
hw/bsp/stm32f4discovery/syscfg.yml | 4 ++++
2 files changed, 26 insertions(+)
----------------------------------------------------------------------