BOARD_ERROR be_board_drv_hmc5883_read(void)
{
    BOARD_ERROR be_result = BOARD_ERR_OK;
    uint8_t u8_buffer[6];

    be_result |= board_i2c_read(HMC5883_ADDRESS, HMC5883_DATA_X_MSB_REG, 6U, u8_buffer);

    b3d_raw_magnitometer.u16_X = (((uint16_t)  u8_buffer[0]) << 8U) + ((uint16_t)u8_buffer[1]);
    b3d_raw_magnitometer.u16_Y = (((uint16_t)  u8_buffer[2]) << 8U) + ((uint16_t)u8_buffer[3]);
    b3d_raw_magnitometer.u16_Z = (((uint16_t)  u8_buffer[4]) << 8U) + ((uint16_t)u8_buffer[5]);

    return(be_result);
}
Exemplo n.º 2
0
/**
 * \brief       Take readings from the sensor
 * \return      true of I2C operations successful
 */
static bool
read_data()
{
  bool valid;

  if(success) {
    SENSOR_SELECT();

    success = board_i2c_read((uint8_t *)&data, sizeof(data));
    SENSOR_DESELECT();

    /* Store temperature */
    raw_temp = SWAP(data.temp);

    /* Store humidity */
    raw_hum = SWAP(data.hum);
  }

  valid = success;
  success = true;

  return valid;
}
Exemplo n.º 3
0
INT_32 ea3250_read_config(void) 
{  
  board_i2c_init(0);
  return board_i2c_read(EA_EEPROM_HW_CFG_OFS, (UNS_8*)&eaHwCfg, sizeof(eaHwCfg));
}