Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop b7e14d961 -> ec1af7e76


stm32f4xx; add parameter to hal_init_gpio_af() to control whether
GPIO is set as OD or not.


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/ea57fe17
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/ea57fe17
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/ea57fe17

Branch: refs/heads/develop
Commit: ea57fe178d4949b1846f72a47b94e4775a8af952
Parents: b7e14d9
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Mon Oct 10 11:56:34 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon Oct 10 11:56:34 2016 -0700

----------------------------------------------------------------------
 hw/mcu/stm/stm32f4xx/include/mcu/stm32f4_bsp.h | 4 +---
 hw/mcu/stm/stm32f4xx/src/hal_gpio.c            | 8 ++++++--
 2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ea57fe17/hw/mcu/stm/stm32f4xx/include/mcu/stm32f4_bsp.h
----------------------------------------------------------------------
diff --git a/hw/mcu/stm/stm32f4xx/include/mcu/stm32f4_bsp.h 
b/hw/mcu/stm/stm32f4xx/include/mcu/stm32f4_bsp.h
index e238286..91364df 100644
--- a/hw/mcu/stm/stm32f4xx/include/mcu/stm32f4_bsp.h
+++ b/hw/mcu/stm/stm32f4xx/include/mcu/stm32f4_bsp.h
@@ -39,12 +39,10 @@ struct stm32f4_uart_cfg {
     IRQn_Type suc_irqn;                                /* NVIC IRQn */
 };
 
-const struct stm32f4_uart_cfg *bsp_uart_config(int port);
-
 /*
  * Internal API for stm32f4xx mcu specific code.
  */
-int hal_gpio_init_af(int pin, uint8_t af_type, enum gpio_pull pull);
+int hal_gpio_init_af(int pin, uint8_t af_type, enum gpio_pull pull, uint8_t 
od);
 
 struct hal_flash;
 extern struct hal_flash stm32f4_flash_dev;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ea57fe17/hw/mcu/stm/stm32f4xx/src/hal_gpio.c
----------------------------------------------------------------------
diff --git a/hw/mcu/stm/stm32f4xx/src/hal_gpio.c 
b/hw/mcu/stm/stm32f4xx/src/hal_gpio.c
index 9fcc3bd..696d569 100644
--- a/hw/mcu/stm/stm32f4xx/src/hal_gpio.c
+++ b/hw/mcu/stm/stm32f4xx/src/hal_gpio.c
@@ -479,11 +479,15 @@ int hal_gpio_init_out(int pin, int val)
  * Configure the specified pin for AF.
  */
 int
-hal_gpio_init_af(int pin, uint8_t af_type, enum gpio_pull pull)
+hal_gpio_init_af(int pin, uint8_t af_type, enum gpio_pull pull, uint8_t od)
 {
     GPIO_InitTypeDef gpio;
 
-    gpio.Mode = GPIO_MODE_AF_PP;
+    if (!od) {
+        gpio.Mode = GPIO_MODE_AF_PP;
+    } else {
+        gpio.Mode = GPIO_MODE_AF_OD;
+    }
     gpio.Speed = GPIO_SPEED_HIGH;
     gpio.Pull = pull;
     gpio.Alternate = af_type;

Reply via email to