BOARD_ERROR be_board_drv_hmc5883_init(void) { BOARD_ERROR be_result = BOARD_ERR_OK; bf3d_mag_scale_factor.fl_X = 1.0f; /* (1.16F * 1090.0F) / (float)rawMag[XAXIS].value; */ bf3d_mag_scale_factor.fl_Y = 1.0f; /* (1.16F * 1090.0F) / (float)rawMag[YAXIS].value; */ bf3d_mag_scale_factor.fl_Z = 1.0f; /* (1.08F * 1090.0F) / (float)rawMag[ZAXIS].value; */ be_result |= board_i2c_write(HMC5883_ADDRESS, HMC5883_CONFIG_REG_A, SENSOR_CONFIG | NORMAL_MEASUREMENT_CONFIGURATION); gv_board_sys_tick_fast_delay(20U); be_result |= board_i2c_write(HMC5883_ADDRESS, HMC5883_MODE_REG, OP_MODE_CONTINUOUS); gv_board_sys_tick_fast_delay(20U); /* v_board_drv_hmc5883_read();*/ /* gv_board_sys_tick_fast_delay(20U);*/ return(be_result); }
/*---------------------------------------------------------------------------*/ bool sensor_common_write_reg(uint8_t addr, uint8_t *buf, uint8_t len) { uint8_t i; uint8_t *p = buffer; /* Copy address and data to local buffer for burst write */ *p++ = addr; for(i = 0; i < len; i++) { *p++ = *buf++; } len++; /* Send data */ return board_i2c_write(buffer, len); }
INT_32 ea3250_write_config(EA_HW_CFG_T* cfg) { board_i2c_init(0); cfg->magic = EA_BOARD_MAGIC; return board_i2c_write(EA_EEPROM_HW_CFG_OFS, (UNS_8*)cfg, sizeof(EA_HW_CFG_T)); }