示例#1
0
#include <mcu/stm32f4_bsp.h>
#include "mcu/stm32f4xx_mynewt_hal.h"
#include "hal/hal_i2c.h"
#include "hal/hal_spi.h"

#include "bsp/bsp.h"

#if MYNEWT_VAL(UART_0)
static struct uart_dev hal_uart0;

static const struct stm32_uart_cfg uart_cfg[UART_CNT] = {
    [0] = {
        .suc_uart = USART3,
        .suc_rcc_reg = &RCC->APB1ENR,
        .suc_rcc_dev = RCC_APB1ENR_USART3EN,
        .suc_pin_tx = MCU_GPIO_PORTD(8),	/* PD8 */
        .suc_pin_rx = MCU_GPIO_PORTD(9),	/* PD9 */
        .suc_pin_rts = -1,
        .suc_pin_cts = -1,
        .suc_pin_af = GPIO_AF7_USART3,
        .suc_irqn = USART3_IRQn
    }
};
#endif

#if MYNEWT_VAL(I2C_0)
static struct stm32_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 */
#endif

#if MYNEWT_VAL(TRNG)
static struct trng_dev os_bsp_trng;
#endif

#if MYNEWT_VAL(UART_0)
static struct uart_dev hal_uart0;

static const struct stm32_uart_cfg uart_cfg[UART_CNT] = {
    [0] = {
        .suc_uart = USART3,
        .suc_rcc_reg = &RCC->APB1ENR,
        .suc_rcc_dev = RCC_APB1ENR_USART3EN,
        .suc_pin_tx = MCU_GPIO_PORTD(8),     /* PD8 */
        .suc_pin_rx = MCU_GPIO_PORTD(9),     /* PD9 */
        .suc_pin_rts = -1,
        .suc_pin_cts = -1,
        .suc_pin_af = GPIO_AF7_USART3,
        .suc_irqn = USART3_IRQn,
    }
};
#endif

#if MYNEWT_VAL(SPI_0_SLAVE) || MYNEWT_VAL(SPI_0_MASTER)
struct stm32_hal_spi_cfg spi0_cfg = {
    .sck_pin  = MCU_GPIO_PORTA(5),           /* D13 on CN7 */
    .miso_pin = MCU_GPIO_PORTA(6),           /* D12 on CN7 */
    .mosi_pin = MCU_GPIO_PORTA(7),           /* D11 on CN7 */
    .ss_pin   = MCU_GPIO_PORTD(14),          /* D10 on CN7 */
示例#3
0
    },
    {
        &INT1R,
        &T3CKR,
        &IC1R,
        &U3CTSR,
        &U4RXR,
        &U5RXR,
        &SS2R,
        &OCFAR
    }
};

static const uint8_t output_pins[4][16] = {
    {
        MCU_GPIO_PORTD(2),
        MCU_GPIO_PORTG(8),
        MCU_GPIO_PORTF(4),
        MCU_GPIO_PORTD(10),
        MCU_GPIO_PORTF(1),
        MCU_GPIO_PORTB(9),
        MCU_GPIO_PORTB(10),
        MCU_GPIO_PORTC(14),
        MCU_GPIO_PORTB(5),
        MCU_GPIO_UNDEF,
        MCU_GPIO_UNDEF,
        MCU_GPIO_UNDEF,
        MCU_GPIO_UNDEF,
        MCU_GPIO_UNDEF,
        MCU_GPIO_UNDEF,
        MCU_GPIO_UNDEF
示例#4
0
#include <hal/hal_timer.h>
#include <hal/hal_system.h>

#include <mcu/stm32f4_bsp.h>



#if MYNEWT_VAL(UART_0)
static struct uart_dev hal_uart0;

static const struct stm32f4_uart_cfg uart_cfg[UART_CNT] = {
    [0] = {
        .suc_uart = USART2,
        .suc_rcc_reg = &RCC->APB1ENR,
        .suc_rcc_dev = RCC_APB1ENR_USART2EN,
        .suc_pin_tx = MCU_GPIO_PORTD(5),	/* PD5 */
        .suc_pin_rx = MCU_GPIO_PORTD(6),	/* PD6 */
        .suc_pin_rts = -1,
        .suc_pin_cts = -1,
        .suc_pin_af = GPIO_AF7_USART2,
        .suc_irqn = USART2_IRQn
    }
};
#endif

static const struct hal_bsp_mem_dump dump_cfg[] = {
    [0] = {
        .hbmd_start = &_ram_start,
        .hbmd_size = RAM_SIZE
    },
    [1] = {