arduino_common.cpp
/*!
 * @brief I2C write function map to Arduino platform
 */
@brief I2C write function map to Arduino platform
@brief I2C write function map to Arduino platform
BMA400_INTF_RET_TYPE bma400_i2c_write(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, void *intf_ptr)
{
    uint8_t dev_addr = *(uint8_t*)intf_ptr;
    Wire.beginTransmission(dev_addr);
    Wire.write(reg_addr);
    for (uint16_t i = 0; i < len; i++ ) {
      Wire.write(reg_data[i]);
#if I2C_DEBUG
      Serial.print("=> 0x");
      Serial.print(reg_addr + i, HEX);
      Serial.print("\t0x");
      Serial.print(reg_data[i], HEX);
      Serial.print("\n");
#endif
    }
    Wire.endTransmission();
    return BMA400_INTF_RET_SUCCESS;
}
BMA400_INTF_RET_TYPE bma400_i2c_write ( uint8_t reg_addr , const uint8_t * reg_data , uint32_t len , void * intf_ptr ) { uint8_t dev_addr = * ( uint8_t * ) intf_ptr ; Wire . beginTransmission ( dev_addr ) ; Wire . write ( reg_addr ) ; for ( uint16_t i = 0 ; i < len ; i ++ ) { Wire . write ( reg_data [ i ] ) ; #if I2C_DEBUG Serial . print ( " " ) ; Serial . print ( reg_addr + i , HEX ) ; Serial . print ( " \t " ) ; Serial . print ( reg_data [ i ] , HEX ) ; Serial . print ( " \n " ) ; #endif } Wire . endTransmission ( ) ; return BMA400_INTF_RET_SUCCESS ; }
@brief I2C write function map to Arduino platform
@brief I2C write function map to Arduino platform