usb_net编译通过
Some checks failed
Build / set-matrix (push) Has been cancelled
Build / make-os (macos-latest) (push) Has been cancelled
Build / make-os (windows-latest) (push) Has been cancelled
Build / zephyr (push) Has been cancelled
Build / hil-hfp (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Build / cmake (aarch64-gcc) (push) Has been cancelled
Build / cmake (arm-gcc) (push) Has been cancelled
Build / cmake (esp-idf) (push) Has been cancelled
Build / cmake (msp430-gcc) (push) Has been cancelled
Build / cmake (riscv-gcc) (push) Has been cancelled
Build / make (aarch64-gcc) (push) Has been cancelled
Build / make (arm-gcc) (push) Has been cancelled
Build / make (msp430-gcc) (push) Has been cancelled
Build / make (riscv-gcc) (push) Has been cancelled
Build / make (rx-gcc) (push) Has been cancelled
Build / arm-iar (make) (push) Has been cancelled
Build / hil-build (arm-gcc) (push) Has been cancelled
Build / hil-build (esp-idf) (push) Has been cancelled
Build / hil-tinyusb (push) Has been cancelled
Some checks failed
Build / set-matrix (push) Has been cancelled
Build / make-os (macos-latest) (push) Has been cancelled
Build / make-os (windows-latest) (push) Has been cancelled
Build / zephyr (push) Has been cancelled
Build / hil-hfp (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Build / cmake (aarch64-gcc) (push) Has been cancelled
Build / cmake (arm-gcc) (push) Has been cancelled
Build / cmake (esp-idf) (push) Has been cancelled
Build / cmake (msp430-gcc) (push) Has been cancelled
Build / cmake (riscv-gcc) (push) Has been cancelled
Build / make (aarch64-gcc) (push) Has been cancelled
Build / make (arm-gcc) (push) Has been cancelled
Build / make (msp430-gcc) (push) Has been cancelled
Build / make (riscv-gcc) (push) Has been cancelled
Build / make (rx-gcc) (push) Has been cancelled
Build / arm-iar (make) (push) Has been cancelled
Build / hil-build (arm-gcc) (push) Has been cancelled
Build / hil-build (esp-idf) (push) Has been cancelled
Build / hil-tinyusb (push) Has been cancelled
This commit is contained in:
@@ -23,6 +23,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include "bsp_init.h"
|
||||
#include "stm32f4xx.h"
|
||||
#include "dcd.h"
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -47,8 +54,55 @@ static uint32_t blink_interval_ms = BLINK_NOT_MOUNTED;
|
||||
static void led_blinking_task(void);
|
||||
static void cdc_task(void);
|
||||
|
||||
|
||||
|
||||
int tusb_board_init(void) {
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_OTG_HS, ENABLE);
|
||||
|
||||
GPIO_PinAFConfig(GPIOB, GPIO_PinSource14, GPIO_AF_OTG2_FS);
|
||||
GPIO_PinAFConfig(GPIOB, GPIO_PinSource15, GPIO_AF_OTG2_FS);
|
||||
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14 | GPIO_Pin_15;
|
||||
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
|
||||
// no need enable irq, it will be enabled in dwc2_dcd_int_enable()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void usb_irq_enable(){
|
||||
NVIC_InitTypeDef NVIC_InitStructure;
|
||||
|
||||
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
|
||||
NVIC_InitStructure.NVIC_IRQChannel = OTG_HS_IRQn;
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||
NVIC_Init(&NVIC_InitStructure);
|
||||
}
|
||||
|
||||
static void tusb_thread_entry(void *parameter)
|
||||
{
|
||||
(void) parameter;
|
||||
while (1)
|
||||
{
|
||||
#if CFG_TUH_ENABLED
|
||||
tuh_task();
|
||||
#endif
|
||||
#if CFG_TUD_ENABLED
|
||||
tud_task();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*------------- MAIN -------------*/
|
||||
int main(void) {
|
||||
int main_task(void) {
|
||||
board_init();
|
||||
|
||||
// init device stack on configured roothub port
|
||||
|
Reference in New Issue
Block a user