comparison Small_CPU/Src/pressure.c @ 241:2b9775f71e30 div-fixes-5

cleanup: factor out I2C1_Status() and cleanup type Having a function that returns global data is rather useless. Further, use HAL_StatusTypeDef directly, instead of typecasting between a HAL defined enum and our uint_8t. Cleanup only. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Mon, 08 Apr 2019 11:18:40 +0200
parents f11f0bf6ef2d
children 8e9c502c0b06
comparison
equal deleted inserted replaced
240:625d20070261 241:2b9775f71e30
27 /* surface time 27 /* surface time
28 the last 30 minutes will be saved once per minute in a endless loop 28 the last 30 minutes will be saved once per minute in a endless loop
29 at the beginning of a dive the oldest value will be used 29 at the beginning of a dive the oldest value will be used
30 */ 30 */
31 31
32 32 #include "scheduler.h"
33 #include "pressure.h" 33 #include "pressure.h"
34 #include "i2c.h" 34 #include "i2c.h"
35 #include "rtc.h" 35 #include "rtc.h"
36 36
37 #define CMD_RESET 0x1E // ADC reset command 37 #define CMD_RESET 0x1E // ADC reset command
259 259
260 C5_x_2p8 = C[5] * 256; 260 C5_x_2p8 = C[5] * 256;
261 C2_x_2p16 = C[2] * 65536; 261 C2_x_2p16 = C[2] * 65536;
262 C1_x_2p15 = C[1] * 32768; 262 C1_x_2p15 = C[1] * 32768;
263 263
264 if(I2C1_Status() == HAL_OK) 264 if(global.I2C_SystemStatus == HAL_OK)
265 { 265 {
266 pressureSensorInitSuccess = 1; 266 pressureSensorInitSuccess = 1;
267 } 267 }
268 return pressure_update(); 268 return pressure_update();
269 } 269 }
358 } 358 }
359 359
360 360
361 void pressure_calculation(void) 361 void pressure_calculation(void)
362 { 362 {
363 if(I2C1_Status() != HAL_OK) 363 if(global.I2C_SystemStatus != HAL_OK)
364 return; 364 return;
365 365
366 pressure_calculation_AN520_004_mod_MS5803_30BA__09_2015(); 366 pressure_calculation_AN520_004_mod_MS5803_30BA__09_2015();
367 } 367 }
368 368