当前位置: 首页>>代码示例>>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;未经允许,请勿转载。