当前位置: 首页>>代码示例>>C++>>正文


C++ SetupHardware函数代码示例

本文整理汇总了C++中SetupHardware函数的典型用法代码示例。如果您正苦于以下问题:C++ SetupHardware函数的具体用法?C++ SetupHardware怎么用?C++ SetupHardware使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SetupHardware函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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();


	for (;;)
	{
		/* Only try to read in bytes from the CDC interface if the transmit buffer is not full */
		if (!(RingBuffer_IsFull(&USBtoUSART_Buffer)))
		{
			int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);

			/* Read bytes from the USB OUT endpoint into the USART transmit buffer */
			if (!(ReceivedByte < 0))
			  RingBuffer_Insert(&USBtoUSART_Buffer, ReceivedByte);
		}

		/* Check if the UART receive buffer flush timer has expired or the buffer is nearly full */
		uint16_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer);
		if ((BufferCount > (uint8_t)(sizeof(USARTtoUSB_Buffer_Data) * .75)))
		{

			/* Read bytes from the USART receive buffer into the USB IN endpoint */
			while (BufferCount--)
			{
				/* Try to send the next byte of data to the host, abort if there is an error without dequeuing */
				if (CDC_Device_SendByte(&VirtualSerial_CDC_Interface,
				                        RingBuffer_Peek(&USARTtoUSB_Buffer)) != ENDPOINT_READYWAIT_NoError)
				{
					break;
				}

				/* Dequeue the already sent byte from the buffer now we have confirmed that no transmission error occurred */
				RingBuffer_Remove(&USARTtoUSB_Buffer);
			}
		}

		/* Load the next byte from the USART transmit buffer into the USART */
		if (!(RingBuffer_IsEmpty(&USBtoUSART_Buffer))){
		  //Serial_SendByte(RingBuffer_Remove(&USBtoUSART_Buffer));
		}

		CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
		USB_USBTask();
	}
}
开发者ID:NeuronRobotics,项目名称:microcontroller-sample,代码行数:49,代码来源:USBtoSerial.c

示例2: 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 "HID Device Report Viewer Running.\r\n" ESC_FG_WHITE));

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	GlobalInterruptEnable();

	for (;;)
	{
		RetrieveDeviceData();

		HID_Host_USBTask(&Device_HID_Interface);
		USB_USBTask();
	}
}
开发者ID:chicagoedt,项目名称:Firmware,代码行数:20,代码来源:HIDReportViewer.c

示例3: 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 "Still Image Host Demo running.\r\n" ESC_FG_WHITE));

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	GlobalInterruptEnable();

	for (;;)
	{
		StillImageHost_Task();

		SI_Host_USBTask(&DigitalCamera_SI_Interface);
		USB_USBTask();
	}
}
开发者ID:40000ft,项目名称:lufa,代码行数:20,代码来源:StillImageHost.c

示例4: 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();

	CmdState = CMD_STOP;

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	sei();

	for (;;)
	{
		Read_Joystick_Status();
	
		HID_Host_Task();
		USB_USBTask();
	}
}
开发者ID:Andrew0Hill,项目名称:keyboard,代码行数:20,代码来源:MissileLauncher.c

示例5: 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 "CDC Host Demo running.\r\n" ESC_FG_WHITE));

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	GlobalInterruptEnable();

	for (;;)
	{
		CDCHost_Task();

		CDC_Host_USBTask(&VirtualSerial_CDC_Interface);
		USB_USBTask();
	}
}
开发者ID:0tsuki,项目名称:qmk_firmware,代码行数:20,代码来源:VirtualSerialHost.c

示例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();

	CmdState = CMD_STOP;

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	GlobalInterruptEnable();

	for (;;)
	{
		Read_Joystick_Status();
		DiscardNextReport();

		USB_USBTask();
	}
}
开发者ID:abcminiuser,项目名称:lufa,代码行数:20,代码来源:MissileLauncher.c

示例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();

	puts_P(PSTR(ESC_FG_CYAN "Android Accessory Host Demo running.\r\n" ESC_FG_WHITE));

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	GlobalInterruptEnable();

	for (;;)
	{
		AOAHost_Task();

		AOA_Host_USBTask(&AndroidDevice_AOA_Interface);
		USB_USBTask();
	}
}
开发者ID:BirdBrainTechnologies,项目名称:HummingbirdDuoFirmware,代码行数:20,代码来源:AndroidAccessoryHost.c

示例8: 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 "RNDIS Host Demo running.\r\n" ESC_FG_WHITE));

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	sei();

	for (;;)
	{
		RNDISHost_Task();

		RNDIS_Host_USBTask(&Ethernet_RNDIS_Interface);
		USB_USBTask();
	}
}
开发者ID:ASHOK1991,项目名称:lb-Arduino-Code,代码行数:20,代码来源:RNDISEthernetHost.c

示例9: 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 "Keyboard Host Demo running.\r\n" ESC_FG_WHITE));

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	GlobalInterruptEnable();

	for (;;)
	{
		KeyboardHost_Task();

		HID_Host_USBTask(&Keyboard_HID_Interface);
		USB_USBTask();
	}
}
开发者ID:0tsuki,项目名称:qmk_firmware,代码行数:20,代码来源:KeyboardHostWithParser.c

示例10: 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)
{
	//RFCOMM_SendFrame(0x10003000,0x10003004,4,4,130,0x10003200);
	uint16_t tick;
	SetupHardware();

	LPC_TIM0->TCR = 1;
	Led1On();
	Led2On();
	Led1Off();
	Led2Off();

	EVENT_USB_Host_DeviceUnattached();
		
	for (;;)
	{
		//uint8_t ButtonStatus = Buttons_GetStateMask();

	
		/* Check if the system update interval has elapsed */
		if(LPC_TIM0->IR &0x01)
		{
			/* Clear the timer compare flag */
			LPC_TIM0->IR |= 0x01;
			if (RFCOMM_SensorStream){
				Led1On();
			}
			else{
				if(tick++>=50)
				{
					tick = 0;
					Led1Not();
				}
			}
			/* If the bluetooth stack is active, manage timeouts within each layer */
			BluetoothAdapter_TickElapsed();
			KeyScan();
			if(sendFlag){
				rfcomm_send_data();
			}	
		}
		
		BluetoothAdapter_USBTask();
		USB_USBTask();
	}
}
开发者ID:Martin-P,项目名称:lpc1768-control-bluetooth-dongle,代码行数:49,代码来源:BluetoothRobot.c

示例11: main

/** Main program entry point. This routine configures the hardware required by the application, then
 *  starts the scheduler to run the application tasks.
 */
int main(void)
{
	SetupHardware();

	/* Ring buffer Initialization */
	Buffer_Initialize(&Rx_Buffer);
	Buffer_Initialize(&Tx_Buffer);

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	
	for (;;)
	{
		CDC_Task();
        PENPROG_Task();
		USB_USBTask();
	}
}
开发者ID:theojulienne,项目名称:penprog-firmware,代码行数:20,代码来源:USBtoSerial.c

示例12: main

/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
 *  runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start
 *  the loaded application code.
 */
int main(void)
{
	/* Setup hardware required for the bootloader */
	SetupHardware();

	/* Turn on first LED on the board to indicate that the bootloader has started */
	LEDs_SetAllLEDs(LEDS_LED1);

	/* Fill in the UUID Report */
	/* Bootloader ID */
	UUIDReport[0] = BOOTLOADER_ID_SIG >> 8;
	UUIDReport[1] = BOOTLOADER_ID_SIG & 0xFF;
	/* Bootloader Version */
	UUIDReport[2] = BOOTLOADER_VERSION_SIG >> 8;
	UUIDReport[3] = BOOTLOADER_VERSION_SIG & 0xFF;
	/* Device ID */
	for (size_t i = 4; i < UUID_SIZE; i++)
	{
		UUIDReport[i] = eeprom_read_byte((uint8_t*)(intptr_t)(i));
	}

	/* Enable global interrupts so that the USB stack can function */
	GlobalInterruptEnable();

	while (RunBootloader)
	{
		MIDI_Task();
		CDC_Task();
		MIDI_Device_USBTask(&Keyboard_MIDI_Interface);
		USB_USBTask();
	}

	/* Wait a short time to end all USB transactions and then disconnect */
	_delay_us(1000);

	/* Disconnect from the host - USB interface will be reset later along with the AVR */
	USB_Detach();

	/* Unlock the forced application start mode of the bootloader if it is restarted */
	MagicBootKey = MAGIC_BOOT_KEY;

	/* Enable the watchdog and force a timeout to reset the AVR */
	wdt_enable(WDTO_250MS);

	for (;;);
}
开发者ID:Quirkbot,项目名称:QuirkbotArduinoHardware,代码行数:50,代码来源:QuirkbotBootloader.c

示例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)
{
	SetupHardware();

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	sei();

	for (;;)
	{
		if (CurrentFirmwareMode == MODE_USART_BRIDGE)
		  UARTBridge_Task();
		else
		  AVRISP_Task();

		USB_USBTask();
	}
}
开发者ID:softants,项目名称:lufa-lib,代码行数:20,代码来源:XPLAINBridge.c

示例14: 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 Demo running.\r\n" ESC_FG_WHITE));

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	sei();

	for (;;)
	{
		MouseHost_Task();

		HID_Host_USBTask(&Mouse_HID_Interface);
		USB_USBTask();
	}
}
开发者ID:12019,项目名称:mooltipass,代码行数:20,代码来源:MouseHost.c

示例15: 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 "Printer Host Demo running.\r\n" ESC_FG_WHITE));

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	sei();

	for (;;)
	{
		PrinterHost_Task();

		PRNT_Host_USBTask(&Printer_PRNT_Interface);
		USB_USBTask();
	}
}
开发者ID:Armadill0,项目名称:CANBus-Triple_Genesis-Connect,代码行数:20,代码来源:PrinterHost.c


注:本文中的SetupHardware函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。