/* Includes ------------------------------------------------------------------*/
#include "MM32F103.h"
#include "usb_lib.h"
#include "hw_config.h"
#include "usbio.h"
#include "usb_regs.h"
#include "usb_pwr.h"
#include "usb_desc.h"
#include "sys.h"
#include "uart.h"
#include "delay.h"
#include "led.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Extern variables ----------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
void Delay(__IO uint32_t nCount);
extern uint8_t Flag_Receive;
/* Private functions ---------------------------------------------------------*/
/*******************************************************************************
* Function Name : main.
* Description : main routine.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
uint8_t table_data[64]={
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
};
int main(void)
{
delay_init();
uart_initwBaudRate(115200);
LED_Init();
Set_System();
USB_Interrupts_Config();
Set_USBClock();
USB_Init();
printf("System Initial Success\r\n");
while (1)
{
if(bDeviceState == CONFIGURED) //等待USB初始化完成
{
// if(Flag_Receive)
// {
//
// USB_Send_Buffer[0] = 0xaa;
// USB_Send_Buffer[1] = 0x55;
// USB_Send_Buffer[2] = 0xaa;
// USB_Send_Buffer[3] = 0x55;
// USB_Send_Buffer[4] = 0xaa;
// USB_Send_Buffer[5] = 0x55;
// USB_SendData(USB_Send_Buffer,64);
//
// Flag_Receive = 0;
//
// }
USB_SendData(table_data,5);
delay_ms(5000);
}
//USB_SendData(table_data,64);
}
}
/*******************************************************************************
* Function Name : Delay
* Description : Inserts a delay time.
* Input : nCount: specifies the delay time length.
* Output : None
* Return : None
*******************************************************************************/
void Delay(__IO uint32_t nCount)
{
for(; nCount!= 0;nCount--);
}
#ifdef USE_FULL_ASSERT
/*******************************************************************************
* Function Name : assert_failed
* Description : Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* Input : - file: pointer to the source file name
* - line: assert_param error line source number
* Output : None
* Return : None
*******************************************************************************/
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while(1)
{
}
}
#endif