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

C++ LSB函数代码示例

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

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



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

示例1: ti73_send_REQ2_h

/* FLASH (special var header: size, id, flag, offset, page) */
int ti73_send_REQ2_h(CalcHandle* handle, uint16_t appsize, uint8_t apptype, const char *appname,
		   uint8_t appattr)
{
  uint8_t buffer[16] = { 0 };

  buffer[0] = LSB(appsize);
  buffer[1] = MSB(appsize);
  buffer[2] = apptype;
  memcpy(buffer + 3, appname, 8);
  pad_buffer(buffer + 3, '\0');

  ticalcs_info(" PC->TI: REQ (size=0x%04X, id=%02X, name=%s)",
	  appsize, apptype, appname);
  TRYF(dbus_send(handle, PC_TI7383, CMD_REQ, 11, buffer));

  return 0;
}
开发者ID:Jonimoose,项目名称:tilp-libticalcs,代码行数:18,代码来源:cmd73.c


示例2: HID_Set_Idle

void HID_Set_Idle() {
   printf("Set Idle\n");

   UCHAR duration = MSB(ControlData.DeviceRequest.wValue);
   UCHAR reportID = LSB(ControlData.DeviceRequest.wValue);

   printf("Duration: %x, ReportID: %x\n", duration, reportID);

   hid_settings.idle_time = 0;
   if(duration != 0) {
	   hid_settings.idle_time = duration * 4; //wait time in milliseconds
   }
   if(reportID != 0) {
      printf("ReportID = %ud\n", reportID);
   }
   hid_settings.state = connected;
}
开发者ID:rkj777,项目名称:GestureControlInterfaceCapstone,代码行数:17,代码来源:HID.c


示例3: setSecurityMode

/** Loads the specified key into the ZNP. Does not change security mode, need to use setSecurityMode() too.
@note if NOT using pre-configured keys then the coordinator will distribute its key to all devices.
@param key preConfiguredKey a 16B key to use
@pre setSecurityMode() called
@post znpResult contains the error code, or ZNP_SUCCESS if success.
*/
void setSecurityKey(unsigned char* key)
{
#ifdef ZNP_INTERFACE_VERBOSE     
    printf("Setting Security Key: ");
    printHexBytes(key, ZCD_NV_PRECFGKEY_LEN);
#endif
    znpBuf[0] = ZB_WRITE_CONFIGURATION_LEN + ZCD_NV_PRECFGKEY_LEN;
    znpBuf[1] = MSB(ZB_WRITE_CONFIGURATION);
    znpBuf[2] = LSB(ZB_WRITE_CONFIGURATION);    
    
    znpBuf[3] = ZCD_NV_PRECFGKEY;
    znpBuf[4] = ZCD_NV_PRECFGKEY_LEN;
    
    for (int i=5; i<(ZCD_NV_PRECFGKEY_LEN+5); i++)
        znpBuf[i] = key[i];            
    znpResult = sendMessage();
}
开发者ID:jackalchen,项目名称:smart-home-1,代码行数:23,代码来源:znp_interface.c


示例4: main

void main(void)
{
	static unsigned char i,row;
	static int y;
	static unsigned int adr;

	pal_col(1,0x30);//set while color
	
	y=0;
	
	update_list[0]=0x20|NT_UPD_HORZ;//horizontal update sequence, dummy address
	update_list[1]=0x00;
	update_list[2]=32;//update sequence is 32 tiles wide
	update_list[3+32]=NT_UPD_EOF;
	
	set_vram_update(update_list);

	ppu_on_all();//enable rendering
	
	while(1)
	{
		scroll(0,y);//scroll value will be applied on the next nmi

		if(!(y&7))//put new row every 8 pixels
		{
			row=(y>>3)+59;//get row number for update, it is shifted just above the visible part of the screen
			
			if(row>=60) row-=60;//keep the row number within the limits
			
			adr=row<<5;//convert Y from pixels to tiles (row=y/8), then to nametable offset (offset=row*32)
			
			if(adr<960) adr=adr|NAMETABLE_A; else adr=(adr-960)|NAMETABLE_C;//add base address of one of two nametables
			
			update_list[0]=MSB(adr)|NT_UPD_HORZ;//set the address
			update_list[1]=LSB(adr);
			
			for(i=0;i<32;++i) update_list[3+i]=0x10+(rand8()&7);//fill row buffer with random tiles
		}

		--y;//next pixel
		
		if(y<0) y=240*2-1;//keep Y within the total height of two nametables

		ppu_wait_nmi();
	}
开发者ID:NexusEast,项目名称:Console_Development,代码行数:45,代码来源:example9.c


示例5: dusb_cmd_s_error

// 0xEE00: error
TIEXPORT3 int TICALL dusb_cmd_s_error(CalcHandle *handle, uint16_t code)
{
	DUSBVirtualPacket* pkt;
	int retval = 0;

	VALIDATE_HANDLE(handle);

	pkt = dusb_vtl_pkt_new_ex(handle, 2, DUSB_VPKT_ERROR, dusb_vtl_pkt_alloc_data(2));

	pkt->data[0] = MSB(code);
	pkt->data[1] = LSB(code);
	retval = dusb_send_data(handle, pkt);

	dusb_vtl_pkt_del(handle, pkt);
	ticalcs_info("   code = %04x", code);

	return retval;
}
开发者ID:TC01,项目名称:tilibs,代码行数:19,代码来源:dusb_cmd.c


示例6: EEPROMRead

void EEPROMRead(WORD addr, BYTE length, BYTE xdata *buf)
{
	BYTE		i = 0;
	BYTE		j = 0;
	BYTE xdata 	ee_str[2];

	if(DB_Addr)
		ee_str[i++] = MSB(addr);

	ee_str[i++] = LSB(addr);

	EZUSB_WriteI2C(I2C_Addr, i, ee_str);

	for(j=0; j < length; j++)
		*(buf+j) = 0xcd;

	EZUSB_ReadI2C(I2C_Addr, length, buf);
}
开发者ID:AndreaCensi,项目名称:jAER,代码行数:18,代码来源:main.c


示例7: dm9000WritePhyReg

void dm9000WritePhyReg(uint8_t address, uint16_t data)
{
   //Write PHY register address
   dm9000WriteReg(DM9000_REG_EPAR, 0x40 | address);
   //Write register value
   dm9000WriteReg(DM9000_REG_EPDRL, LSB(data));
   dm9000WriteReg(DM9000_REG_EPDRH, MSB(data));

   //Start the write operation
   dm9000WriteReg(DM9000_REG_EPCR, EPCR_EPOS | EPCR_ERPRW);
   //PHY access is still in progress?
   while(dm9000ReadReg(DM9000_REG_EPCR) & EPCR_ERRE);

   //Wait 5us minimum
   usleep(5);
   //Clear command register
   dm9000WriteReg(DM9000_REG_EPCR, EPCR_EPOS);
}
开发者ID:nandojve,项目名称:embedded,代码行数:18,代码来源:dm9000.c


示例8: ti73_send_RTS

/* Request to send (std var header: NUL padded, fixed length) */
TIEXPORT3 int TICALL ti73_send_RTS(CalcHandle* handle, uint16_t varsize, uint8_t vartype, const char *varname, uint8_t varattr)
{
	uint8_t buffer[16];
	char trans[9];

	if (handle == NULL)
	{
		ticalcs_critical("%s: handle is NULL", __FUNCTION__);
		return ERR_INVALID_HANDLE;
	}
	if (varname == NULL)
	{
		ticalcs_critical("%s: varname is NULL", __FUNCTION__);
		return ERR_INVALID_PACKET;
	}

	buffer[0] = LSB(varsize);
	buffer[1] = MSB(varsize);
	buffer[2] = vartype;
	memcpy(buffer + 3, varname, 8);
	buffer[11] = 0x00;
	buffer[12] = (varattr == ATTRB_ARCHIVED) ? 0x80 : 0x00;

	/* Kludge to support 84+CSE Pic files.  Please do not rely on this
	   behavior; it will go away in the future. */
	if (vartype == 0x07 && varsize == 0x55bb)
		buffer[11] = 0x0a;

	ticonv_varname_to_utf8_s(handle->model, varname, trans, vartype);
	ticalcs_info(" PC->TI: RTS (size=0x%04X, id=%02X, name=%s, attr=%i)", varsize, vartype, trans, varattr);

	if (vartype != TI7383_BKUP) 
	{
		// backup: special header
		pad_buffer_to_8_chars(buffer + 3, '\0');
		TRYF(dbus_send(handle, PC_TI7383, CMD_RTS, 11 + EXTRAS, buffer));
	}
	else
	{
		TRYF(dbus_send(handle, PC_TI7383, CMD_RTS, 9, buffer));
	}

	return 0;
}
开发者ID:debrouxl,项目名称:tilp-libticalcs,代码行数:45,代码来源:cmd73.c


示例9: eeprom_read

BOOL eeprom_read (BYTE prom_addr, WORD addr, WORD length, BYTE *buf)
{

    BYTE eeprom_addr[2];
    BYTE addr_len=0;
    if (EEPROM_TWO_BYTE) 
        eeprom_addr[addr_len++] = MSB(addr);
    
    eeprom_addr[addr_len++] = LSB(addr);

    // write the address we want to read to the prom
    //printf ("Starting Addr Write with addr len %d\n", addr_len);
    if ( !i2c_write( prom_addr, addr_len, eeprom_addr, 0, NULL, 1) ) return FALSE;
    //printf ( "Starting read\n" );
    if ( !i2c_read ( prom_addr, length, buf ) ) return FALSE;

    return TRUE;
    
}
开发者ID:Jinglili77,项目名称:myriadrf-boards,代码行数:19,代码来源:zt_i2c.c


示例10: ti82_send_REQ_h

/* Request variable (std var header: NUL padded, fixed length) */
int ti82_send_REQ_h(CalcHandle* handle, uint16_t varsize, uint8_t vartype, const char *varname)
{
  uint8_t buffer[16] = { 0 };
  char trans[9];

  buffer[0] = LSB(varsize);
  buffer[1] = MSB(varsize);
  buffer[2] = vartype;
  memcpy(buffer + 3, varname, 8);
  pad_buffer(buffer + 3, '\0');

  ticonv_varname_to_utf8_s(handle->model, varname, trans, vartype);
  ticalcs_info(" PC->TI: REQ (size=0x%04X=%i, id=%02X, name=%s)",
	  varsize, varsize, vartype, trans);

  TRYF(dbus_send(handle, PC_TI8283, CMD_REQ, 11, buffer));

  return 0;
}
开发者ID:TI8XEmulator,项目名称:graph89,代码行数:20,代码来源:cmd82.c


示例11: setCallbacks

/** Enable/Disabless callbacks on the ZNP. 
@param cb must be either CALLBACKS_ENABLED or CALLBACKS_DISABLED
@see section ZCD_NV_ZDO_DIRECT_CB in ZNP Interface Specification
@post znpResult contains the error code, or ZNP_SUCCESS if success.
*/
void setCallbacks(unsigned char cb)
{ 
    if ((cb != CALLBACKS_ENABLED) && (cb != CALLBACKS_DISABLED))
    {
        znpResult = -1;
        return; 
    }
#ifdef ZNP_INTERFACE_VERBOSE     
    printf("Setting Callbacks to %s\r\n", (cb ? "ON" : "OFF"));
#endif
    znpBuf[0] = ZB_WRITE_CONFIGURATION_LEN + ZCD_NV_ZDO_DIRECT_CB_LEN;
    znpBuf[1] = MSB(ZB_WRITE_CONFIGURATION);
    znpBuf[2] = LSB(ZB_WRITE_CONFIGURATION);
    
    znpBuf[3] = ZCD_NV_ZDO_DIRECT_CB;
    znpBuf[4] = ZCD_NV_ZDO_DIRECT_CB_LEN;
    znpBuf[5] = cb;
    znpResult = sendMessage();    
}
开发者ID:DragonWar,项目名称:Smart-Plug,代码行数:24,代码来源:znp_interface.c


示例12: ti73_send_REQ2

/* FLASH (special var header: size, id, flag, offset, page) */
TIEXPORT3 int TICALL ti73_send_REQ2(CalcHandle* handle, uint16_t appsize, uint8_t apptype, const char *appname, uint8_t appattr)
{
	uint8_t buffer[16] = { 0 };

	if (appname == NULL)
	{
		ticalcs_critical("%s: appname is NULL", __FUNCTION__);
		return ERR_INVALID_PACKET;
	}

	buffer[0] = LSB(appsize);
	buffer[1] = MSB(appsize);
	buffer[2] = apptype;
	memcpy(buffer + 3, appname, 8);
	pad_buffer_to_8_chars(buffer + 3, '\0');

	ticalcs_info(" PC->TI: REQ (size=0x%04X, id=%02X, name=%s)", appsize, apptype, appname);
	return dbus_send(handle, PC_TI7383, CMD_REQ, 11, buffer);
}
开发者ID:debrouxl,项目名称:tilp-libticalcs,代码行数:20,代码来源:cmd73.c


示例13: ti73_send_REQ

/* Request variable (std var header: NUL padded, fixed length) */
TIEXPORT3 int TICALL ti73_send_REQ(CalcHandle* handle, uint16_t varsize, uint8_t vartype, const char *varname, uint8_t varattr)
{
	uint8_t buffer[16] = { 0 };
	char trans[17];

	if (handle == NULL)
	{
		ticalcs_critical("%s: handle is NULL", __FUNCTION__);
		return ERR_INVALID_HANDLE;
	}
	if (varname == NULL)
	{
		ticalcs_critical("%s: varname is NULL", __FUNCTION__);
		return ERR_INVALID_PACKET;
	}

	buffer[0] = LSB(varsize);
	buffer[1] = MSB(varsize);
	buffer[2] = vartype;
	memcpy(buffer + 3, varname, 8);
	pad_buffer_to_8_chars(buffer + 3, '\0');
	buffer[11] = 0x00;
	buffer[12] = (varattr == ATTRB_ARCHIVED) ? 0x80 : 0x00;

	ticonv_varname_to_utf8_s(handle->model, varname, trans, vartype);
	ticalcs_info(" PC->TI: REQ (size=0x%04X, id=%02X, name=%s, attr=%i)", varsize, vartype, trans, varattr);

	if (vartype != TI83p_IDLIST && vartype != TI83p_GETCERT) 
	{
		TRYF(dbus_send(handle, PC_TI7383, CMD_REQ, 11 + EXTRAS, buffer));
	}
	else if(vartype != TI83p_GETCERT && handle->model != CALC_TI73)
	{
		TRYF(dbus_send(handle, PC_TI7383, CMD_REQ, 11, buffer));
	}
	else
	{
		TRYF(dbus_send(handle, PC_TI73, CMD_REQ, 3, buffer));
	}

	return 0;
}
开发者ID:debrouxl,项目名称:tilp-libticalcs,代码行数:43,代码来源:cmd73.c


示例14: ti73_send_DEL_h

int ti73_send_DEL_h(CalcHandle* handle, uint16_t varsize, uint8_t vartype, const char *varname,
		  uint8_t varattr)
{
	uint8_t buffer[16] = { 0 };
	char trans[9];

	buffer[0] = LSB(varsize);
	buffer[1] = MSB(varsize);
	buffer[2] = vartype == TI83p_APPL ? 0x14 : vartype;
	memcpy(buffer + 3, varname, 8);
	pad_buffer(buffer + 3, '\0');
	buffer[11] = 0x00;

	ticonv_varname_to_utf8_s(handle->model, varname, trans, vartype);
	ticalcs_info(" PC->TI: DEL (name=%s)", trans);

	TRYF(dbus_send(handle, PC_TI7383, CMD_DEL, 11, buffer));
  
	return 0;
}
开发者ID:TI8XEmulator,项目名称:graph89,代码行数:20,代码来源:cmd73.c


示例15: ti85_send_RTS

/* Request to send (var header: SPC padded, fixed length) */
int ti85_send_RTS(CalcHandle* handle, uint16_t varsize, uint8_t vartype, const char *varname)
{
  uint8_t buffer[16];
  char trans[9];

  buffer[0] = LSB(varsize);
  buffer[1] = MSB(varsize);
  buffer[2] = vartype;
  buffer[3] = strlen(varname);
  memcpy(buffer + 4, varname, 8);
  pad_buffer_to_8_chars(buffer + 4, ' ');

  ticonv_varname_to_utf8_s(handle->model, varname, trans, vartype);
  ticalcs_info(" PC->TI: RTS (size=0x%04X, id=%02X, name=%s)",
	  varsize, vartype, trans);

  TRYF(dbus_send(handle, PC_TI8586, CMD_RTS, 12, buffer));

  return 0;
}
开发者ID:debrouxl,项目名称:tilp-libticalcs,代码行数:21,代码来源:cmd85.c


示例16: EEPROMWriteByte

void EEPROMWriteByte(WORD addr, BYTE value)
{
	BYTE		i = 0;
	BYTE xdata 	ee_str[3];
	if(DB_Addr)
		ee_str[i++] = MSB(addr); // if 16 bit, we need 2-byte address and 1 byte data

	ee_str[i++] = LSB(addr);
	ee_str[i++] = value;


	//EZUSB_WriteI2C(I2C_Addr, i, ee_str);
	// http://www.keil.com/forum/docs/thread11160.asp

	while( I2CPckt.status != I2C_IDLE );      // wait for write session
	while(EZUSB_WriteI2C( I2C_Addr, i, ee_str )!=I2C_OK);
 	EZUSB_WaitForEEPROMWrite( I2C_Addr );  // wait for Write Cycle Time
//	LED=1;
	
}
开发者ID:AndreaCensi,项目名称:jAER,代码行数:20,代码来源:main.c


示例17: setZigbeeDeviceType

/** Sets the Zigbee Device Type for the ZNP.
@param deviceType the type of Zigbee device. Must be COORDINATOR, ROUTER, or END_DEVICE 
@post znpResult contains the error code, or ZNP_SUCCESS if success.
*/
void setZigbeeDeviceType(unsigned char deviceType)
{
    if (deviceType > END_DEVICE) 
    {
        znpResult = -1;
        return; 
    }
#ifdef ZNP_INTERFACE_VERBOSE 
    printf("Setting Zigbee DeviceType to %s\r\n", getDeviceTypeName(deviceType));
#endif 
    znpBuf[0] = ZB_WRITE_CONFIGURATION_LEN + ZCD_NV_LOGICAL_TYPE_LEN;
    znpBuf[1] = MSB(ZB_WRITE_CONFIGURATION);
    znpBuf[2] = LSB(ZB_WRITE_CONFIGURATION);
    
    znpBuf[3] = ZCD_NV_LOGICAL_TYPE;
    znpBuf[4] = ZCD_NV_LOGICAL_TYPE_LEN;
    znpBuf[5] = deviceType;
    
    znpResult = sendMessage();       
}
开发者ID:DragonWar,项目名称:Smart-Plug,代码行数:24,代码来源:znp_interface.c


示例18: adc_sample_sent_cb

void adc_sample_sent_cb(void)
{
  uint32_t i;
  uint8_t  old_mic_buf_id=mic_buf_id;

  if (!b_microphone_pause && Is_usb_write_enabled(EP_AUDIO_IN) && audio_mixer_dacs_input(NULL, 0) )  // Endpoint buffer free ?
  {
    mic_frame_id++;
    if( mic_frame_id>=10 )
    {
      mic_frame_id=0;
      microphone[mic_buf_id].size = 45;
    }
    else
      microphone[mic_buf_id].size = 44;

    Usb_reset_endpoint_fifo_access(EP_AUDIO_IN);
    if(!mute)
    {
      for(i = 0; i < microphone[old_mic_buf_id].size; i++)
      {
          Usb_write_endpoint_data(EP_AUDIO_IN, 8, LSB(microphone[old_mic_buf_id].buffer[2 * i]));
          Usb_write_endpoint_data(EP_AUDIO_IN, 8, MSB(microphone[old_mic_buf_id].buffer[2 * i]));
      }
    }
    else
    {
      for(i = 0; i < 2*microphone[old_mic_buf_id].size; i++)
      {
          Usb_write_endpoint_data(EP_AUDIO_IN, 8, 0);
      }
    }
    Usb_ack_in_ready_send(EP_AUDIO_IN);

    audio_mixer_dacs_input(microphone[mic_buf_id].buffer, 45/*microphone[mic_buf_id].size*/);
    // Let's switch to the next buffer.
    mic_buf_id^=1;
  }
  else
    b_microphone_started=false;
}
开发者ID:Mazetti,项目名称:asf,代码行数:41,代码来源:device_audio_task.c


示例19: cccd_configure

/**@brief Function for creating a TX message for writing a CCCD.
 *
 * @param[in] conn_handle  Connection handle on which to perform the configuration.
 * @param[in] handle_cccd  Handle of the CCCD.
 * @param[in] enable       Enable or disable GATTC notifications.
 *
 * @retval NRF_SUCCESS              If the message was created successfully.
 * @retval NRF_ERROR_INVALID_PARAM  If one of the input parameters was invalid.
 */
static uint32_t cccd_configure(const uint16_t conn_handle, const uint16_t handle_cccd, bool enable)
{
    tx_message_t * p_msg;
    uint16_t       cccd_val = enable ? BLE_CCCD_NOTIFY_BIT_MASK : 0;

    p_msg              = &m_tx_buffer[m_tx_insert_index++];
    m_tx_insert_index &= TX_BUFFER_MASK;

    p_msg->req.write_req.gattc_params.handle   = handle_cccd;
    p_msg->req.write_req.gattc_params.len      = 2;
    p_msg->req.write_req.gattc_params.p_value  = p_msg->req.write_req.gattc_value;
    p_msg->req.write_req.gattc_params.offset   = 0;
    p_msg->req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ;
    p_msg->req.write_req.gattc_value[0]        = LSB(cccd_val);
    p_msg->req.write_req.gattc_value[1]        = MSB(cccd_val);
    p_msg->conn_handle                         = conn_handle;
    p_msg->type                                = WRITE_REQ;

    tx_buffer_process();
    return NRF_SUCCESS;
}
开发者ID:BlueSkyGjj,项目名称:nRF52,代码行数:30,代码来源:ble_ancs_c.c


示例20: dusb_send_buf_size_request

TIEXPORT3 int TICALL dusb_send_buf_size_request(CalcHandle* h, uint32_t size)
{
	DUSBRawPacket raw;

	if (h == NULL)
	{
		ticalcs_critical("%s: h is NULL", __FUNCTION__);
		return ERR_INVALID_HANDLE;
	}

	memset(&raw, 0, sizeof(raw));
	raw.size = 4;
	raw.type = DUSB_RPKT_BUF_SIZE_REQ;
	raw.data[2] = MSB(size);
	raw.data[3] = LSB(size);

	TRYF(dusb_send(h, &raw));
	ticalcs_info("  PC->TI: Buffer Size Request (%i bytes)", size);

	return 0;
}
开发者ID:debrouxl,项目名称:tilp-libticalcs,代码行数:21,代码来源:dusb_vpkt.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ LSErrorFree函数代码示例发布时间:2022-05-30
下一篇:
C++ LRAND函数代码示例发布时间: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