You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2018/04/18 21:56:31 UTC

[mynewt-core] 08/13: Add initial stm32f3 mcu i2c config

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

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

commit 0ebe880cf2bfb74d2de931335aa7220c34fcf877
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Thu Mar 22 14:53:18 2018 -0300

    Add initial stm32f3 mcu i2c config
---
 hw/mcu/stm/stm32f3xx/include/mcu/stm32_hal.h            |  5 +++++
 hw/mcu/stm/stm32f3xx/include/mcu/stm32f3xx_mynewt_hal.h | 12 ++++++++++++
 hw/mcu/stm/stm32f3xx/syscfg.yml                         |  4 ++++
 hw/mcu/stm/stm32f4xx/syscfg.yml                         | 10 +++++-----
 4 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/hw/mcu/stm/stm32f3xx/include/mcu/stm32_hal.h b/hw/mcu/stm/stm32f3xx/include/mcu/stm32_hal.h
index 388640e..98d1a5e 100644
--- a/hw/mcu/stm/stm32f3xx/include/mcu/stm32_hal.h
+++ b/hw/mcu/stm/stm32f3xx/include/mcu/stm32_hal.h
@@ -60,6 +60,11 @@ struct stm32_hal_spi_cfg {
     int irq_prio;
 };
 
+/* hal_i2c */
+#include "stm32f3xx_hal_i2c.h"
+#include "mcu/stm32f3xx_mynewt_hal.h"
+#include "mcu/stm32f3_bsp.h"
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/mcu/stm/stm32f3xx/include/mcu/stm32f3xx_mynewt_hal.h b/hw/mcu/stm/stm32f3xx/include/mcu/stm32f3xx_mynewt_hal.h
index 0b24798..b4465c0 100644
--- a/hw/mcu/stm/stm32f3xx/include/mcu/stm32f3xx_mynewt_hal.h
+++ b/hw/mcu/stm/stm32f3xx/include/mcu/stm32f3xx_mynewt_hal.h
@@ -22,6 +22,8 @@
 
 #include "stm32f3xx.h"
 #include "stm32f3xx_hal_gpio.h"
+#include "stm32f3xx_hal_dma.h"
+#include "stm32f3xx_hal_i2c.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -45,6 +47,16 @@ extern "C" {
 int hal_gpio_init_stm(int pin, GPIO_InitTypeDef *cfg);
 int hal_gpio_deinit_stm(int pin, GPIO_InitTypeDef *cfg);
 
+struct stm32_hal_i2c_cfg {
+    I2C_TypeDef *hic_i2c;
+    volatile uint32_t *hic_rcc_reg;     /* RCC register to modify */
+    uint32_t hic_rcc_dev;               /* RCC device ID */
+    uint8_t hic_pin_sda;
+    uint8_t hic_pin_scl;
+    uint8_t hic_pin_af;
+    uint8_t hic_10bit;
+    uint32_t hic_speed;
+};
 
 #ifdef __cplusplus
 }
diff --git a/hw/mcu/stm/stm32f3xx/syscfg.yml b/hw/mcu/stm/stm32f3xx/syscfg.yml
index 2c23cd7..4ea70c8 100644
--- a/hw/mcu/stm/stm32f3xx/syscfg.yml
+++ b/hw/mcu/stm/stm32f3xx/syscfg.yml
@@ -58,3 +58,7 @@ syscfg.defs:
     SPI_1:
         description: 'SPI 1 enable'
         value: 'MYNEWT_VAL_SPI_1_MASTER || MYNEWT_VAL_SPI_1_SLAVE'
+
+    I2C_0:
+        description: 'I2C (TWI) interface 0'
+        value:  0
diff --git a/hw/mcu/stm/stm32f4xx/syscfg.yml b/hw/mcu/stm/stm32f4xx/syscfg.yml
index db33de7..ad8fb54 100644
--- a/hw/mcu/stm/stm32f4xx/syscfg.yml
+++ b/hw/mcu/stm/stm32f4xx/syscfg.yml
@@ -16,13 +16,9 @@
 # under the License.
 #
 
-# Package: hw/bsp/nrf52dk
+# Package: hw/mcu/stm32f4xx
 
 syscfg.defs:
-    I2C_0:
-        description: 'I2C (TWI) interface 0'
-        value:  0
-
     MCU_FLASH_MIN_WRITE_SIZE:
         description: >
             Specifies the required alignment for internal flash writes.
@@ -33,6 +29,10 @@ syscfg.defs:
         description: MCUs are of STM32F4xx family
         value: 1
 
+    I2C_0:
+        description: 'I2C (TWI) interface 0'
+        value:  0
+
     SPI_0_MASTER:
         description: 'SPI 0 master'
         value:  0

-- 
To stop receiving notification emails like this one, please contact
utzig@apache.org.