- disable usb vport

- uart drv for stm32f4
This commit is contained in:
tkl
2016-07-25 15:23:31 +02:00
parent f37cceafb8
commit 466f6fab86
12 changed files with 266 additions and 16 deletions

View File

@@ -6,17 +6,17 @@
*/
#include "bsp_stm32f4-discovery.h"
#if 0
#include "usbd_cdc_vcp.h"
//-----------------------------------------------------------------------------
volatile int32_t ITM_RxBuffer;
#endif
//-----------------------------------------------------------------------------
void board_init(void) {
SystemInit();
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
SysTick_CLKSourceConfig(RCC_SYSCLKSource_PLLCLK);
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_CDC_cb, &USR_cb);
// USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_CDC_cb, &USR_cb);
}

View File

@@ -6,6 +6,8 @@
#ifndef BSP_STM32F4_DISCOVERY_H_
#define BSP_STM32F4_DISCOVERY_H_
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
#include <stddef.h>
#include <stdint.h>
@@ -14,9 +16,12 @@
#include "ringbuffer.h"
#include "stm32f4xx.h"
#include "stm32f4_gpio.h"
#include "stm32f4_uart.h"
#include "stm32_sys_tick.h"
#if 0
#include "usb_vport.h"
#endif
// SYSTEM TICK
static const enum stm32_sys_tick_time_base stm23_sys_tick_time_base =
@@ -32,7 +37,16 @@ static const struct loki_timer timer_1 = {
&timer_fp
};
#if 0
// USB
static const stm32_usb_vport_t stm32_usb_vport;
static const struct uart uart_0 = {
&stm32_usb_vport,
&usb_vport_fp,
&console_buffer
};
#endif
static char console_linear_buffer[80];
static struct ringbuffer console_buffer = {
console_linear_buffer,
@@ -41,11 +55,46 @@ static struct ringbuffer console_buffer = {
sizeof(console_linear_buffer),
0
};
static const stm32_usb_vport_t stm32_usb_vport;
static const struct uart uart_0 = {
&stm32_usb_vport,
&usb_vport_fp,
&console_buffer
static const GPIO_InitTypeDef stm32f4_discovery_uart1_gpio = {
GPIO_Pin_6 | GPIO_Pin_7,
GPIO_Mode_AF,
GPIO_Speed_50MHz,
GPIO_OType_PP,
GPIO_PuPd_UP
};
static const USART_InitTypeDef stm32f4_discovery_uart1_usart_init = {
115200,
USART_WordLength_8b,
USART_StopBits_1,
USART_Parity_No,
USART_Mode_Tx | USART_Mode_Rx,
USART_HardwareFlowControl_None,
};
static const NVIC_InitTypeDef stm32f4_discovery_uart1_nvic_init = {
USART1_IRQn,
0,
0,
ENABLE,
};
static const struct stm32f4_uart stm32f4_uart1 = {
&stm32f4_discovery_uart1_gpio,
GPIOB,
GPIO_PinSource7,
GPIO_PinSource6,
&stm32f4_discovery_uart1_usart_init,
USART1,
USART_IT_RXNE /* | USART_IT_TXE*/,
&stm32f4_discovery_uart1_nvic_init,
};
static const struct uart uart_1 = {
&stm32f4_uart1,
&stm32f4_uart_fp,
&console_buffer,
};
// STATUS LED