int main() { InitGPIO(); InitBKP(); Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); rtc_init(); /* RTC_t date; date.year = 2015; date.month = 10; date.mday = 24; date.hour = 23; date.min = 20; date.sec = 0; rtc_settime(&date); */ // Start Task // xTaskCreate(vLcdTask, "vLcdTask", configMINIMAL_STACK_SIZE * 1, NULL, tskIDLE_PRIORITY + 1, &xHandleLcdTask); xTaskCreate(vDebugTask, "vDebugTask", configMINIMAL_STACK_SIZE * 1, NULL, tskIDLE_PRIORITY + 1, &xHandleDebugTask); // Start scheduler // osKernelStart(NULL, NULL); }
/******************************************************************************* * Function Name : main. * Description : main routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ int main(void) { Set_System(); USB_Interrupts_Config(); Set_USBClock(); USB_Init(); uint16_t counter = 0; while (1) { TheReport.SAX = 32768; TheReport.SAY = counter; ++counter; if (bDeviceState == CONFIGURED) { if (PrevXferComplete) { RHIDCheckState(); } } } }
/** * @brief Configure the USB in CDC mode. * @retval None */ void initUSB_CDC(void) { Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init_Dynamic(&Device_Property_CDC, &User_Standard_Requests_CDC); // now device state is UNCONNECTED }
int main() { SysTick_Config(SystemCoreClock/1000); GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE); Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); /* * GPIO_Config(); * * GPIOA->BSRR = GPIO_Pin_15; * * while (1) * { * if (bDeviceState == CONFIGURED) { * CDC_Receive_DATA(); * [>Check to see if we have data yet <] * if (Receive_length != 0) { * if (packet_sent == 1) * CDC_Send_DATA((unsigned char*) Receive_Buffer, Receive_length); * Receive_length = 0; * } * } * } */ while(1); }
int main(void) { delay_init(); //延时函数初始化 uart_init(9600); //串口初始化为9600 LED_Init(); //初始化与LED连接的硬件接口 LED0=1; LED1=1; LED2=1; USB_Cable_Config (ENABLE); delay_ms(500); USB_Port_Set(0); delay_ms(500); USB_Port_Set(1); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); SPI_IO_Init(); DMA_configuration(); spi_conf(SPI_DEFAULT_SPEED); LED1=0; LED2=0; while(1) { /* Get command */ serprog_handle_command(usb_getc()); /* Flush output via USB */ usb_sync(); } }
int main() { InitGPIO(); //InitTIM3(); //InitTIM4(); InitIWDG(); // Init Watch Dog InitBKP(); #ifdef DEBUG_OUTPUT_USB Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); #else rtc_init(); #endif RTC_t date; date.year = 2015; date.month = 10; date.mday = 24; date.hour = 23; date.min = 20; date.sec = 0; rtc_settime(&date); // Start Task // xTaskCreate(vLcdPcf, "vLcdPcf", configMINIMAL_STACK_SIZE * 2, NULL, tskIDLE_PRIORITY + 1, &xHandlevLcdPcfTask); xTaskCreate(vDebugTask, "vDebugTask", configMINIMAL_STACK_SIZE * 2, NULL, tskIDLE_PRIORITY + 1, &xHandleDebugTask); // Start scheduler // osKernelStart(NULL, NULL); }
void USB_Config(void) { Set_USBClock(); USB_Interrupts_Config(); USB_Init(); // while (bDeviceState != CONFIGURED) {} }
/******************************************************************************* * Function Name : main. * Description : Main routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ int main(void) { int i; Reset_GC3355(); Set_System(); Set_USBClock(); USB_Interrupts_Config(); #ifdef USE_USB_AS_HOST_IF USB_Init(); #endif USART_Config_Default(); btc_ltc_uart_config(115200); delay_init(72); //gpio_init(); Timerx_Init(100,7200-1); USART_Config_Default(); rx_cx_buffers_init(); while (1) { dispatch_host_cmd(); report_nonce_to_host(); if(timer_count > 100) { timer_count = 0; //PR_DEBUG("GPIOB8 = %d\n",GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_8)); led1_revert(); //PR_DEBUG("%02X\n",get_next_n_out(&usb_trans_buffer,152)); //PR_DEBUG("has cmd length = %d\n",trans_buffer_has_cmd(&usb_trans_buffer)); } //delay_ms(1000); //PR_DEBUG("delay 1000ms \n"); } }
/******************************************************************************* * Function Name : main. * Descriptioan : Main routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ int main(void) { int i; /* Set the Vector Table base adress at 0x8004000 */ NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x4000); // Disable JTAG not the SWD RCC_APB2PeriphClockCmd( RCC_APB2Periph_AFIO , ENABLE); GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); for(i = 0; i < 27; i++) TestBuffer[i] = i % 9; while (1) { if (bDeviceState == CONFIGURED) { //CDC_Send_DATA ((unsigned char*)TestBuffer,27); //Delay(0xFFF); CDC_Receive_DATA(); // Check to see if we have data yet if (Receive_length != 0) { if (packet_sent == 1) CDC_Send_DATA ((unsigned char*)Receive_Buffer,Receive_length); Receive_length = 0; } } } }
/******************************************************************************* * Function Name : main. * Description : main routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ int main(void) { GPIO_InitTypeDef GPIO_InitStructure; NAND_IDTypeDef NAND_Id; NAND_ADDRESS NAND_Address; int i=0; #ifdef DEBUG debug(); #endif Set_System(); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE); Serial_Init(); NAND_Init(); NAND_Reset(); NAND_ReadID(&NAND_Id); Get_Medium_Characteristics(); Set_USBClock(); USB_Interrupts_Config(); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD; GPIO_Init(GPIOC, &GPIO_InitStructure); USB_Init(); while (1) { } }
void uart_init() { Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); }
void USB_Configs() { RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); USB_Cable_Config(ENABLE); USB_Interrupts_Config(); Set_USBClock(); USB_Init(); }
void USBDevice_Connect() { DBG_MSG("called", 0); if(!InitMemoryInfo()) return; USB_Interrupts_Config(ENABLE); USB_Cable_Config(ENABLE); USB_Init(); }
/********************************************************************************************* Function name : VCP_Init Author : Grant Phillips Date Modified : 10/04/2014 Compiler : Keil ARM-MDK (uVision V4.70.0.0) Description : Initializes the Virtual COM Port module Special Note(s) : NONE Parameters : NONE Return value : NONE *********************************************************************************************/ void VCP_Init(void) { Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); packet_sent=1; }
void vUSBTask(void *pvParameters) { uint16 usbsize; uint8 usbbuf[256]; //uint8 usbbufsizes[100]; CONTENTS stru[100]; uint16 usbbufsizesCounter=0; bool st = false; /* The parameters are not used. */ (void) pvParameters; /* uint16_t bufff[20]; bufff[0] = 0x555; bufff[1] = 0x444; bufff[2] = 0x333; bufff[3] = 0x222; bufff[4] = 0x111; FLASH_ErasePage(DEVICE_FLASHMEM_LOCATION); //FLASH_ProgramHalfWord(DEVICE_FLASHMEM_LOCATION,bufff[0]); //FLASH_ProgramHalfWord(DEVICE_FLASHMEM_LOCATION+0x02,bufff[1]); //FLASH_ProgramHalfWord(DEVICE_FLASHMEM_LOCATION+0x04,bufff[2]); //FLASH_ProgramHalfWord(DEVICE_FLASHMEM_LOCATION+0x06,bufff[3]); //FLASH_ProgramHalfWord(DEVICE_FLASHMEM_LOCATION+0x08,bufff[4]); WriteFlash( bufff,(void*)(DEVICE_FLASHMEM_LOCATION), 10);*/ //vTaskDelay(15000); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); int heapSize = 0; while (1) { heapSize = xPortGetFreeHeapSize(); heapSize +=0; usbsize = UsbReceiveData(usbbuf,256); if(usbsize > 0) { stru[usbbufsizesCounter].buf[0]=usbbuf[0]; stru[usbbufsizesCounter].buf[1]=usbbuf[1]; stru[usbbufsizesCounter].buf[2]=usbbuf[2]; stru[usbbufsizesCounter].buf[3]=usbbuf[3]; stru[usbbufsizesCounter].size = usbsize; usbbufsizesCounter++; if(usbbufsizesCounter>=100) usbbufsizesCounter = 0; usbsize = RVnetSlaveProcess(usbbuf,usbsize,1); if(usbsize > 0) { UsbSendData(usbbuf,usbsize); } } vTaskDelay(1); } }
serialPort_t *usbVcpOpen(void) { vcpPort_t *s; IOInit(IOGetByTag(IO_TAG(PA11)), OWNER_USB, 0); IOInit(IOGetByTag(IO_TAG(PA12)), OWNER_USB, 0); #if defined(STM32F4) usbGenerateDisconnectPulse(); switch (usbDevConfig()->type) { #ifdef USE_USB_CDC_HID case COMPOSITE: USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_HID_CDC_cb, &USR_cb); break; #endif default: USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_CDC_cb, &USR_cb); break; } #elif defined(STM32F7) usbGenerateDisconnectPulse(); /* Init Device Library */ USBD_Init(&USBD_Device, &VCP_Desc, 0); /* Add Supported Class */ switch (usbDevConfig()->type) { #ifdef USE_USB_CDC_HID case COMPOSITE: USBD_RegisterClass(&USBD_Device, USBD_HID_CDC_CLASS); break; #endif default: USBD_RegisterClass(&USBD_Device, USBD_CDC_CLASS); break; } /* HID Interface doesn't have any callbacks... */ /* Add CDC Interface Class */ USBD_CDC_RegisterInterface(&USBD_Device, &USBD_CDC_fops); /* Start Device Process */ USBD_Start(&USBD_Device); #else Set_System(); Set_USBClock(); USB_Init(); USB_Interrupts_Config(); #endif s = &vcpPort; s->port.vTable = usbVTable; return (serialPort_t *)s; }
void USB_HID_Init(void) { bDeviceState=UNCONNECTED; USB_HID_RecData_Ready = 0; USB_HID_RecData_Len = 0; Set_System(); USB_Interrupts_Config(); Set_USBClock(); USB_Init(); }
/******************************************************************************* * Function Name : main. * Description : Main routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ int main(void) { Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); while (1) { } }
/** * @brief Configure the USB. * @param None * @retval None */ void Demo_USB (void) { Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); while ((bDeviceState != CONFIGURED)&&(USBConnectTimeOut != 0)) {} }
/** * @brief Configure the usb serial communication. * Blocking function. * @param Void * @return Void */ void usbCommInit( void ) { Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); while (USB_GetState() != CONFIGURED) {} // Wait USB is ready usbCommInitPeriodicSending(); }
/******************************************************************************* * Function Name : main. * Description : Main routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ int main(void) { NVIC_SetVectorTable(NVIC_VectTab_FLASH,0x3000); Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); while (1) { } }
void PCUsart_Init(void) { Set_USBClock(); USB_Interrupts_Config(); USB_Init(); //g_pcCommand.CmdBuffer = g_receive_buff; //g_com_handle_flag = 0; //reset_command(); }
void ResetUSB(void) { delay_ms(500); // Reset USB usb_port_set(0); delay_ms(500); usb_port_set(1); USB_Interrupts_Config(); Set_USBClock(); USB_Init(); }
/******************************************************************************* * Function Name : main. * Description : Main routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ int main(void) { Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); while (bDeviceState != CONFIGURED); while (1) {} }
/******************************************************************************* * Function Name : main * Description : main program. * Input : None. * Return : None. *******************************************************************************/ int main(void) { #ifdef DEBUG debug(); #endif Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); /* Main loop */ while(1); }
serialPort_t *usbVcpOpen(void) { vcpPort_t *s; Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); s = &vcpPort; s->port.vTable = usbVTable; return (serialPort_t *)s; }
int main( void ) { Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); RadioStart(); #ifdef __GNUC__ return 0; #endif }
void usb_init() { #ifdef RT_USING_STD_USB /* usb device controller driver initilize */ Set_System(); Set_USBClock(); USB_Interrupts_Config(); rt_usb_serial_init(); USB_Init(); #ifdef RT_USING_CONSOLE //rt_console_set_device("vcom"); //finsh_set_device( "vcom" ); #endif #endif }
serialPort_t *usbInit(void) { uartPort_t *s; Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); init_printf(NULL, usbPrintf); s = &uartPortUSB; s->port.vTable = usbVTable; return (serialPort_t *)s; }
int main(void) { Set_System(); SysTick_Config(SystemCoreClock/10000); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); lcdInit(); volatile int x; while (1) { lcdSetBklight(sysTicks%10000/100); x++; } }