DroneOS/Drivers/Source/drvMS5611.c
/**
 * Reads factory calibration and store it into object variables.
 */
Reads factory calibration and store it into object variables.
Reads factory calibration and store it into object variables .
bool ms5611ReadPROM()
{
  uint8_t buffer[MS5611_PROM_REG_SIZE];
  uint16_t* pCalRegU16 = (uint16_t*)&calReg;
  int32_t i = 0;
  bool status = FALSE;
  for (i = 0; i < MS5611_PROM_REG_COUNT; i++)
  {
    status = i2cdevWriteByte(I2Cx, devAddr, I2CDEV_NO_MEM_ADDR,
                             MS5611_PROM_BASE_ADDR + (i * MS5611_PROM_REG_SIZE));
    if (status)
    {
      status = i2cdevRead(I2Cx, devAddr, I2CDEV_NO_MEM_ADDR, MS5611_PROM_REG_SIZE, buffer);
      pCalRegU16[i] = ((uint16_t)buffer[0] << 8) | buffer[1];
    }
  }
  return status;
}
bool ms5611ReadPROM ( ) { uint8_t buffer [ MS5611_PROM_REG_SIZE ] ; uint16_t * pCalRegU16 = ( uint16_t * ) & calReg ; int32_t i = 0 ; bool status = FALSE ; for ( i = 0 ; i < MS5611_PROM_REG_COUNT ; i ++ ) { status = i2cdevWriteByte ( I2Cx , devAddr , I2CDEV_NO_MEM_ADDR , MS5611_PROM_BASE_ADDR + ( i * MS5611_PROM_REG_SIZE ) ) ; if ( status ) { status = i2cdevRead ( I2Cx , devAddr , I2CDEV_NO_MEM_ADDR , MS5611_PROM_REG_SIZE , buffer ) ; pCalRegU16 [ i ] = ( ( uint16_t ) buffer [ 0 ] << 8 ) | buffer [ 1 ] ; } } return status ; }
Reads factory calibration and store it into object variables.
Reads factory calibration and store it into object variables .
// start read sequence // Read conversion