• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ LO函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: make_condition_modifier

static int make_condition_modifier(struct iforce* iforce,
	struct resource* mod_chunk, int no_alloc,
	__u16 rsat, __u16 lsat, __s16 rk, __s16 lk, u16 db, __s16 center)
{
	unsigned char data[10];

	if (!no_alloc) {
		mutex_lock(&iforce->mem_mutex);
		if (allocate_resource(&(iforce->device_memory), mod_chunk, 8,
			iforce->device_memory.start, iforce->device_memory.end, 2L,
			NULL, NULL)) {
			mutex_unlock(&iforce->mem_mutex);
			return -ENOSPC;
		}
		mutex_unlock(&iforce->mem_mutex);
	}

	data[0] = LO(mod_chunk->start);
	data[1] = HI(mod_chunk->start);

	data[2] = (100 * rk) >> 15;	
	data[3] = (100 * lk) >> 15; 

	center = (500 * center) >> 15;
	data[4] = LO(center);
	data[5] = HI(center);

	db = (1000 * db) >> 16;
	data[6] = LO(db);
	data[7] = HI(db);

	data[8] = (100 * rsat) >> 16;
	data[9] = (100 * lsat) >> 16;

	iforce_send_packet(iforce, FF_CMD_CONDITION, data);
	iforce_dump_packet("condition", FF_CMD_CONDITION, data);

	return 0;
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:39,代码来源:iforce-ff.c


示例2: make_condition_modifier

static int make_condition_modifier(struct iforce* iforce,
	struct resource* mod_chunk, int no_alloc,
	__u16 rsat, __u16 lsat, __s16 rk, __s16 lk, u16 db, __s16 center)
{
	unsigned char data[10];

	if (!no_alloc) {
		mutex_lock(&iforce->mem_mutex);
		if (allocate_resource(&(iforce->device_memory), mod_chunk, 8,
			iforce->device_memory.start, iforce->device_memory.end, 2L,
			NULL, NULL)) {
			mutex_unlock(&iforce->mem_mutex);
			return -ENOSPC;
		}
		mutex_unlock(&iforce->mem_mutex);
	}

	data[0] = LO(mod_chunk->start);
	data[1] = HI(mod_chunk->start);

	data[2] = (100 * rk) >> 15;	/* Dangerous: the sign is extended by gcc on plateforms providing an arith shift */
	data[3] = (100 * lk) >> 15; /* This code is incorrect on cpus lacking arith shift */

	center = (500 * center) >> 15;
	data[4] = LO(center);
	data[5] = HI(center);

	db = (1000 * db) >> 16;
	data[6] = LO(db);
	data[7] = HI(db);

	data[8] = (100 * rsat) >> 16;
	data[9] = (100 * lsat) >> 16;

	iforce_send_packet(iforce, FF_CMD_CONDITION, data);
	iforce_dump_packet("condition", FF_CMD_CONDITION, data);

	return 0;
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:39,代码来源:iforce-ff.c


示例3: usart_init

void usart_init(void)
{
	UBRR0L = LO(BAUDDIVIDER);
	UBRR0H = HI(BAUDDIVIDER);
	UCSR0B = 1<<RXEN0|1<<TXEN0|1<<RXCIE0|1<<TXCIE0;
	UCSR0C = 1<<UCSZ00|1<<UCSZ01;

	usart_rx_wp = 0;
	usart_rx_rp = 0;

	usart_tx_wp = 0;
	usart_tx_rp = 0;
}
开发者ID:cluePrints,项目名称:avr-eclipse-workspace,代码行数:13,代码来源:usart.c


示例4: ads_read

void ads_read(uint8_t chip, sample_data* sample){
	ads_select(chip);
	uint8_t* buf=(uint8_t*)sample;
	uint8_t* end=(uint8_t*)(sample+(sizeof(sample_data)));
	while(buf != end){
		*(buf++)=spi_send(0x00);
	}
	for(uint8_t i=0; i<4; i++){
		uint16_t tmp = ((LO(sample->ch[i])<<8) | (HI(sample->ch[i])));
		sample->ch[i] = tmp;
	}
	ads_deselect();
}
开发者ID:jaseg,项目名称:openmind-firmware,代码行数:13,代码来源:ads1x9x.c


示例5: stlink2_write_and_read_byte

int stlink2_write_and_read_byte(programmer_t *pgm, unsigned char byte, unsigned int start) {
	unsigned char buf[4], start2[2];
	pack_int16(start, start2);
	stlink2_cmd(pgm, 0xf40b, 7,
			0x00, 0x01,
			0x00, 0x00,
			HI(start), LO(start),
			byte);
	usleep(2000);
	stlink2_get_status(pgm);

	stlink2_cmd(pgm, 0xf40c, 0);
	return(msg_recv_int8(pgm));
}
开发者ID:njzhangyifei,项目名称:stm8flash,代码行数:14,代码来源:stlinkv2.c


示例6: make_envelope_modifier

static int make_envelope_modifier(struct iforce* iforce,
	struct resource* mod_chunk, int no_alloc,
	u16 attack_duration, __s16 initial_level,
	u16 fade_duration, __s16 final_level)
{
	unsigned char data[8];

	attack_duration = TIME_SCALE(attack_duration);
	fade_duration = TIME_SCALE(fade_duration);

	if (!no_alloc) {
		mutex_lock(&iforce->mem_mutex);
		if (allocate_resource(&(iforce->device_memory), mod_chunk, 0x0e,
			iforce->device_memory.start, iforce->device_memory.end, 2L,
			NULL, NULL)) {
			mutex_unlock(&iforce->mem_mutex);
			return -ENOSPC;
		}
		mutex_unlock(&iforce->mem_mutex);
	}

	data[0] = LO(mod_chunk->start);
	data[1] = HI(mod_chunk->start);

	data[2] = LO(attack_duration);
	data[3] = HI(attack_duration);
	data[4] = HI(initial_level);

	data[5] = LO(fade_duration);
	data[6] = HI(fade_duration);
	data[7] = HI(final_level);

	iforce_send_packet(iforce, FF_CMD_ENVELOPE, data);

	return 0;
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:36,代码来源:iforce-ff.c


示例7: RunRTOS

//RTOS Запуск системного таймера
inline void RunRTOS (void)
{
	// TCCR2A = 1 << WGM21 | 4 << CS20; 			// Freq = CK/64 - Установить режим и предделитель
												// Автосброс после достижения регистра сравнения
	TCCR2B |= (1<<CS22);
	TCCR2B &= ~((1<<CS21) | (1<<CS20));
	TCCR2B |= (1<<WGM22);
	
	TCNT2 = 0;									// Установить начальное значение счётчиков
	OCR2B  = LO(TimerDivider); 					// Установить значение в регистр сравнения
	//TIMSK2 = 0 << TOIE0 | 1<<OCF2A | 0<<TOIE0;	// Разрешаем прерывание RTOS - запуск ОС
	TIMSK2 = 1 << TOIE2;	

	sei();
}
开发者ID:ZhukovAN,项目名称:Net173.ATmega328P,代码行数:16,代码来源:EERTOSHAL.c


示例8: InitAll

inline void InitAll(void)
{

//InitUSART
UBRRL = LO(bauddivider);
UBRRH = HI(bauddivider);
UCSRA = 0;
UCSRB = 1<<RXEN|1<<TXEN|0<<RXCIE|0<<TXCIE;
UCSRC = 1<<URSEL|1<<UCSZ0|1<<UCSZ1;

//InitPort
LED_DDR |= 1<<LED1|1<<LED2|1<<LED3|1<<I_L|1<<I_C;


}
开发者ID:dek-an,项目名称:Micro,代码行数:15,代码来源:HAL.c


示例9: SpiSetUp

long SpiSetUp(unsigned char *pUserBuffer, unsigned short usLength)
{
        size_t tx_len = (usLength & 1) ? usLength : usLength +1;

        pUserBuffer[0] = WRITE;
        pUserBuffer[1] = HI(tx_len);
        pUserBuffer[2] = LO(tx_len);
        pUserBuffer[3] = 0;
        pUserBuffer[4] = 0;

        tSLInformation.solicitedResponse = 1; // We are doing a write
        sSpiInformation.pTxPacket = pUserBuffer;
        sSpiInformation.usTxPacketLength = usLength;
        tx_len += SPI_HEADER_SIZE;
        return  tx_len;
}
开发者ID:NicholasJohnson9149,项目名称:core-common-lib,代码行数:16,代码来源:cc3000_spi.c


示例10: stub

//---------------------------------------------------------------------------------------------
void stub(void)//заглушка для проверки
{
unsigned int CRC=0;
	TransferBuf[0]=ADRESS_DEV;
	TransferBuf[1]=0x3;//read reg
	TransferBuf[2]=0x2;
	TransferBuf[3]=0x1;
	TransferBuf[4]=0x1;
	//TransferBuf[5]=0x1;
	
	CRC=CRC16(&TransferBuf,5);

	TransferBuf[5]=HI(CRC);
	TransferBuf[6]=LO(CRC);

	buf_len=0x7;
}
开发者ID:nowhard,项目名称:IRDA,代码行数:18,代码来源:proto.c


示例11: HI

/**
Инициализировать UART
*/
void UART::init(void) {

    // задаем скорость UART
    UBRRH = HI(BAUDRATE_DIVIDER);
    UBRRL = LO(BAUDRATE_DIVIDER);
    UCSRA = 0;

    // включаем трансмиттер и ресивер
    UCSRB = 1 << TXEN | 1 << RXEN | 1 << RXCIE;

    // контроль четности: нет
    // стоп бит: 1
    // размер кадра 8 бит
    UCSRC = (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1);

    receiver.init();
}
开发者ID:adyach,项目名称:little-helper,代码行数:20,代码来源:UART.cpp


示例12: remote_ahci_get_num_blocks

static void remote_ahci_get_num_blocks(ddf_fun_t *fun, void *iface,
    ipc_callid_t callid, ipc_call_t *call)
{
	const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
	
	if (ahci_iface->get_num_blocks == NULL) {
		async_answer_0(callid, ENOTSUP);
		return;
	}
	
	uint64_t blocks;
	const int ret = ahci_iface->get_num_blocks(fun, &blocks);
	
	if (ret != EOK)
		async_answer_0(callid, ret);
	else
		async_answer_2(callid, EOK, HI(blocks), LO(blocks));
}
开发者ID:jvesely,项目名称:helenos,代码行数:18,代码来源:remote_ahci.c


示例13: ahci_write_blocks

int ahci_write_blocks(async_sess_t *sess, uint64_t blocknum, size_t count,
    void* buf)
{
	async_exch_t *exch = async_exchange_begin(sess);
	if (!exch)
		return EINVAL;
	
	aid_t req = async_send_4(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
	    IPC_M_AHCI_WRITE_BLOCKS, HI(blocknum),  LO(blocknum), count, NULL);
	
	async_share_out_start(exch, buf, AS_AREA_READ | AS_AREA_WRITE);
	
	async_exchange_end(exch);
	
	sysarg_t rc;
	async_wait_for(req, &rc);
	
	return rc;
}
开发者ID:jvesely,项目名称:helenos,代码行数:19,代码来源:remote_ahci.c


示例14: ToString

inline std::string ToString(const Direction& d) {
	std::stringstream sst;
	std::stringstream sst2;
	unsigned short hi = HI(d);
	unsigned short lo = LO(d);
	if ((hi & 1) == 1) {
		sst << "X";
		sst2 << (((lo & 1) == 1) ? "P" : "M");
	}
	if ((hi & 2) == 2) {
		sst << "Y";
		sst2 << (((lo & 2) == 2) ? "P" : "M");
	}
	if ((hi & 4) == 4) {
		sst << "Z";
		sst2 << (((lo & 4) == 4) ? "P" : "M");
	}
	sst << "_" << sst2.str();
	return sst.str();
}
开发者ID:hyperpower,项目名称:carpio,代码行数:20,代码来源:domain_define.hpp


示例15: cdrom_helper

void cdrom_helper(unsigned char *req_buf, unsigned char *transfer_buf,
		  unsigned int dos_transfer_buf)
{
   unsigned int Sector_plus_150,Sector;
   struct cdrom_msf cdrom_msf;
   struct cdrom_subchnl cdrom_subchnl;
   struct cdrom_tochdr cdrom_tochdr;
   struct cdrom_tocentry cdrom_tocentry;
   struct cdrom_volctrl cdrom_volctrl;
   int n, err;

   cdrom_subchnl.cdsc_format = CDROM_MSF;

   IndexCd=(int)((HI(ax) & 0xC0)>>6);
   HI(ax) = HI(ax) & 0x3F;

   if ((cdu33a) && (cdrom_fd < 0)) {
        cdrom_fd = open (path_cdrom, O_RDONLY | O_NONBLOCK);

        if (cdrom_fd < 0) {
          switch (HI(ax)) {
            case 0x09:    /* media changed request */
              LO(bx) = 1; /* media changed */
              LO(ax) = 0;
              return;
            case 0x0A:    /* device status request */
              LWORD(ebx) = audio_status.status | 0x800; /* no disc */
              LO(ax) = 0;
              return;
          }
          LO(ax) = 1; /* for other requests return with error */
          return ;
        }
   }


   switch (HI(ax)) {
     case 0x01:	/* NOTE: you can't see XA data disks if bit 10 of status
		 * is cleared, MSCDEX will test it and skip XA entries!
		 * Actually the entries skipped must have this pattern:
		 *   xxxx1xxx xxxxxxxx 0x58 0x41
		 * and the mscdex 2.25 code is:
		 *	test	word ptr [bx+1Eh],400h
		 *	jz	[check for XA]
		 *	[return 0 = valid entry]
		 * [check for XA]
		 * ...
		 *	cmp	word ptr es:[bx+6],4158h  'XA'
		 *	jne	[return 0]
		 *	mov	ax,es:[bx+4]
		 *	and	ax,8
		 *	[return ax]
		 */
		audio_status.status = 0x00000710; /* see function 0x0A below */
                audio_status.paused_bit = 0;
                audio_status.media_changed = 0;
                audio_status.volume0 = 0xFF;
                audio_status.volume1 = 0xFF;
                audio_status.volume2 = 0;
                audio_status.volume3 = 0;
                audio_status.outchan0 = 0;
                audio_status.outchan1 = 1;
                audio_status.outchan2 = 2;
                audio_status.outchan3 = 3;

                cdrom_fd = open (path_cdrom, O_RDONLY | O_NONBLOCK);
		err = errno;

                if (cdrom_fd < 0) {
		  C_printf("CDROM: cdrom open (%s) failed: %s\n",
			    path_cdrom, strerror(err));
                  LO(ax) = 0;
                  if ((err == EIO) || (err==ENOMEDIUM)) {
                    /* drive which cannot be opened if no
                       disc is inserted!                   */
                    cdu33a = 1;
                    if (! eject_allowed)
                       LO(ax) = 1; /* no disk in drive */
                   }
                  else LO(ax) = 1; /* no cdrom drive installed */
                  if (! eject_allowed)
                    LO(ax) = 1; /* no disk in drive */
                 }
                else {
                       LO(ax) = 0;
                       if (! eject_allowed) {
                         if (ioctl (cdrom_fd, CDROMREADTOCHDR, &cdrom_tochdr))
                           if (ioctl (cdrom_fd, CDROMREADTOCHDR, &cdrom_tochdr))
                             LO(ax) = 1;
                       }
                     }
                break;
     case 0x02: /* read long */
                if (eject_allowed && ioctl (cdrom_fd, CDROMSUBCHNL, &cdrom_subchnl) && errno != ENOTTY) {
                  audio_status.media_changed = 1;
                  if (ioctl (cdrom_fd, CDROMSUBCHNL, &cdrom_subchnl)) {
                    /* no disc in drive */
                    LO(ax) = 1;
                    break;
                   }
//.........这里部分代码省略.........
开发者ID:ccarcel,项目名称:dosemu2,代码行数:101,代码来源:cdrom.c


示例16: SpiWrite

//*****************************************************************************
//
//!  SpiWrite
//!
//!  @param  pUserBuffer  buffer to write
//!  @param  usLength     buffer's length
//!
//!  @return none
//!
//!  @brief  Spi write operation
//
//*****************************************************************************
long
SpiWrite(unsigned char *pUserBuffer, unsigned short usLength)
{
	unsigned char ucPad = 0;
	
	// Figure out the total length of the packet in order to figure out if there 
	// is padding or not
	if(!(usLength & 0x0001))
	{
		ucPad++;
	}
	
	pUserBuffer[0] = WRITE;
	pUserBuffer[1] = HI(usLength + ucPad);
	pUserBuffer[2] = LO(usLength + ucPad);
	pUserBuffer[3] = 0;
	pUserBuffer[4] = 0;
	
	usLength += (SPI_HEADER_SIZE + ucPad);
	
	// The magic number that resides at the end of the TX/RX buffer (1 byte after 
	// the allocated size) for the purpose of detection of the overrun. If the 
	// magic number is overwritten - buffer overrun occurred - and we will stuck 
	// here forever!
	if (wlan_tx_buffer[CC3000_TX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER)
	{
		while (1)
			;
	}
	
	if (sSpiInformation.ulSpiState == eSPI_STATE_POWERUP)
	{
		while (sSpiInformation.ulSpiState != eSPI_STATE_INITIALIZED)
			;
	}
	
	if (sSpiInformation.ulSpiState == eSPI_STATE_INITIALIZED)
	{
		// This is time for first TX/RX transactions over SPI: the IRQ is down - 
		// so need to send read buffer size command
		SpiFirstWrite(pUserBuffer, usLength);
	}
	else 
	{
		// We need to prevent here race that can occur in case 2 back to back 
		// packets are sent to the  device, so the state will move to IDLE and once 
		//again to not IDLE due to IRQ
		tSLInformation.WlanInterruptDisable();
		
		while (sSpiInformation.ulSpiState != eSPI_STATE_IDLE)
		{
			;
		}
		
		sSpiInformation.ulSpiState = eSPI_STATE_WRITE_IRQ;
		sSpiInformation.pTxPacket = pUserBuffer;
		sSpiInformation.usTxPacketLength = usLength;
		
		// Assert the CS line and wait till SSI IRQ line is active and then
		// initialize write operation
		ASSERT_CS();
		
		// Re-enable IRQ - if it was not disabled - this is not a problem...
		tSLInformation.WlanInterruptEnable();

		// check for a missing interrupt between the CS assertion and enabling back the interrupts
		if (tSLInformation.ReadWlanInterruptPin() == 0)
		{
			SpiWriteDataSynchronous(sSpiInformation.pTxPacket, sSpiInformation.usTxPacketLength);
			
			sSpiInformation.ulSpiState = eSPI_STATE_IDLE;
			
			DEASSERT_CS();
		}
	}
	
	// Due to the fact that we are currently implementing a blocking situation
	// here we will wait till end of transaction
	while (eSPI_STATE_IDLE != sSpiInformation.ulSpiState)
		;
	
	return(0);
}
开发者ID:CurubaProject,项目名称:CurubaDevice,代码行数:95,代码来源:spi.c


示例17: led_g_off

void led_g_off() { LO(LEDG_PORT,LEDG); }
开发者ID:prcek,项目名称:RFPad,代码行数:1,代码来源:pad.c


示例18: i2c_sclLo

void i2c_sclLo() {
    i2c_hold();
    led_y_off();
    LO(SCL_PORT,SCL);
}
开发者ID:prcek,项目名称:RFPad,代码行数:5,代码来源:pad.c


示例19: iforce_send_packet

/*
 * Send a packet of bytes to the device
 */
int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data)
{
	/* Copy data to buffer */
	int n = LO(cmd);
	int c;
	int empty;
	int head, tail;
	unsigned long flags;

/*
 * Update head and tail of xmit buffer
 */
	spin_lock_irqsave(&iforce->xmit_lock, flags);

	head = iforce->xmit.head;
	tail = iforce->xmit.tail;


	if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) {
		warn("not enough space in xmit buffer to send new packet");
		spin_unlock_irqrestore(&iforce->xmit_lock, flags);
		return -1;
	}

	empty = head == tail;
	XMIT_INC(iforce->xmit.head, n+2);

/*
 * Store packet in xmit buffer
 */
	iforce->xmit.buf[head] = HI(cmd);
	XMIT_INC(head, 1);
	iforce->xmit.buf[head] = LO(cmd);
	XMIT_INC(head, 1);

	c = CIRC_SPACE_TO_END(head, tail, XMIT_SIZE);
	if (n < c) c=n;

	memcpy(&iforce->xmit.buf[head],
	       data,
	       c);
	if (n != c) {
		memcpy(&iforce->xmit.buf[0],
		       data + c,
		       n - c);
	}
	XMIT_INC(head, n);

	spin_unlock_irqrestore(&iforce->xmit_lock, flags);
/*
 * If necessary, start the transmission
 */
	switch (iforce->bus) {

#ifdef CONFIG_JOYSTICK_IFORCE_232
		case IFORCE_232:
		if (empty)
			iforce_serial_xmit(iforce);
		break;
#endif
#ifdef CONFIG_JOYSTICK_IFORCE_USB
		case IFORCE_USB:

		if (iforce->usbdev && empty &&
			!test_and_set_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags)) {

			iforce_usb_xmit(iforce);
		}
		break;
#endif
	}
	return 0;
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:76,代码来源:iforce-packets.c


示例20: iforce_process_packet

void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data)
{
	struct input_dev *dev = iforce->dev;
	int i;
	static int being_used = 0;

	if (being_used)
		warn("re-entrant call to iforce_process %d", being_used);
	being_used++;

#ifdef CONFIG_JOYSTICK_IFORCE_232
	if (HI(iforce->expect_packet) == HI(cmd)) {
		iforce->expect_packet = 0;
		iforce->ecmd = cmd;
		memcpy(iforce->edata, data, IFORCE_MAX_LENGTH);
	}
#endif
	wake_up(&iforce->wait);

	if (!iforce->type) {
		being_used--;
		return;
	}

	switch (HI(cmd)) {

		case 0x01:	/* joystick position data */
		case 0x03:	/* wheel position data */
			if (HI(cmd) == 1) {
				input_report_abs(dev, ABS_X, (__s16) (((__s16)data[1] << 8) | data[0]));
				input_report_abs(dev, ABS_Y, (__s16) (((__s16)data[3] << 8) | data[2]));
				input_report_abs(dev, ABS_THROTTLE, 255 - data[4]);
				if (LO(cmd) >= 8 && test_bit(ABS_RUDDER ,dev->absbit))
					input_report_abs(dev, ABS_RUDDER, (__s8)data[7]);
			} else {
				input_report_abs(dev, ABS_WHEEL, (__s16) (((__s16)data[1] << 8) | data[0]));
				input_report_abs(dev, ABS_GAS,   255 - data[2]);
				input_report_abs(dev, ABS_BRAKE, 255 - data[3]);
			}

			input_report_abs(dev, ABS_HAT0X, iforce_hat_to_axis[data[6] >> 4].x);
			input_report_abs(dev, ABS_HAT0Y, iforce_hat_to_axis[data[6] >> 4].y);

			for (i = 0; iforce->type->btn[i] >= 0; i++)
				input_report_key(dev, iforce->type->btn[i], data[(i >> 3) + 5] & (1 << (i & 7)));

			/* If there are untouched bits left, interpret them as the second hat */
			if (i <= 8) {
				int btns = data[6];
				if (test_bit(ABS_HAT1X, dev->absbit)) {
					if (btns & 8) input_report_abs(dev, ABS_HAT1X, -1);
					else if (btns & 2) input_report_abs(dev, ABS_HAT1X, 1);
					else input_report_abs(dev, ABS_HAT1X, 0);
				}
				if (test_bit(ABS_HAT1Y, dev->absbit)) {
					if (btns & 1) input_report_abs(dev, ABS_HAT1Y, -1);
					else if (btns & 4) input_report_abs(dev, ABS_HAT1Y, 1);
					else input_report_abs(dev, ABS_HAT1Y, 0);
				}
			}

			input_sync(dev);

			break;

		case 0x02:	/* status report */
			input_report_key(dev, BTN_DEAD, data[0] & 0x02);
			input_sync(dev);

			/* Check if an effect was just started or stopped */
			i = data[1] & 0x7f;
			if (data[1] & 0x80) {
				if (!test_and_set_bit(FF_CORE_IS_PLAYED, iforce->core_effects[i].flags)) {
					/* Report play event */
					input_report_ff_status(dev, i, FF_STATUS_PLAYING);
				}
			} else if (test_and_clear_bit(FF_CORE_IS_PLAYED, iforce->core_effects[i].flags)) {
				/* Report stop event */
				input_report_ff_status(dev, i, FF_STATUS_STOPPED);
			}
			if (LO(cmd) > 3) {
				int j;
				for (j = 3; j < LO(cmd); j += 2)
					mark_core_as_ready(iforce, data[j] | (data[j+1]<<8));
			}
			break;
	}
	being_used--;
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:89,代码来源:iforce-packets.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LO8函数代码示例发布时间:2022-05-30
下一篇:
C++ LMsg函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap