本文整理汇总了C++中I2CWrite函数的典型用法代码示例。如果您正苦于以下问题:C++ I2CWrite函数的具体用法?C++ I2CWrite怎么用?C++ I2CWrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了I2CWrite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例10: L0_WriteCommandBytes
unsigned int L0_WriteCommandBytes(unsigned char slaveaddress, unsigned char length, unsigned char *pucDataBuffer)
{
slaveaddress = 0x64;
I2CWrite(slaveaddress,pucDataBuffer,length);
return length;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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");
}