當前位置: 首頁>>代碼示例>>C++>>正文


C++ Buttons_GetStatus函數代碼示例

本文整理匯總了C++中Buttons_GetStatus函數的典型用法代碼示例。如果您正苦於以下問題:C++ Buttons_GetStatus函數的具體用法?C++ Buttons_GetStatus怎麽用?C++ Buttons_GetStatus使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Buttons_GetStatus函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: CALLBACK_HID_Device_CreateHIDReport

/** HID class driver callback function for the creation of HID reports to the host.
 *
 *  \param[in]     HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced
 *  \param[in,out] ReportID    Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
 *  \param[in]     ReportType  Type of the report to create, either HID_REPORT_ITEM_In or HID_REPORT_ITEM_Feature
 *  \param[out]    ReportData  Pointer to a buffer where the created report should be stored
 *  \param[out]    ReportSize  Number of bytes written in the report (or zero if no report is to be sent)
 *
 *  \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
 */
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
                                         uint8_t* const ReportID,
                                         const uint8_t ReportType,
                                         void* ReportData,
                                         uint16_t* const ReportSize)
{
	USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;

	uint8_t JoyStatus_LCL    = Joystick_GetStatus();
	uint8_t ButtonStatus_LCL = Buttons_GetStatus();

	uint8_t UsedKeyCodes = 0;

	if (JoyStatus_LCL & JOY_UP)
	  KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_A;
	else if (JoyStatus_LCL & JOY_DOWN)
	  KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_B;

	if (JoyStatus_LCL & JOY_LEFT)
	  KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_C;
	else if (JoyStatus_LCL & JOY_RIGHT)
	  KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_D;

	if (JoyStatus_LCL & JOY_PRESS)
	  KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_E;

	if (ButtonStatus_LCL & BUTTONS_BUTTON1)
	  KeyboardReport->KeyCode[UsedKeyCodes++] = HID_KEYBOARD_SC_F;

	if (UsedKeyCodes)
	  KeyboardReport->Modifier = HID_KEYBOARD_MODIFIER_LEFTSHIFT;

	*ReportSize = sizeof(USB_KeyboardReport_Data_t);
	return false;
}
開發者ID:BrazzoduroArduino,項目名稱:Dougs-Arduino-Stuff,代碼行數:45,代碼來源:Keyboard.c

示例2: Keyboard_UpdateReport

/* Routine to update keyboard state */
static void Keyboard_UpdateReport(void)
{
	uint8_t joystick_status = Joystick_GetStatus();

	HID_KEYBOARD_CLEAR_REPORT(&g_keyBoard.report[0]);

	switch (joystick_status) {
	case JOY_PRESS:
		HID_KEYBOARD_REPORT_SET_KEY_PRESS(g_keyBoard.report, 0x53);
		break;

	case JOY_LEFT:
		HID_KEYBOARD_REPORT_SET_KEY_PRESS(g_keyBoard.report, 0x5C);
		break;

	case JOY_RIGHT:
		HID_KEYBOARD_REPORT_SET_KEY_PRESS(g_keyBoard.report, 0x5E);
		break;

	case JOY_UP:
		HID_KEYBOARD_REPORT_SET_KEY_PRESS(g_keyBoard.report, 0x60);
		break;

	case JOY_DOWN:
		HID_KEYBOARD_REPORT_SET_KEY_PRESS(g_keyBoard.report, 0x5A);
		break;
	
	case NO_BUTTON_PRESSED:
		if (Buttons_GetStatus() != NO_BUTTON_PRESSED)
			HID_KEYBOARD_REPORT_SET_KEY_PRESS(g_keyBoard.report, 0x57);
		break;
	}
}
開發者ID:fcladera,項目名稱:ciaa_lpcopen_bare,代碼行數:34,代碼來源:hid_keyboard.c

示例3: CALLBACK_HID_Device_CreateHIDReport

/** HID class driver callback function for the creation of HID reports to the host.
 *
 *  \param[in] HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced
 *  \param[in,out] ReportID  Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
 *  \param[in] ReportType  Type of the report to create, either REPORT_ITEM_TYPE_In or REPORT_ITEM_TYPE_Feature
 *  \param[out] ReportData  Pointer to a buffer where the created report should be stored
 *  \param[out] ReportSize  Number of bytes written in the report (or zero if no report is to be sent
 *
 *  \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
 */
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
                                         const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
{
	USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
		
	uint8_t JoyStatus_LCL    = Joystick_GetStatus();
	uint8_t ButtonStatus_LCL = Buttons_GetStatus();

	if (JoyStatus_LCL & JOY_UP)
	  MouseReport->Y = -1;
	else if (JoyStatus_LCL & JOY_DOWN)
	  MouseReport->Y =  1;

	if (JoyStatus_LCL & JOY_RIGHT)
	  MouseReport->X =  1;
	else if (JoyStatus_LCL & JOY_LEFT)
	  MouseReport->X = -1;

	if (JoyStatus_LCL & JOY_PRESS)
	  MouseReport->Button  = (1 << 0);
	  
	if (ButtonStatus_LCL & BUTTONS_BUTTON1)
	  MouseReport->Button |= (1 << 1);
	
	*ReportSize = sizeof(USB_MouseReport_Data_t);
	return true;
}
開發者ID:boris-arzur,項目名稱:SafecastBGeigie,代碼行數:37,代碼來源:DeviceFunctions.c

示例4: CALLBACK_HID_Device_CreateHIDReport

/** HID class driver callback function for the creation of HID reports to the host.
 *
 *  \param[in] HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced
 *  \param[in,out] ReportID  Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
 *  \param[in] ReportType  Type of the report to create, either REPORT_ITEM_TYPE_In or REPORT_ITEM_TYPE_Feature
 *  \param[out] ReportData  Pointer to a buffer where the created report should be stored
 *  \param[out] ReportSize  Number of bytes written in the report (or zero if no report is to be sent
 *
 *  \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
 */
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
                                         const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
{
	USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
	
	uint8_t JoyStatus_LCL    = Joystick_GetStatus();
	uint8_t ButtonStatus_LCL = Buttons_GetStatus();

	KeyboardReport->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT;

	if (JoyStatus_LCL & JOY_UP)
	  KeyboardReport->KeyCode[0] = 0x04; // A
	else if (JoyStatus_LCL & JOY_DOWN)
	  KeyboardReport->KeyCode[0] = 0x05; // B

	if (JoyStatus_LCL & JOY_LEFT)
	  KeyboardReport->KeyCode[0] = 0x06; // C
	else if (JoyStatus_LCL & JOY_RIGHT)
	  KeyboardReport->KeyCode[0] = 0x07; // D

	if (JoyStatus_LCL & JOY_PRESS)
	  KeyboardReport->KeyCode[0] = 0x08; // E
	  
	if (ButtonStatus_LCL & BUTTONS_BUTTON1)
	  KeyboardReport->KeyCode[0] = 0x09; // F
	
	*ReportSize = sizeof(USB_KeyboardReport_Data_t);
	return false;
}
開發者ID:Andrew0Hill,項目名稱:keyboard,代碼行數:39,代碼來源:MassStorageKeyboard.c

示例5: ISR

/** ISR to handle the reloading of the PWM timer with the next sample. */
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
	uint8_t PrevPipe = Pipe_GetCurrentPipe();

	/* Check that the USB bus is ready for the next sample to write */
	if (Audio_Host_IsReadyForNextSample(&Speaker_Audio_Interface))
	{
		int16_t AudioSample;

		#if defined(USE_TEST_TONE)
			static uint8_t SquareWaveSampleCount;
			static int16_t CurrentWaveValue;
			
			/* In test tone mode, generate a square wave at 1/256 of the sample rate */
			if (SquareWaveSampleCount++ == 0xFF)
			  CurrentWaveValue ^= 0x8000;
			
			/* Only generate audio if the board button is being pressed */
			AudioSample = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0;
		#else
			/* Audio sample is ADC value scaled to fit the entire range */
			AudioSample = ((SAMPLE_MAX_RANGE / ADC_MAX_RANGE) * ADC_GetResult());

			#if defined(MICROPHONE_BIASED_TO_HALF_RAIL)
			/* Microphone is biased to half rail voltage, subtract the bias from the sample value */
			AudioSample -= (SAMPLE_MAX_RANGE / 2);
			#endif
		#endif
		
		Audio_Host_WriteSample16(&Speaker_Audio_Interface, AudioSample);	
		Audio_Host_WriteSample16(&Speaker_Audio_Interface, AudioSample);
	}
	
	Pipe_SelectPipe(PrevPipe);
}
開發者ID:abbaad,項目名稱:Sun5c,代碼行數:36,代碼來源:AudioOutputHost.c

示例6: main

int main(void)
{
    uint_reg_t Dummy;

    /* =============================
     *     Buttons Compile Check
     * ============================= */
    // cppcheck-suppress redundantAssignment
    Dummy = BUTTONS_BUTTON1;
    Buttons_Init();
    // cppcheck-suppress redundantAssignment
    Dummy = Buttons_GetStatus();
    Buttons_Disable();

    /* =============================
     *    Dataflash Compile Check
     * ============================= */
    // cppcheck-suppress redundantAssignment
    Dummy = DATAFLASH_TOTALCHIPS + DATAFLASH_NO_CHIP + DATAFLASH_CHIP1 + DATAFLASH_PAGE_SIZE + DATAFLASH_PAGES;
    Dataflash_Init();
    Dataflash_TransferByte(0);
    Dataflash_SendByte(0);
    // cppcheck-suppress redundantAssignment
    Dummy = Dataflash_ReceiveByte();
    // cppcheck-suppress redundantAssignment
    Dummy = Dataflash_GetSelectedChip();
    Dataflash_SelectChip(DATAFLASH_CHIP1);
    Dataflash_DeselectChip();
    Dataflash_SelectChipFromPage(0);
    Dataflash_ToggleSelectedChipCS();
    Dataflash_WaitWhileBusy();
    Dataflash_SendAddressBytes(0, 0);

    /* =============================
     *       LEDs Compile Check
     * ============================= */
    // cppcheck-suppress redundantAssignment
    Dummy = LEDS_LED1 + LEDS_LED2 + LEDS_LED3 + LEDS_LED4;
    LEDs_Init();
    LEDs_TurnOnLEDs(LEDS_ALL_LEDS);
    LEDs_TurnOffLEDs(LEDS_ALL_LEDS);
    LEDs_SetAllLEDs(LEDS_ALL_LEDS);
    LEDs_ChangeLEDs(LEDS_ALL_LEDS, LEDS_NO_LEDS);
    LEDs_ToggleLEDs(LEDS_ALL_LEDS);
    // cppcheck-suppress redundantAssignment
    Dummy = LEDs_GetLEDs();
    LEDs_Disable();

    /* =============================
     *     Joystick Compile Check
     * ============================= */
    // cppcheck-suppress redundantAssignment
    Dummy = JOY_LEFT + JOY_RIGHT + JOY_UP + JOY_DOWN + JOY_PRESS;
    Joystick_Init();
    // cppcheck-suppress redundantAssignment
    Dummy = Joystick_GetStatus();
    Joystick_Disable();

    (void)Dummy;
}
開發者ID:2k0ri,項目名稱:qmk_firmware,代碼行數:60,代碼來源:Test.c

示例7: CALLBACK_HID_Device_CreateHIDReport

/* HID class driver callback function for the creation of HID reports to the host */
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo,
										 uint8_t *const ReportID,
										 const uint8_t ReportType,
										 void *ReportData,
										 uint16_t *const ReportSize)
{
	uint8_t *Data = (uint8_t *) ReportData;
	uint8_t JoyStatus_LCL    = Joystick_GetStatus();
	uint8_t ButtonStatus_LCL = Buttons_GetStatus();
	uint8_t ret = 0;

	if (JoyStatus_LCL & JOY_UP) {
		ret |= 0x01;
	}
	if (JoyStatus_LCL & JOY_LEFT) {
		ret |= 0x02;
	}
	if (JoyStatus_LCL & JOY_RIGHT) {
		ret |= 0x04;
	}
	if (JoyStatus_LCL & JOY_PRESS) {
		ret |= 0x08;
	}
	if (JoyStatus_LCL & JOY_DOWN) {
		ret |= 0x10;
	}
	if (ButtonStatus_LCL & BUTTONS_BUTTON1) {
		ret |= 0x20;
	}

	Data[0] = ret;

	*ReportSize = GENERIC_REPORT_SIZE;
	return false;
}
開發者ID:edarring,項目名稱:lpcopen,代碼行數:36,代碼來源:GenericHID.c

示例8: Keyboard_HID_Task

/** Keyboard task. This generates the next keyboard HID report for the host, and transmits it via the
 *  keyboard IN endpoint when the host is ready for more data. Additionally, it processes host LED status
 *  reports sent to the device via the keyboard OUT reporting endpoint.
 */
void Keyboard_HID_Task(void)
{
	uint8_t JoyStatus_LCL = Joystick_GetStatus();

	/* Device must be connected and configured for the task to run */
	if (USB_DeviceState != DEVICE_STATE_Configured)
	  return;

	/* Check if board button is not pressed, if so mouse mode enabled */
	if (!(Buttons_GetStatus() & BUTTONS_BUTTON1))
	{
		/* Make sent key uppercase by indicating that the left shift key is pressed */
		KeyboardReportData.Modifier = KEYBOARD_MODIFER_LEFTSHIFT;

		if (JoyStatus_LCL & JOY_UP)
		  KeyboardReportData.KeyCode[0] = 0x04; // A
		else if (JoyStatus_LCL & JOY_DOWN)
		  KeyboardReportData.KeyCode[0] = 0x05; // B

		if (JoyStatus_LCL & JOY_LEFT)
		  KeyboardReportData.KeyCode[0] = 0x06; // C
		else if (JoyStatus_LCL & JOY_RIGHT)
		  KeyboardReportData.KeyCode[0] = 0x07; // D

		if (JoyStatus_LCL & JOY_PRESS)
		  KeyboardReportData.KeyCode[0] = 0x08; // E
	}

	/* Select the Keyboard Report Endpoint */
	Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM);

	/* Check if Keyboard Endpoint Ready for Read/Write */
	if (Endpoint_IsReadWriteAllowed())
	{
		/* Write Keyboard Report Data */
		Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData));

		/* Finalize the stream transfer to send the last packet */
		Endpoint_ClearIN();

		/* Clear the report data afterwards */
		memset(&KeyboardReportData, 0, sizeof(KeyboardReportData));
	}

	/* Select the Keyboard LED Report Endpoint */
	Endpoint_SelectEndpoint(KEYBOARD_OUT_EPNUM);

	/* Check if Keyboard LED Endpoint Ready for Read/Write */
	if (Endpoint_IsReadWriteAllowed())
	{		
		/* Read in and process the LED report from the host */
		Keyboard_ProcessLEDReport(Endpoint_Read_Byte());

		/* Handshake the OUT Endpoint - clear endpoint and ready for next report */
		Endpoint_ClearOUT();
	}
}
開發者ID:emcute0319,項目名稱:ir-usb-kbd,代碼行數:61,代碼來源:KeyboardMouse.c

示例9: CALLBACK_HID_Device_CreateHIDReport

/** HID class driver callback function for the creation of HID reports to the host.
 *
 *  \param[in] HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced
 *  \param[in,out] ReportID  Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
 *  \param[out] ReportData  Pointer to a buffer where the created report should be stored
 *  \param[out] ReportSize  Number of bytes written in the report (or zero if no report is to be sent
 *
 *  \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
 */
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
                                         void* ReportData, uint16_t* ReportSize)
{
	uint8_t JoyStatus_LCL    = Joystick_GetStatus();
	uint8_t ButtonStatus_LCL = Buttons_GetStatus();

	/* Determine which interface must have its report generated */
	if (HIDInterfaceInfo == &Keyboard_HID_Interface)
	{
		USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
		
		/* If first board button not being held down, no keyboard report */
		if (!(ButtonStatus_LCL & BUTTONS_BUTTON1))
		  return 0;
		
		if (JoyStatus_LCL & JOY_UP)
		  KeyboardReport->KeyCode[0] = 0x04; // A
		else if (JoyStatus_LCL & JOY_DOWN)
		  KeyboardReport->KeyCode[0] = 0x05; // B

		if (JoyStatus_LCL & JOY_LEFT)
		  KeyboardReport->KeyCode[0] = 0x06; // C
		else if (JoyStatus_LCL & JOY_RIGHT)
		  KeyboardReport->KeyCode[0] = 0x07; // D

		if (JoyStatus_LCL & JOY_PRESS)
		  KeyboardReport->KeyCode[0] = 0x08; // E
		
		*ReportSize = sizeof(USB_KeyboardReport_Data_t);
		return false;
	}
	else
	{
		USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;

		/* If first board button being held down, no mouse report */
		if (ButtonStatus_LCL & BUTTONS_BUTTON1)
		  return 0;
		  
		if (JoyStatus_LCL & JOY_UP)
		  MouseReport->Y = -1;
		else if (JoyStatus_LCL & JOY_DOWN)
		  MouseReport->Y =  1;

		if (JoyStatus_LCL & JOY_LEFT)
		  MouseReport->X = -1;
		else if (JoyStatus_LCL & JOY_RIGHT)
		  MouseReport->X =  1;

		if (JoyStatus_LCL & JOY_PRESS)
		  MouseReport->Button  = (1 << 0);
		
		*ReportSize = sizeof(USB_MouseReport_Data_t);
		return true;		
	}
}
開發者ID:TomMD,項目名稱:teensy,代碼行數:65,代碼來源:KeyboardMouse.c

示例10: taskPulsador

void taskPulsador(void * pvParameters)
{
	uint8_t state = NO_OPRIMIDO;

	while(1)
	{
		switch(state)
		{
			case NO_OPRIMIDO:
				if(Buttons_GetStatus(SW4) == 1)
				{
					setTickCounter(0);
					state = ANTIRREBOTE;
					vTaskDelay(20/portTICK_RATE_MS);
				}
				else
				{
					vTaskDelay(100/portTICK_RATE_MS);
				}
				break;
			case ANTIRREBOTE:
				if(Buttons_GetStatus(SW4) == 1)
				{
					state = OPRIMIDO;
				}
				else
				{
					state = NO_OPRIMIDO;
				}
				break;
			case OPRIMIDO:
				if(Buttons_GetStatus(SW4) != 1)
				{
					tiempoOprimido = (getTickCounter() < 1000)?getTickCounter():999;
					state = NO_OPRIMIDO;
				}
				break;
			default:
				break;
		}
	}
}
開發者ID:devtodev,項目名稱:NXP,代碼行數:42,代碼來源:main.c

示例11: CALLBACK_HID_Device_CreateHIDReport

/** HID class driver callback function for the creation of HID reports to the host.
 *
 *  \param[in]     HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced
 *  \param[in,out] ReportID    Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
 *  \param[in]     ReportType  Type of the report to create, either HID_REPORT_ITEM_In or HID_REPORT_ITEM_Feature
 *  \param[out]    ReportData  Pointer to a buffer where the created report should be stored
 *  \param[out]    ReportSize  Number of bytes written in the report (or zero if no report is to be sent)
 *
 *  \return Boolean \c true to force the sending of the report, \c false to let the library determine if it needs to be sent
 */
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
                                         uint8_t* const ReportID,
                                         const uint8_t ReportType,
                                         void* ReportData,
                                         uint16_t* const ReportSize)
{
	uint8_t JoyStatus_LCL    = Joystick_GetStatus();
	uint8_t ButtonStatus_LCL = Buttons_GetStatus();

	if (!(ButtonStatus_LCL & BUTTONS_BUTTON1))
	{
		USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;

		KeyboardReport->Modifier = HID_KEYBOARD_MODIFIER_LEFTSHIFT;

		if (JoyStatus_LCL & JOY_UP)
		  KeyboardReport->KeyCode[0] = HID_KEYBOARD_SC_A;
		else if (JoyStatus_LCL & JOY_DOWN)
		  KeyboardReport->KeyCode[0] = HID_KEYBOARD_SC_B;

		if (JoyStatus_LCL & JOY_LEFT)
		  KeyboardReport->KeyCode[0] = HID_KEYBOARD_SC_C;
		else if (JoyStatus_LCL & JOY_RIGHT)
		  KeyboardReport->KeyCode[0] = HID_KEYBOARD_SC_D;

		if (JoyStatus_LCL & JOY_PRESS)
		  KeyboardReport->KeyCode[0] = HID_KEYBOARD_SC_E;

		*ReportID   = HID_REPORTID_KeyboardReport;
		*ReportSize = sizeof(USB_KeyboardReport_Data_t);
		return false;
	}
	else
	{
		USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;

		if (JoyStatus_LCL & JOY_UP)
		  MouseReport->Y = -1;
		else if (JoyStatus_LCL & JOY_DOWN)
		  MouseReport->Y =  1;

		if (JoyStatus_LCL & JOY_LEFT)
		  MouseReport->X = -1;
		else if (JoyStatus_LCL & JOY_RIGHT)
		  MouseReport->X =  1;

		if (JoyStatus_LCL & JOY_PRESS)
		  MouseReport->Button |= (1 << 0);

		*ReportID   = HID_REPORTID_MouseReport;
		*ReportSize = sizeof(USB_MouseReport_Data_t);
		return true;
	}
}
開發者ID:BirdBrainTechnologies,項目名稱:HummingbirdDuoFirmware,代碼行數:64,代碼來源:KeyboardMouseMultiReport.c

示例12: main

int main(void)
{
	uint_reg_t Dummy;

	/* =============================
	 *     Buttons Compile Check
	 * ============================= */
	Buttons_Init();
	// cppcheck-suppress redundantAssignment
	Dummy = Buttons_GetStatus();
	Buttons_Disable();

	/* =============================
	 *    Dataflash Compile Check
	 * ============================= */
	Dataflash_Init();
	Dataflash_TransferByte(0);
	Dataflash_SendByte(0);
	// cppcheck-suppress redundantAssignment
	Dummy = Dataflash_ReceiveByte();
	// cppcheck-suppress redundantAssignment
	Dummy = Dataflash_GetSelectedChip();
	Dataflash_SelectChip(0);
	Dataflash_DeselectChip();
	Dataflash_SelectChipFromPage(0);
	Dataflash_ToggleSelectedChipCS();
	Dataflash_WaitWhileBusy();
	Dataflash_SendAddressBytes(0, 0);

	/* =============================
	 *       LEDs Compile Check
	 * ============================= */
	LEDs_Init();
	LEDs_TurnOnLEDs(LEDS_ALL_LEDS);
	LEDs_TurnOffLEDs(LEDS_ALL_LEDS);
	LEDs_SetAllLEDs(LEDS_ALL_LEDS);
	LEDs_ChangeLEDs(LEDS_ALL_LEDS, LEDS_NO_LEDS);
	LEDs_ToggleLEDs(LEDS_ALL_LEDS);
	// cppcheck-suppress redundantAssignment
	Dummy = LEDs_GetLEDs();
	LEDs_Disable();

	/* =============================
	 *     Joystick Compile Check
	 * ============================= */
	Joystick_Init();
	// cppcheck-suppress redundantAssignment
	Dummy = Joystick_GetStatus();
	Joystick_Disable();

	(void)Dummy;
}
開發者ID:chicagoedt,項目名稱:Firmware,代碼行數:52,代碼來源:Test.c

示例13: service_button

/** Checks for the button state */
void service_button(void)
{
  uint8_t     ButtonStatus_LCL = Buttons_GetStatus();

  if (ButtonStatus_LCL & BUTTONS_BUTTON1) {
    if (! button_is_pressed) {
      button_pressed_timestamp = millis10();
      button_is_pressed = true;
    }
  } else {
    button_is_pressed = false;
  }
}
開發者ID:flabbergast,項目名稱:enstix,代碼行數:14,代碼來源:LufaLayer.c

示例14: Read_Joystick_Status

/** Reads the joystick and button status, sending commands to the launcher as needed. */
void Read_Joystick_Status(void)
{
	uint8_t JoyStatus_LCL = Joystick_GetStatus();
	uint8_t Buttons_LCL   = Buttons_GetStatus();

	if (Buttons_LCL & BUTTONS_BUTTON1)
	  Send_Command(CMD_FIRE);
	else if (JoyStatus_LCL & JOY_UP)
	  Send_Command(CMD_UP);
	else if (JoyStatus_LCL & JOY_DOWN)
	  Send_Command(CMD_DOWN);
	else if (JoyStatus_LCL & JOY_LEFT)
	  Send_Command(CMD_LEFT);
	else if (JoyStatus_LCL & JOY_RIGHT)
	  Send_Command(CMD_RIGHT);
	else if (CmdState != CMD_STOP)
	  Send_Command(CMD_STOP);
}
開發者ID:TomMD,項目名稱:teensy,代碼行數:19,代碼來源:MissileLauncher.c

示例15: CALLBACK_HID_Device_CreateHIDReport

/** HID class driver callback function for the creation of HID reports to the host.
 *
 *  \param[in]     HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced
 *  \param[in,out] ReportID    Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
 *  \param[in]     ReportType  Type of the report to create, either HID_REPORT_ITEM_In or HID_REPORT_ITEM_Feature
 *  \param[out]    ReportData  Pointer to a buffer where the created report should be stored
 *  \param[out]    ReportSize  Number of bytes written in the report (or zero if no report is to be sent)
 *
 *  \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
 */
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
                                         const uint8_t ReportType, void* ReportData, uint16_t* const ReportSize)
{
	USB_MediaReport_Data_t* MediaReport = (USB_MediaReport_Data_t*)ReportData;

	uint8_t JoyStatus_LCL    = Joystick_GetStatus();
	uint8_t ButtonStatus_LCL = Buttons_GetStatus();

	/* Update the Media Control report with the user button presses */
	MediaReport->Mute          = ((ButtonStatus_LCL & BUTTONS_BUTTON1) ? true : false);
	MediaReport->PlayPause     = ((JoyStatus_LCL & JOY_PRESS) ? true : false);
	MediaReport->VolumeUp      = ((JoyStatus_LCL & JOY_UP)    ? true : false);
	MediaReport->VolumeDown    = ((JoyStatus_LCL & JOY_DOWN)  ? true : false);
	MediaReport->PreviousTrack = ((JoyStatus_LCL & JOY_LEFT)  ? true : false);
	MediaReport->NextTrack     = ((JoyStatus_LCL & JOY_RIGHT) ? true : false);

	*ReportSize = sizeof(USB_MediaReport_Data_t);
	return false;
}
開發者ID:BrazzoduroArduino,項目名稱:Dougs-Arduino-Stuff,代碼行數:29,代碼來源:MediaController.c


注:本文中的Buttons_GetStatus函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。