本文整理汇总了C++中USB_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ USB_Init函数的具体用法?C++ USB_Init怎么用?C++ USB_Init使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了USB_Init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupHardware
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
#if (ARCH == ARCH_AVR8)
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
#endif
/* Hardware Initialization */
Serial_Init(9600, false);
LEDs_Init();
Buttons_Init();
Joystick_Init();
USB_Init();
/* Create a stdio stream for the serial port for stdin and stdout */
Serial_CreateStream(NULL);
}
示例2: SetupHardware
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Configure all button pins to use internal pullup */
PORTD |= (1<<7) | (1<<4) | (1<<2) | (1<<0) | (1<<6) | (1<<1);
PORTE |= (1<<2);
PORTB |= (1<<0) | (1<<4) | (1<<5) | (1<<7);
/* Subsystem Initialization */
EncoderInit();
DebounceInit();
LedInit();
USB_Init();
}
示例3: SetupHardware
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
#if (ARCH == ARCH_AVR8)
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
#endif
/* Hardware Initialization */
LEDs_Init();
USB_Init();
/* Timer Initialization */
OCR0A = 100;
TCCR0A = (1 << WGM01);
TCCR0B = (1 << CS00);
TIMSK0 = (1 << OCIE0A);
}
示例4: All_Init
/*------------------------------------------------------------
* Function Name : All_Init
* Description : 全局初始化
* Input : None
* Output : None
* Return : None
*------------------------------------------------------------*/
void All_Init( void )
{
NVIC_Configuration(); /* 配置优先级分组 */
bsp_InitTimer(); /* 定时器初始化 */
key_init(); /* 按键初始化 */
print_init(); /* 打印机初始化 */
uart1_init(38400); /* 通讯串口初始化 */
rtc_init(); /* 时钟初始化 */
lcd_init(); /* LCD初始化 */
font_init(); /* 字体初始化 */
SysTick_Init(); /* 滴答定时器初始化 */
bsp_InitSFlash(); /* 外置 FLASH 初始化 */
USB_Init(); /* USB初始化 */
Ethernet_Init(); /* LWIP初始化 */
#ifdef ENABLE_BEEP
BEEP_START();
#endif
SetPage(SYS_INIT);
}
示例5: SetupHardware
/** Configures all hardware required for the bootloader. */
static void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Relocate the interrupt vector table to the bootloader section */
MCUCR = (1 << IVCE);
MCUCR = (1 << IVSEL);
/* Initialize the USB and other board hardware drivers */
USB_Init();
LEDs_Init();
/* Bootloader active LED toggle timer initialization */
TIMSK1 = (1 << TOIE1);
TCCR1B = ((1 << CS11) | (1 << CS10));
}
示例6: SetupHardware
/** Configures the board hardware and chip peripherals for the application's functionality. */
void SetupHardware(void)
{
#if (ARCH == ARCH_AVR8)
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
#endif
/* Hardware Initialization */
USB_Init();
/* Power up the HD44780 Interface */
HD44780_Initialize();
HD44780_WriteCommand(CMD_DISPLAY_ON);
/* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */
TCCR0B = (1 << CS02);
}
示例7: main
int main (void) {
PINSEL10 = 0; /* Disable ETM interface */
FIO2DIR = LEDMSK; /* LEDs, port 2, bit 0~7 output only */
lcd_init();
lcd_clear();
lcd_print ("MCB2300 HID Demo");
set_cursor (0, 1);
lcd_print (" www.keil.com ");
Nr = 128;
Nk = Nr / 32;
Nr = Nk + 6;
KeyExpansion(Key, Nk, Nr);
USB_Init(); /* USB Initialization */
USB_Connect(TRUE); /* USB Connect */
while (1); /* Loop forever */
}
示例8: main
/** Main program entry point. This routine configures the hardware required by the application, then
* starts the scheduler to run the USB management task.
*/
int main(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Indicate USB not ready */
UpdateStatus(Status_USBNotReady);
/* Initialize Scheduler so that it can be used */
Scheduler_Init();
/* Initialize USB Subsystem */
USB_Init();
/* Scheduling - routine never returns, so put this last in the main function */
Scheduler_Start();
}
示例9: CDC_Init
void CDC_Init(void)
{
u8CDCState=0;
/* USB Initialization */
USB_Init();
/** Enable SOF ouput */
PORTC_PCR7 |= PORT_PCR_MUX(3);
/* Line Coding Initialization */
//LineCoding.DTERate=LWordSwap(9600);
LineCoding.DTERate=(9600);
LineCoding.CharFormat=0;
LineCoding.ParityType=0;
LineCoding.Databits=0x08;
/* Initialize Data Buffers */
Buffer_Init(CDC_OUT_Data,CDC_BUFFER_SIZE);
}
示例10: SetupHardware
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
MCUSR = 0;
/* Disable watchdog if enabled by bootloader/fuses */
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
serial_init();
GlobalInterruptEnable();
/* Hardware Initialization */
LEDs_Init();
while(!started);
USB_Init();
}
示例11: SetupHardware
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
//LEDs_Init();
USB_Init();
TWI_Init();
/*
PCICR |= (1 << PCIE0); // enable PCMSK0 scan on PCIE0
PCMSK0 |= (1 << PCINT7); // PCINT7 (PB7) to trigger interrupt on pin change
sei();
*/
}
示例12: SetupHardware
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Start the PLL to multiply the 2MHz RC oscillator to 32MHz and switch the CPU core to run from it */
XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU);
XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL);
/* Start the 32MHz internal RC oscillator and start the DFLL to increase it to 48MHz using the USB SOF as a reference */
XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ);
XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB);
PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;
// LED
PORTD.DIRSET = PIN5_bm;
// DIR
PORTC.DIRSET = PIN1_bm;
// LED ON
PORTD.OUTSET = PIN5_bm;
// Receiving
PORTC.OUTCLR = PIN1_bm;
/* Hardware Initialization */
// USART RX/TX 1
/* PIN3 (TXD0) as output. */
PORTC.DIRSET = PIN3_bm;
/* PC2 (RXD0) as input. */
PORTC.DIRCLR = PIN2_bm;
USART_InterruptDriver_Initialize(&USART_data, &USART, USART_DREINTLVL_OFF_gc);
USART_RxdInterruptLevel_Set(USART_data.usart, USART_RXCINTLVL_LO_gc);
/* Enable global interrupts. */
sei();
USB_Init();
}
示例13: main
/** Main program entry point. This routine configures the hardware required by the application, then
* starts the scheduler to run the USB management task.
*/
int main(void)
{
/* After reset start bootloader? */
if ((AVR_IS_WDT_RESET()) && (boot_key == DFU_BOOT_KEY_VAL))
{
boot_key = 0;
Bootloader();
}
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
LEDs_Init();
/* Indicate USB not ready */
UpdateStatus(Status_USBNotReady);
/* Initialize Scheduler so that it can be used */
Scheduler_Init();
/* Initialize USB Subsystem */
USB_Init();
/* Initialize I/O lines */
//IO_Init();
/* Initialize Timers */
Timer_Init();
/* Initialize Motors */
Motor_Init();
/* Scheduling - routine never returns, so put this last in the main function */
Scheduler_Start();
}
示例14: PIOS_USB_Init
int32_t PIOS_USB_Init(uintptr_t * usb_id, const struct pios_usb_cfg * cfg)
{
PIOS_Assert(usb_id);
PIOS_Assert(cfg);
struct pios_usb_dev * usb_dev;
usb_dev = (struct pios_usb_dev *) PIOS_USB_alloc();
if (!usb_dev) goto out_fail;
/* Bind the configuration to the device instance */
usb_dev->cfg = cfg;
PIOS_USB_Reenumerate();
/*
* This is a horrible hack to make this available to
* the interrupt callbacks. This should go away ASAP.
*/
pios_usb_com_id = (uintptr_t) usb_dev;
/* Enable the USB Interrupts */
NVIC_Init((NVIC_InitTypeDef*)&usb_dev->cfg->irq.init);
/* Select USBCLK source */
RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5);
/* Enable the USB clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);
USB_Init();
USB_SIL_Init();
*usb_id = (uintptr_t) usb_dev;
return 0; /* No error */
out_fail:
return(-1);
}
示例15: main
int main (void)
{
SystemInit();
USBIOClkConfig();
/* P0.1 is push-button input, P2.0~3 are LED output. */
// LPC_GPIO2->DIR |= (0x1<<0)|(0x1<<1)|(0x1<<2)|(0x1<<3);
// LPC_GPIO0->DIR &= ~(0x1<<1);
/* 16-bit timer 0. */
// init_timer16(0, /*TIME_INTERVAL*/10);
// enable_timer16(0);
/* Set port 2_0 to output */
// GPIOSetDir( 2, 0, 1 );
USB_Init(); /* USB Initialization */
USB_Connect(TRUE); /* USB Connect */
while (1) /* Loop forever */
{
#if 0
/* I/O configuration and LED setting pending. */
if ( (timer16_0_counter > 0) && (timer16_0_counter <= 200) )
{
GPIOSetValue( 2, 0, 0 );
}
if ( (timer16_0_counter > 200) && (timer16_0_counter <= 400) )
{
GPIOSetValue( 2, 0, 1 );
}
else if ( timer16_0_counter > 400 )
{
timer16_0_counter = 0;
}
#endif
}
}