first submission
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : main.c
|
||||
* Author : WCH
|
||||
* Version : V1.0.0
|
||||
* Date : 2022/09/01
|
||||
* Description : Main program body.
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* @Note
|
||||
* This example demonstrates the process of enumerating the keyboard and mouse
|
||||
* by a USB host and obtaining data based on the polling time of the input endpoints
|
||||
* of the keyboard and mouse.
|
||||
* The USBFS port also supports enumeration of keyboard and mouse attached at tier
|
||||
* level 2(Hub 1).
|
||||
*/
|
||||
|
||||
/*
|
||||
* @Note
|
||||
* The USBFS module uses the system clock as the clock source, so the SystemCoreClock can
|
||||
* only be set to 144MHz, 96MHz or 48MHz.
|
||||
*/
|
||||
|
||||
/*******************************************************************************/
|
||||
/* Header Files */
|
||||
#include "usb_host_config.h"
|
||||
|
||||
/*********************************************************************
|
||||
* @fn main
|
||||
*
|
||||
* @brief Main program.
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
int main( void )
|
||||
{
|
||||
/* Initialize system configuration */
|
||||
Delay_Init( );
|
||||
USART_Printf_Init( 115200 );
|
||||
DUG_PRINTF( "SystemClk:%d\r\n", SystemCoreClock );
|
||||
DUG_PRINTF( "USBFS HOST KM Test\r\n" );
|
||||
|
||||
/* Initialize TIM3 */
|
||||
TIM3_Init( 9, SystemCoreClock / 10000 - 1 );
|
||||
DUG_PRINTF( "TIM3 Init OK!\r\n" );
|
||||
|
||||
/* Initialize USBFS host */
|
||||
#if DEF_USBFS_PORT_EN
|
||||
DUG_PRINTF( "USBFS Host Init\r\n" );
|
||||
USBFS_RCC_Init( );
|
||||
USBFS_Host_Init( ENABLE );
|
||||
memset( &RootHubDev.bStatus, 0, sizeof( ROOT_HUB_DEVICE ) );
|
||||
memset( &HostCtl[ DEF_USBFS_PORT_INDEX * DEF_ONE_USB_SUP_DEV_TOTAL ].InterfaceNum, 0, DEF_ONE_USB_SUP_DEV_TOTAL * sizeof( HOST_CTL ) );
|
||||
#endif
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
USBH_MainDeal( );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user