本文整理汇总了C++中HID_Device_USBTask函数的典型用法代码示例。如果您正苦于以下问题:C++ HID_Device_USBTask函数的具体用法?C++ HID_Device_USBTask怎么用?C++ HID_Device_USBTask使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HID_Device_USBTask函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
SetupHardware();
/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */
CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
GlobalInterruptEnable();
while(1)
{
DebounceUpdate();
EncoderUpdate();
LedUpdate();
SendSerial();
/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
HID_Device_USBTask(&Mouse_HID_Interface);
HID_Device_USBTask(&Keyboard_HID_Interface);
USB_USBTask();
}
}
示例2: main
int
main(void)
{
initHardware();
sei();
kbdInit();
scanInit();
layersInit();
macrosInit();
expLoad();
_delay_ms(5);
scanEnable();
/* try loading vref from eeprom; if set to 0xffff, run calibration */
vrefLoad();
if (vrefGet() == 0xffff)
kbdCalibrate();
for (;;) {
/* try to keep updates synchronous; we don't want to update
* bitmap if we haven't sent the last report yet.
*/
if (( usingNKROReport() && !updateNKROReport) ||
(!usingNKROReport() && !updateKeyboardReport)) {
bool needsUpdate = false;
needsUpdate |= kbdUpdateSCBmp();
needsUpdate |= macrosProcessScan();
needsUpdate |= expProcessScan(needsUpdate);
if (needsUpdate) {
updateKeyboardReport = true;
updateNKROReport = true;
updateSystemReport = true;
updateConsumerReport = true;
}
layersProcessScan();
}
if (USB_DeviceState == DEVICE_STATE_Unattached ||
USB_DeviceState == DEVICE_STATE_Suspended)
if (USB_Device_RemoteWakeupEnabled && kbdWantsWakeup())
USB_Device_SendRemoteWakeup();
HID_Device_USBTask(&keyboardHIDIface);
HID_Device_USBTask(&genericHIDIface);
HID_Device_USBTask(&nkroHIDIface);
HID_Device_USBTask(&extrakeyHIDIface);
USB_USBTask();
}
}
示例3: main
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
for (;;)
{
HID_Device_USBTask(&Keyboard_HID_Interface);
HID_Device_USBTask(&Mouse_HID_Interface);
USB_USBTask();
}
}
示例4: main
/**
* @brief Main program entry point
* @return Will not return
* @note This routine contains the overall program flow, including initial
* setup of all components and the main program loop
*/
int main(void)
{
SetupHardware();
for (;; ) {
#if defined(USB_DEVICE_ROM_DRIVER)
USB_MouseReport_Data_t report;
uint16_t reportsize;
uint8_t reportID = 0;
memset(&report, 0, sizeof(USB_MouseReport_Data_t));
CALLBACK_HID_Device_CreateHIDReport(&Mouse_HID_Interface, &reportID, HID_REPORT_ITEM_In, &report, &reportsize);
if (memcmp(&report, Mouse_HID_Interface.Config.PrevReportINBuffer,
Mouse_HID_Interface.Config.PrevReportINBufferSize)) {
memcpy(Mouse_HID_Interface.Config.PrevReportINBuffer,
&report,
Mouse_HID_Interface.Config.PrevReportINBufferSize);
CALLBACK_UsbdHid_SetReportChange(true);
}
#else
HID_Device_USBTask(&Mouse_HID_Interface);
USB_USBTask(Mouse_HID_Interface.Config.PortNumber, USB_MODE_Device);
#endif
}
}
示例5: main
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
stdout=&mystdout;
stdin=&mystdin;
SetupHardware();
//LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
//Eval Prototype Sharp Reset Pin
//DDRB &= ~RESET_PIN; //Set Input
//PORTB |= RESET_PIN; //Set High
//DDRB |= RESET_PIN; //Set Output
//Drude Sharp LCD Reset PIN
PORTF |= RESETN_PIN; //Set High
DDRF |= RESETN_PIN; //Set Output
//Digitizer Interrupt
//DDRB &= ~(_BV(7)); //PB7 input
//PORTB &= ~(1<<PB7); //PB7 low
PORTB |= (_BV(7)); //Set high (input pullup)
//IP4787CZ32Y HDMI ESD interface chip (HDMI_ACT PIN) Active-High (Test-Point 12)
PORTF |= (_BV(PF1)); //Set high (input pullup)
//Toshiba Interrupt Pin
PORTE |= (_BV(PE6)); //Set high (input pullup)
//Toshiba Standby Pin
PORTF |= (_BV(PF4)); //Set high (input pullup)
//Toshiba Reset Pin - Active Low
PORTC |= (_BV(PC7)); //Set high (input pullup)
//LCD-CABC
//PORTF |= (_BV(PF7)); //Set high (defaults to input pullup)
//DDRF &= ~(_BV(PF7)); //Set output
//PORTF |= (_BV(PF7)); //Set low
//LED-PWM
PORTD |= (_BV(PD6)); //Set high (defaults to input pullup)
//PORTD &= ~(_BV(PD6)); //Set low
//DDRD &= ~(_BV(PD6)); //Set output
RingBuffer_InitBuffer(&FromHost_Buffer, FromHost_Buffer_Data, sizeof(FromHost_Buffer_Data));
init_screen(0x1F); //magic number!
mxt_list_types();
for (;;)
{
HandleSerial();
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
HID_Device_USBTask(&Digitizer_HID_Interface);
USB_USBTask();
HandleDigitizer();
}
}
示例6: main
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
int main(void)
{
SetupHardware();
puts_P(PSTR(ESC_FG_CYAN "Mouse Host/Device Demo running.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
for (;;)
{
/* Determine which USB mode we are currently in */
if (USB_CurrentMode == USB_MODE_Host)
{
MouseHostTask();
HID_Host_USBTask(&Mouse_HID_Host_Interface);
}
else
{
HID_Device_USBTask(&Mouse_HID_Device_Interface);
}
USB_USBTask();
}
}
示例7: main
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
int main(void)
{
SetupHardware();
RingBuffer_InitBuffer(&USARTtoUSB_Buffer);
sei();
for (;;)
{
HID_Device_USBTask(&Surface_HID_Interface);
USB_USBTask();
/* Turn off the Tx LED when the tick count reaches zero */
if (led1_ticks)
{
led1_ticks--;
if (led1_ticks == 0)
{
LEDs_TurnOffLEDs(LEDS_LED1);
}
}
/* Turn off the Rx LED when the tick count reaches zero */
if (led2_ticks)
{
led2_ticks--;
if (led2_ticks == 0)
{
LEDs_TurnOffLEDs(LEDS_LED2);
}
}
}
}
示例8: main
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
uint32_t last = 0;
/* init fifo */
fifo_init(&fifo, fifo_buffer, sizeof(fifo_buffer));
/* setup hardware (button, LED, rtc...) */
SetupHardware();
/* enable interrupts */
sei();
/* main loop */
while(1)
{
/* if button pressed */
if (!(BUTTON_PIN & (1 << BUTTON)))
{
/* ignore if last button was pressed less than DELTA_T */
if(get_time() > (last+DELTA_T))
{
/* generate token and send it to host */
token();
last = get_time();
}
}
/* USB tasks */
HID_Device_USBTask(&Keyboard_HID_Interface);
USB_USBTask();
}
}
示例9: main
int main(void)
{
USB_Init();
colors[0] = rgb8(0x30, 0x30, 0x30);
colors[1] = rgb8(0x30, 0x30, 0x30);
colors[2] = rgb8(0x30, 0x30, 0x30);
DDRC = _BV(DDC6);
PORTC = 0;
DDRD = _BV(DDD6);
//set SS, SCK, and MOSI to outputs
DDRB |= _BV(DDB0) | _BV(DDB1) | _BV(DDB2);
//SS low
PORTB &= ~_BV(PORTB0);
//clock normally low, clocked on rising edges, at osc/2
SPSR = 0; //_BV(SPI2X);
SPCR = _BV(SPIE) | _BV(MSTR) | _BV(SPE) | _BV(SPR0);
//16M / (2083 * 64) = 120.02hz
OCR3A = 2082;
//interrupt on overflow
TIMSK3 = _BV(OCIE3A);
//do nothing on counter match
//CTC, TOP is OCR3A
//timer prescale is 64
TCCR3A = 0;
TCCR3C = 0;
TCCR3B = _BV(WGM32) | _BV(CS31) | _BV(CS30);
sei();
while(true) {
if (refreshFrame) {
PORTC |= _BV(PORTC6);
//copy out of volatile
unsigned long now = millis;
float scale = 0.1f + 0.9f * (sin(2.0 * M_PI * now / 3000.0f) + 1.0) / 2.0;
for (unsigned char i = 0, idx = 0; i < 32; ++i) {
buffer[idx++] = colors[i].b * scale;
buffer[idx++] = colors[i].g * scale;
buffer[idx++] = colors[i].r * scale;
}
PORTC &= ~_BV(PORTC6);
refreshFrame = false;
}
HID_Device_USBTask(&Generic_HID_Interface);
USB_USBTask();
//sleep_mode();
}
}
示例10: main
int main(void) {
SetupHardware();
GlobalInterruptEnable();
for (;;) {
HID_Device_USBTask(&Joystick_HID_Interface);
USB_USBTask();
}
}
示例11: usb_tasks
void usb_tasks(void)
{
MS_Device_USBTask(&Disk_MS_Interface);
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
HID_Device_USBTask(&Keyboard_HID_Interface);
USB_USBTask();
if(usb_keyboard_sending_string_GLOBAL)
usb_keyboard_service_write();
}
示例12: main
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
setupHardware();
init_CIM_frame();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
for (;;)
{
parse_CIM_protocol();
HID_Device_USBTask(&Keyboard_HID_Interface);
parse_CIM_protocol();
HID_Device_USBTask(&Mouse_HID_Interface);
parse_CIM_protocol();
HID_Device_USBTask(&Joystick_HID_Interface);
parse_CIM_protocol();
USB_USBTask();
}
}
示例13: main
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
GlobalInterruptEnable();
initialize_hardware();
while (true) {
matrix_scan();
HID_Device_USBTask(&Keyboard_HID_Interface);
USB_USBTask();
}
}
示例14: main
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
for (;;)
{
HID_Device_USBTask(&MediaControl_HID_Interface);
USB_USBTask();
}
}
示例15: main
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
HID_Device_USBTask(&Device_HID_Interface);
USB_USBTask();
}
}