comparison Small_CPU/Src/compass.c @ 488:9eeab3fead8f

Added "I2C_DeInit();" in hardware detection routines. It's the recommended way to do and solves potential issues with older OSTC4 hardware generations. Increased RTE and RTE required numbers updated "Current build"
author heinrichsweikamp
date Sat, 27 Jun 2020 18:40:32 +0200
parents f9458e979154
children d9dbfa496f7e
comparison
equal deleted inserted replaced
487:0f5080f50ba7 488:9eeab3fead8f
279 HAL_StatusTypeDef resultOfOperationHMC_MMA = HAL_TIMEOUT; 279 HAL_StatusTypeDef resultOfOperationHMC_MMA = HAL_TIMEOUT;
280 280
281 // test if both chips of the two-chip solution (gen 1) are present 281 // test if both chips of the two-chip solution (gen 1) are present
282 if(hardwareCompass == compass_generation1) // HMC5883L) 282 if(hardwareCompass == compass_generation1) // HMC5883L)
283 { 283 {
284 HAL_Delay(10); 284 HAL_Delay(100);
285 I2C_DeInit();
286 HAL_Delay(100);
285 MX_I2C1_Init(); 287 MX_I2C1_Init();
288 HAL_Delay(100);
286 uint8_t data = 0x2A; // CTRL_REG1 of DEVICE_ACCELARATOR_MMA8452Q 289 uint8_t data = 0x2A; // CTRL_REG1 of DEVICE_ACCELARATOR_MMA8452Q
287 resultOfOperationHMC_MMA = I2C_Master_Transmit( DEVICE_ACCELARATOR_MMA8452Q, &data, 1); 290 resultOfOperationHMC_MMA = I2C_Master_Transmit( DEVICE_ACCELARATOR_MMA8452Q, &data, 1);
288 if(resultOfOperationHMC_MMA == HAL_OK) 291 if(resultOfOperationHMC_MMA == HAL_OK)
289 { 292 {
290 hardwareCompass = compass_generation1; //HMC5883L; // all fine, keep it 293 hardwareCompass = compass_generation1; //HMC5883L; // all fine, keep it