annotate Small_CPU/Inc/i2c.h @ 173:05c770dc2911 max-depth

Bugfix: make max depth move with current depth (part 1) The display in dive mode of the max depth was updated before the actual depth, which looks very strange. The reason for this was conceptually simple. The depth value was averaged over a set of depth samples, but the current depth was only taken from the current sample. So, per definition, on an initial descend, the current depth is always bigger (deeper) than any average from previous shallower samples. This part 1 commit introduces a new function that is used immediate after reception of the new sample from the RTE. This function does the trivial average of a set of samples. Notice that also the surface and ambient mbar pressures are taken into account (which are used heavily over the entire code). This is a consistency thing. We should base any further calculation from the data presented in the UI, instead of presenting A, and use A' for further calculations. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Mon, 11 Mar 2019 19:48:57 +0100
parents e9cce686fe41
children 9ecc2e60418d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 #ifndef I2C_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 #define I2C_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4
165
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
5 /* Pressure Sensor */
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
6 #define DEVICE_PRESSURE 0xEE // 2019 hardware (gen 3) will use 0xEC (MS5837), all other use 0xEE (MS5803)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7
165
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
8 /* Compass/Accelerometer */
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
9 #define DEVICE_ACCELARATOR_MMA8452Q 0x38 // Hardware gen 1 (Two chip solution with MMA8452Q and HMC5883L)
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
10 #define DEVICE_COMPASS_HMC5883L 0x3C // Hardware gen 1
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11
165
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
12 #define DEVICE_COMPASS_303D 0x3C // Hardware gen 2 (Single chip solution LSM303D)
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
13 #define DEVICE_ACCELARATOR_303DLHC 0x32 // Hardware gen 2 (Single chip solution LSM303DLHC)
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
14 #define DEVICE_COMPASS_303AGR 0x3C // Hardware gen 3 (Single chip solution LSM303AGR)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /* Battery Gas Gauge */
165
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
17 #define DEVICE_BATTERYGAUGE 0xC8 // LTC2941 battery gauge
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 HAL_StatusTypeDef I2C_Master_Transmit( uint16_t DevAddress, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 HAL_StatusTypeDef I2C_Master_TransmitNoStop( uint16_t DevAddress, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 HAL_StatusTypeDef I2C_Master_Receive( uint16_t DevAddress, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 HAL_StatusTypeDef MX_I2C1_Init(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 void I2C_DeInit(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 HAL_StatusTypeDef I2C1_Status(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 GPIO_PinState MX_I2C1_TestAndClear(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 //void I2C_Error(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #endif /* I2C_H */