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

C++ I2CWrite函数代码示例

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

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



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

示例1: set_charge_backup_battery

/***************************************************************************
 *
 * Function : set_charge_backup_battery
 *
 * IN   : param, a value to write to the regiter RTCStatus
 * OUT  : 
 *
 * RET  : Return the value of register RTCStatus
 *
 * Notes : From register 0x0F0B, bits 5:5
 *
 **************************************************************************/
unsigned char set_charge_backup_battery( enum charge_backup_battery_enable param )
  {
    unsigned char value = 0;
    unsigned char old_value;

    old_value = I2CRead(RTC_STATUS_REG);

    /* 
     * 0: Current source to charge back up battery disabled in 
     * OFF mode 
     * 1: Current source to charge back up battery enabled in 
     * OFF mode 
     */ 
    switch( param ){
        case CHARGE_BACKUP_BATTERY_ENABLE_E: 
           value = old_value | CHARGE_BACKUP_BATTERY_ENABLE_PARAM_MASK; 
           break;
        case CHARGE_BACKUP_BATTERY_DISABLE_E: 
           value = old_value & ~ CHARGE_BACKUP_BATTERY_ENABLE_PARAM_MASK;
           break;
    }
  

    I2CWrite(RTC_STATUS_REG, value);

    return old_value;
  }
开发者ID:Meticulus,项目名称:vendor_st-ericsson_u8500,代码行数:39,代码来源:ab8500_RTC.c


示例2: set_acc_detect21_comparator

/***************************************************************************
 *
 * Function : set_acc_detect21_comparator
 *
 * IN   : param, a value to write to the regiter AccDetect3
 * OUT  : 
 *
 * RET  : Return the value of register 0xAccDetect3
 *
 * Notes : From register 0x882, bits 4:4
 *
 **************************************************************************/
unsigned char set_acc_detect21_comparator( enum comparator21_enable param )
  {
    unsigned char value = 0;
    unsigned char old_value;

    old_value = I2CRead(ACC_DETECT_3_REG);

    /* 
     * 0: disable AccDetect21 comparator 
     * 1: enable AccDetect21 comparator 
     */ 
    switch( param ){
        case COMPARATOR_21_ENABLE_E: 
           value = old_value | ACC_DETECT_21_COMPARATOR_MASK; 
           break;
        case COMPARATOR_21_DISABLE_E: 
           value = old_value & ~ ACC_DETECT_21_COMPARATOR_MASK;
           break;
    }
  

    I2CWrite(ACC_DETECT_3_REG, value);

    return old_value;
  }
开发者ID:Meticulus,项目名称:vendor_st-ericsson_u8500,代码行数:37,代码来源:ab9540_Accessory.c


示例3: set_coulomb_counter_power_off

/***************************************************************************
 *
 * Function : set_coulomb_counter_power_off
 *
 * IN   : param, a value to write to the regiter CoulombCounter
 * OUT  : 
 *
 * RET  : Return the value of register CoulombCounter
 *
 * Notes : From register 0x0F01, bits 0:0
 *
 **************************************************************************/
unsigned char set_coulomb_counter_power_off( enum coulomb_counter_power_off_enable param )
  {
    unsigned char value = 0;
    unsigned char old_value;

    old_value = I2CRead(COULOMB_COUNTER_REG);

    /* 
     * Note: Coulomb Counter always disable in PwrOff mode. 
     * 0: disable Coulomb Counter 
     * 1: enable Coulomb Counter 
     */ 
    switch( param ){
        case COULOMB_COUNTER_POWER_UP_E: 
           value = old_value | COULOMB_COUNTER_POWER_OFF_ENABLE_PARAM_MASK; 
           break;
        case COULOMB_COUNTER_POWER_DOWN_E: 
           value = old_value & ~ COULOMB_COUNTER_POWER_OFF_ENABLE_PARAM_MASK;
           break;
    }
  

    I2CWrite(COULOMB_COUNTER_REG, value);

    return old_value;
  }
开发者ID:Meticulus,项目名称:vendor_st-ericsson_u8500,代码行数:38,代码来源:ab8500_RTC.c


示例4: set_ape_i2c_clock_pullup

/***************************************************************************
 *
 * Function : set_ape_i2c_clock_pullup
 *
 * IN   : param, a value to write to the regiter I2cPadControl
 * OUT  : 
 *
 * RET  : Return the value of register I2cPadControl
 *
 * Notes : From register 0x1067, bits 2:2
 *
 **************************************************************************/
unsigned char set_ape_i2c_clock_pullup( enum ape_i2c_clock_pullup_enable param )
  {
    unsigned char value = 0;
    unsigned char old_value;

    old_value = I2CRead(I_2C_PAD_CONTROL_REG);

    /* 
     * 0: enable internal pull-up 
     * 1: Disable internal pull-up 
     */ 
    switch( param ){
        case APE_I_2C_CLOCK_PULLUP_DISABLE_E: 
           value = old_value | APE_I_2C_CLOCK_PULLUP_ENABLE_PARAM_MASK; 
           break;
        case APE_I_2C_CLOCK_PULLUP_ENABLE_E: 
           value = old_value & ~ APE_I_2C_CLOCK_PULLUP_ENABLE_PARAM_MASK;
           break;
    }
  

    I2CWrite(I_2C_PAD_CONTROL_REG, value);

    return old_value;
  }
开发者ID:Meticulus,项目名称:vendor_st-ericsson_u8500,代码行数:37,代码来源:ab8500_Miscellanous.c


示例5: LCDUpdate

void LCDUpdate(void)
{
    #if defined(SENSOR_PORT_UART)
    LCDCommand[0] = LCD_SLAVEADDRESS << 1;
    LCDCommand[1] = LCD_WRITE_CMD;
    LCDCommand[2] = LCDCMD_FIRSTLINE_ADDRESS;
    LCDCommand[3] = 32;
    I2CWrite(4, 32);
    #else

    BYTE    i;

    DelayMs(10);
    SPIPut2(0x32);  //LCD Subsystem Write Data Command
    DelayMs(5);
    SPIPut2(0);     //Screen Address
    DelayMs(5);
    SPIPut2(32);    //Data length (16 + 3)
    for(i = 0; i < 32; i++)
    {
        DelayMs(5);
        if(LCDText[i] == 0)
        {
            SPIPut2(' ');
        }
        else
        {
            SPIPut2(LCDText[i]);
        }
    }

    DelayMs(300);
    #endif
}
开发者ID:Athuli7,项目名称:Microchip,代码行数:34,代码来源:LcdDisplay.c


示例6: set_modem_i2c_data_pullup

/***************************************************************************
 *
 * Function : set_modem_i2c_data_pullup
 *
 * IN   : param, a value to write to the regiter I2cPadControl
 * OUT  : 
 *
 * RET  : Return the value of register I2cPadControl
 *
 * Notes : From register 0x1067, bits 1:1
 *
 **************************************************************************/
unsigned char set_modem_i2c_data_pullup( enum modem_i2c_data_pullup_enable param )
  {
    unsigned char value = 0;
    unsigned char old_value;

    old_value = I2CRead(I_2C_PAD_CONTROL_REG);

    /* 
     * 0: enable internal pull-up 
     * 1: Disable internal pull-up 
     */ 
    switch( param ){
        case MODEM_I_2C_DATA_PULLUP_DISABLE_E: 
           value = old_value | MODEM_I_2C_DATA_PULLUP_ENABLE_PARAM_MASK; 
           break;
        case MODEM_I_2C_DATA_PULLUP_ENABLE_E: 
           value = old_value & ~ MODEM_I_2C_DATA_PULLUP_ENABLE_PARAM_MASK;
           break;
    }
  

    I2CWrite(I_2C_PAD_CONTROL_REG, value);

    return old_value;
  }
开发者ID:Meticulus,项目名称:vendor_st-ericsson_u8500,代码行数:37,代码来源:ab8500_Miscellanous.c


示例7: set_acc_detect1_comparator

/***************************************************************************
 *
 * Function : set_acc_detect1_comparator
 *
 * IN   : param, a value to write to the regiter AccDetect3
 * OUT  : 
 *
 * RET  : Return the value of register 0xAccDetect3
 *
 * Notes : From register 0x882, bits 0:0
 *
 **************************************************************************/
unsigned char set_acc_detect1_comparator( enum detect1_comparator_enable param )
  {
    unsigned char value = 0;
    unsigned char old_value;

    old_value = I2CRead(ACC_DETECT_3_REG);

    /* 
     * Note: doesn't turn On internal pull-up 
     * 0: disable AccDetect1 comparator 
     * 1: enable AccDetect1 comparator 
     */ 
    switch( param ){
        case DETECT_1_COMPARATOR_ENABLE_E: 
           value = old_value | ACC_DETECT_1_COMPARATOR_MASK; 
           break;
        case DETECT_1_COMPARATOR_DISABLE_E: 
           value = old_value & ~ ACC_DETECT_1_COMPARATOR_MASK;
           break;
    }
  

    I2CWrite(ACC_DETECT_3_REG, value);

    return old_value;
  }
开发者ID:Meticulus,项目名称:vendor_st-ericsson_u8500,代码行数:38,代码来源:ab9540_Accessory.c


示例8: set_acc_detect_pullup

/***************************************************************************
 *
 * Function : set_acc_detect_pullup
 *
 * IN   : param, a value to write to the regiter AccDetect3
 * OUT  : 
 *
 * RET  : Return the value of register 0xAccDetect3
 *
 * Notes : From register 0x882, bits 3:3
 *
 **************************************************************************/
unsigned char set_acc_detect_pullup( enum acc_detect_pullup_enable param )
  {
    unsigned char value = 0;
    unsigned char old_value;

    old_value = I2CRead(ACC_DETECT_3_REG);

    /* 
     * 0: disable AccDetect2 Pull-up 
     * 1: enable AccDetect2 Pull-up 
     */ 
    switch( param ){
        case ACC_DETECT_PULLUP_ENABLE_E: 
           value = old_value | ACC_DETECT_PULLUP_MASK; 
           break;
        case ACC_DETECT_PULLUP_DISABLE_E: 
           value = old_value & ~ ACC_DETECT_PULLUP_MASK;
           break;
    }
  

    I2CWrite(ACC_DETECT_3_REG, value);

    return old_value;
  }
开发者ID:Meticulus,项目名称:vendor_st-ericsson_u8500,代码行数:37,代码来源:ab9540_Accessory.c


示例9: set_rtc_read_request

/***************************************************************************
 *
 * Function : set_rtc_read_request
 *
 * IN   : param, a value to write to the regiter RTCReadRequest
 * OUT  : 
 *
 * RET  : Return the value of register RTCReadRequest
 *
 * Notes : From register 0x0F02, bits 0:0
 *
 **************************************************************************/
unsigned char set_rtc_read_request( enum rtc_read_enable param )
  {
    unsigned char value = 0;
    unsigned char old_value;

    old_value = I2CRead(RTC_READ_REQUEST_REG);

    /* 
     * RTC data read transfer is required 
     * Cleared upon data transfert in watchtim register is done 
     */ 
    switch( param ){
        case RTC_READ_ENABLE_E: 
           value = old_value | RTC_READ_ENABLE_PARAM_MASK; 
           break;
        case RTC_READ_DISABLE_E: 
           value = old_value & ~ RTC_READ_ENABLE_PARAM_MASK;
           break;
    }
  

    I2CWrite(RTC_READ_REQUEST_REG, value);

    return old_value;
  }
开发者ID:Meticulus,项目名称:vendor_st-ericsson_u8500,代码行数:37,代码来源:ab8500_RTC.c


示例10: L0_WriteCommandBytes

unsigned int L0_WriteCommandBytes(unsigned char slaveaddress, unsigned char length, unsigned char *pucDataBuffer)
{		
		slaveaddress = 0x64;
		I2CWrite(slaveaddress,pucDataBuffer,length);
		return length;

}
开发者ID:EPDCenter,项目名称:android_kernel_amlogic_s805_3go_aplay2,代码行数:7,代码来源:Si2168_L0_API.c


示例11: set_acc_detect_pullup_supply

/***************************************************************************
 *
 * Function : set_acc_detect_pullup_supply
 *
 * IN   : param, a value to write to the regiter AccDetect3
 * OUT  : 
 *
 * RET  : Return the value of register 0xAccDetect3
 *
 * Notes : From register 0x882, bits 1:1
 *
 **************************************************************************/
unsigned char set_acc_detect_pullup_supply( enum v21_supply_enable param )
  {
    unsigned char value = 0;
    unsigned char old_value;

    old_value = I2CRead(ACC_DETECT_3_REG);

    /* 
     * 0: disable AccDetect2 Pull-up 2.1v supply 
     * 1: enable AccDetect2 Pull-up 2.1v supply 
     */ 
    switch( param ){
        case V21_SUPPLY_ENABLE_E: 
           value = old_value | ACC_DETECT_PULLUP_SUPPLY_MASK; 
           break;
        case V21_SUPPLY_DISABLE_E: 
           value = old_value & ~ ACC_DETECT_PULLUP_SUPPLY_MASK;
           break;
    }
  

    I2CWrite(ACC_DETECT_3_REG, value);

    return old_value;
  }
开发者ID:Meticulus,项目名称:vendor_st-ericsson_u8500,代码行数:37,代码来源:ab9540_Accessory.c


示例12: InitializeDS3231

EFI_STATUS
InitializeDS3231 (
  VOID
  )
{
  EFI_STATUS    Status;
  I2C_DEVICE    Dev;
  RTC_DS3231_CONTROL Temp;
  RTC_DS3231_HOURS   Hours;

  // Prepare the hardware
  (VOID)IdentifyDS3231();

  (VOID) CopyMem(&Dev, &gDS3231RtcDevice, sizeof(Dev));

  Status = I2CInit(Dev.Socket,Dev.Port,Normal);
  if (EFI_ERROR (Status)) {
    goto EXIT;
  }
  // Ensure interrupts are masked. We do not want RTC interrupts in UEFI
  Status = I2CRead(&Dev,DS3231_REGADDR_CONTROL,1,&Temp.u8);
  if (EFI_ERROR (Status)) {
    goto EXIT;
  }
  Temp.bits.INTCN = 0;
  Status = I2CWrite(&Dev,DS3231_REGADDR_CONTROL,1,&Temp.u8);
  if (EFI_ERROR (Status)) {
    goto EXIT;
  }

  MicroSecondDelay(2000);
  Status = I2CRead(&Dev,DS3231_REGADDR_HOURS,1,&Hours.u8);
  if (EFI_ERROR (Status)) {
    goto EXIT;
  }
  Hours.bits.Hour24_n = 0;
  Status = I2CWrite(&Dev,DS3231_REGADDR_HOURS,1,&Hours.u8);
  if (EFI_ERROR (Status)) {
    goto EXIT;
  }


  mDS3231Initialized = TRUE;

  EXIT:
  return Status;
}
开发者ID:mangguo321,项目名称:edk2-platforms,代码行数:47,代码来源:DS3231RealTimeClockLib.c


示例13: eamp_closeheadPhone

static ssize_t eamp_closeheadPhone()
{

	u8 temp_control_reg = 0;
	EAMP_PRINTK("eamp_closeheadPhone");
	I2CWrite(0x86, 0x40);	
	I2CWrite(0x87, 0x00);
	
	if(gsk_on)
	  {
	  	I2CWrite(0x85, 0x5f);	
		I2CWrite(0x87, 0x30);
		}
	
	ghp_on = false;
	return 0;
}
开发者ID:AwaisKing,项目名称:mt6577_aosp_source,代码行数:17,代码来源:yusu_android_speaker.c


示例14: writeReg

static void writeReg(uint8_t reg, uint8_t data)
{
    uint8_t buf[2];

    buf[0] = SUB_ADDR(channel, reg);
    buf[1] = data;
    I2CWrite(UART2_ADDR, buf, 2);
}
开发者ID:ecomptiago,项目名称:EmbarcadosLab2,代码行数:8,代码来源:uart2.c


示例15: HAL_ERROR1

bool RTIMULSM9DS0::setGyroCTRL2()
{
    if ((m_settings->m_LSM9DS0GyroHpf < LSM9DS0_GYRO_HPF_0) || (m_settings->m_LSM9DS0GyroHpf > LSM9DS0_GYRO_HPF_9)) {
        HAL_ERROR1("Illegal LSM9DS0 gyro high pass filter code %d\n", m_settings->m_LSM9DS0GyroHpf);
        return false;
    }
    return I2CWrite(m_gyroSlaveAddr,  LSM9DS0_GYRO_CTRL2, m_settings->m_LSM9DS0GyroHpf, "Failed to set LSM9DS0 gyro CTRL2");
}
开发者ID:DanielAshley,项目名称:Masters_Thesis,代码行数:8,代码来源:RTIMULSM9DS0.cpp


示例16: pca9532_setBlink1Period

/******************************************************************************
 *
 * Description:
 *    Set the blink period for PWM1. Valid values are 0 - 255 where 0
 *    means 152 Hz and 255 means 0.59 Hz. A value of 151 means 1 Hz.
 *
 * Params:
 *    [in]  period  - The period for PWM1
 *
 *****************************************************************************/
void pca9532_setBlink1Period(uint8_t period)
{
    uint8_t buf[2];

    buf[0] = PCA9532_PSC1;
    buf[1] = period;
    I2CWrite(PCA9532_I2C_ADDR, buf, 2);
}
开发者ID:finklabs,项目名称:epicsamples,代码行数:18,代码来源:pca9532.c


示例17: StorageClear

/*************************************************
  Function:		StorageClear
  Description:  
  Input:		
  Output:		
  Return:		
  Others:
*************************************************/
void StorageClear(void)
{
    mSysParam.Init = 1;
    mSysParam.BeepEnable = 1;
    mSysParam.DataNum = 0;
    StorageInitInfo();
    I2CWrite(I2C_ADDR_W, ADDRESS_INIT, (unsigned char*)(&mSysParam), sizeof(SYS_PARAM));
}
开发者ID:txl0591,项目名称:InputDevices,代码行数:16,代码来源:Storage.c


示例18: setModeControl

static void setModeControl(uint8_t mctl)
{
    uint8_t buf[2];

    buf[0] = ACC_ADDR_MCTL;
    buf[1] = mctl;
    I2CWrite(ACC_I2C_ADDR, buf, 2);
}
开发者ID:TiddoLangerak,项目名称:mmc_test,代码行数:8,代码来源:acc.c


示例19: VideoPortDDCMonitorHelper

BOOLEAN NTAPI
VideoPortDDCMonitorHelper(
   PVOID HwDeviceExtension,
   PVOID I2CFunctions,
   PUCHAR pEdidBuffer,
   ULONG EdidBufferSize
   )
{
   PDDC_CONTROL ddc = (PDDC_CONTROL)I2CFunctions;
   PI2C_CALLBACKS i2c = &ddc->I2CCallbacks;
   INT Count, i;
   PUCHAR pBuffer = (PUCHAR)pEdidBuffer;
   BOOL Ack;

   TRACE_(VIDEOPRT, "VideoPortDDCMonitorHelper()\n");

   ASSERT_IRQL_LESS_OR_EQUAL(PASSIVE_LEVEL);
   if (ddc->Size != sizeof (ddc))
     {
        WARN_(VIDEOPRT, "ddc->Size != %d (%d)\n", sizeof (ddc), ddc->Size);
        return FALSE;
     }

   /* select eeprom */
   if (!I2CStart(HwDeviceExtension, i2c, DDC_EEPROM_ADDRESS | WRITE))
     return FALSE;
   /* set address */
   if (!I2CWrite(HwDeviceExtension, i2c, 0x00))
     return FALSE;
   /* change into read mode */
   if (!I2CRepStart(HwDeviceExtension, i2c, DDC_EEPROM_ADDRESS | READ))
     return FALSE;
   /* read eeprom */
   RtlZeroMemory(pEdidBuffer, EdidBufferSize);
   Count = min(128, EdidBufferSize);
   for (i = 0; i < Count; i++)
     {
        Ack = ((i + 1) < Count);
        pBuffer[i] = I2CRead(HwDeviceExtension, i2c, Ack);
     }
   I2CStop(HwDeviceExtension, i2c);

   /* check EDID header */
   if (pBuffer[0] != 0x00 || pBuffer[1] != 0xff ||
       pBuffer[2] != 0xff || pBuffer[3] != 0xff ||
       pBuffer[4] != 0xff || pBuffer[5] != 0xff ||
       pBuffer[6] != 0xff || pBuffer[7] != 0x00)
     {
        WARN_(VIDEOPRT, "VideoPortDDCMonitorHelper(): Invalid EDID header!\n");
        return FALSE;
     }

   INFO_(VIDEOPRT, "VideoPortDDCMonitorHelper(): EDID version %d rev. %d\n", pBuffer[18], pBuffer[19]);
   INFO_(VIDEOPRT, "VideoPortDDCMonitorHelper() - SUCCESS!\n");
   return TRUE;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:56,代码来源:ddc.c


示例20: readReg

static uint8_t readReg(uint8_t reg)
{
    uint8_t buf[1];

    buf[0] = SUB_ADDR(channel, reg);
    I2CWrite(UART2_ADDR, buf, 1);
    I2CRead(UART2_ADDR, buf, 1);

    return buf[0];
}
开发者ID:ecomptiago,项目名称:EmbarcadosLab2,代码行数:10,代码来源:uart2.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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