Mercurial > public > ostc4
comparison Small_CPU/Src/baseCPU2.c @ 332:39f146ccdb1b
Merged in Ideenmodellierer/ostc4/I2C_Improvment (pull request #30)
I2C Improvment
author | heinrichsweikamp <bitbucket@heinrichsweikamp.com> |
---|---|
date | Thu, 18 Jul 2019 14:26:56 +0000 |
parents | da5b91b1e20e |
children | 143fe85f82a2 |
comparison
equal
deleted
inserted
replaced
326:2559a3f0f1f2 | 332:39f146ccdb1b |
---|---|
300 GPIO_new_DEBUG_Init(); // added 170322 hw | 300 GPIO_new_DEBUG_Init(); // added 170322 hw |
301 initGlobals(); | 301 initGlobals(); |
302 | 302 |
303 /* printf("CPU2-RTE running...\n"); */ | 303 /* printf("CPU2-RTE running...\n"); */ |
304 | 304 |
305 HAL_Delay(100); | |
306 | |
305 MX_I2C1_Init(); | 307 MX_I2C1_Init(); |
306 if (global.I2C_SystemStatus != HAL_OK) { | 308 if (global.I2C_SystemStatus != HAL_OK) |
309 { | |
307 if (MX_I2C1_TestAndClear() == GPIO_PIN_RESET) { | 310 if (MX_I2C1_TestAndClear() == GPIO_PIN_RESET) { |
308 MX_I2C1_TestAndClear(); // do it a second time | 311 MX_I2C1_TestAndClear(); // do it a second time |
309 } | 312 } |
310 MX_I2C1_Init(); | 313 MX_I2C1_Init(); |
311 } | 314 } |
312 | 315 |
316 | |
317 | |
313 //dangerous: TM_OTP_Write(0,0, 0x01); | 318 //dangerous: TM_OTP_Write(0,0, 0x01); |
314 #ifdef REGULAR_RUN | 319 #ifdef REGULAR_RUN |
315 global.sensorError[SENSOR_PRESSURE_ID] = init_pressure(); | 320 global.sensorError[SENSOR_PRESSURE_ID] = init_pressure(); |
316 global.I2C_SystemStatus = global.sensorError[SENSOR_PRESSURE_ID]; | 321 global.I2C_SystemStatus = global.sensorError[SENSOR_PRESSURE_ID]; |
317 if (global.I2C_SystemStatus != HAL_OK) { | 322 if (global.I2C_SystemStatus != HAL_OK) |
323 { | |
318 if (MX_I2C1_TestAndClear() == GPIO_PIN_RESET) { | 324 if (MX_I2C1_TestAndClear() == GPIO_PIN_RESET) { |
319 MX_I2C1_TestAndClear(); // do it a second time | 325 MX_I2C1_TestAndClear(); // do it a second time |
320 } | 326 } |
321 MX_I2C1_Init(); | 327 MX_I2C1_Init(); |
322 global.sensorError[SENSOR_PRESSURE_ID] = init_pressure(); | 328 global.sensorError[SENSOR_PRESSURE_ID] = init_pressure(); |
323 global.I2C_SystemStatus = global.sensorError[SENSOR_PRESSURE_ID]; | 329 global.I2C_SystemStatus = global.sensorError[SENSOR_PRESSURE_ID]; |
324 } | 330 } |
325 | 331 |
326 global.dataSendToMaster.sensorErrors = | 332 global.dataSendToMaster.sensorErrors = |
327 global.sensorError[SENSOR_PRESSURE_ID]; | 333 global.sensorError[SENSOR_PRESSURE_ID]; |
328 init_surface_ring(); | 334 |
335 if(is_init_pressure_done()) | |
336 { | |
337 init_surface_ring(); | |
338 } | |
329 init_battery_gas_gauge(); | 339 init_battery_gas_gauge(); |
330 HAL_Delay(10); | 340 HAL_Delay(10); |
331 battery_gas_gauge_get_data(); | 341 battery_gas_gauge_get_data(); |
332 // battery_gas_gauge_set(0); | 342 // battery_gas_gauge_set(0); |
333 | 343 |