Mercurial > public > ostc4
annotate Small_CPU/Inc/pressure.h @ 238:a9d798e8c11f div-fixes-5
cleanup, bugfix: do not mask I2C_SystemStatus with local variable
This commit is partly cleanup, and partly possible bugfix. Masking
the global I2C_SystemStatus with a local variable is (very) bad practice,
but more importantly, dangerous, as other code uses this I2C_SystemStatus
to base decisions on. So, this is definitely non-trivial, as it can
possibly change the flow of control. This said, its tested and seems to
have no negative effects (but also no positive, as I sort of hoped for),
so that is why I mark it cleanup as well. Constructs like this shall
be heavily documented in the code, when there is a reason to do things
like this.
Further, remove a 2nd rather useless construct. There is no reason
to & 0x03 the output of I2C_SystemStatus. This is the only location
in the entire code base where this is done, so, its not only useless
but also inconsistent and confusing the true intentions here.
Finally, littered to code with todo's that I will take care of in
next commits.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Mon, 08 Apr 2019 10:16:17 +0200 |
parents | 5f11787b4f42 |
children | 8e9c502c0b06 |
rev | line source |
---|---|
38 | 1 /* Define to prevent recursive inclusion -------------------------------------*/ |
2 #ifndef PRESSURE_H | |
3 #define PRESSURE_H | |
4 | |
5 #include <stdint.h> | |
6 | |
7 uint8_t init_pressure(void); | |
8 uint8_t pressure_update(void); | |
9 | |
10 uint8_t is_init_pressure_done(void); | |
11 | |
12 void pressure_sensor_get_pressure_raw(void); | |
13 void pressure_sensor_get_temperature_raw(void); | |
14 void pressure_calculation(void); | |
15 | |
16 float get_temperature(void); | |
17 float get_pressure_mbar(void); | |
18 float get_surface_mbar(void); | |
19 | |
20 void init_surface_ring(void); | |
21 void update_surface_pressure(uint8_t call_rhythm_seconds); | |
22 | |
23 uint32_t demo_modify_temperature_and_pressure(int32_t divetime_in_seconds, uint8_t subseconds, float ceiling_mbar); | |
24 | |
25 #endif /* PRESSURE_H */ | |
26 |