annotate Small_CPU/Inc/i2c.h @ 688:8c92f7743e14 Betatest

Added sanity check for temperature and pressure values: It happens from time to time at the debug hardware (electronic without housing) that pressure or temperature are in an invalid range . To avoid side effects a sanity check has been added.
author Ideenmodellierer
date Fri, 05 Aug 2022 15:13:29 +0200
parents 91a8f9893e68
children
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 */
357
c3d511365552 Add Support for new end-2019 hardware:
heinrichsweikamp
parents: 356
diff changeset
6 #define DEVICE_PRESSURE_MS5803 0xEE // gen 1 and gen 2 use 0xEE (MS5803)
c3d511365552 Add Support for new end-2019 hardware:
heinrichsweikamp
parents: 356
diff changeset
7 #define DEVICE_PRESSURE_MS5837 0xEC // end-2019 hardware (gen 3) uses 0xEC (MS5837)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8
165
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
9 /* Compass/Accelerometer */
357
c3d511365552 Add Support for new end-2019 hardware:
heinrichsweikamp
parents: 356
diff changeset
10 #define COMPASS_NOT_RECOGNIZED 0xAA ///< id used with hardwareCompass
571
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 554
diff changeset
11
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 554
diff changeset
12 typedef enum
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 554
diff changeset
13 {
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 554
diff changeset
14 compass_generation_undef = 0x00,
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 554
diff changeset
15 compass_generation1, // Hardware gen 1 (Two chip solution with MMA8452Q and HMC5883L)
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 554
diff changeset
16 compass_generation2, // Hardware gen 2 (Single chip solution LSM303D)
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 554
diff changeset
17 compass_generation3, // Hardware gen 3 (Single chip solution LSM303AGR)
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 554
diff changeset
18 compass_generation_future
91a8f9893e68 Reactivate compass parameter stored in NVM:
Ideenmodellierer
parents: 554
diff changeset
19 } compass_generation_t;
357
c3d511365552 Add Support for new end-2019 hardware:
heinrichsweikamp
parents: 356
diff changeset
20
165
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
21 #define DEVICE_ACCELARATOR_MMA8452Q 0x38 // Hardware gen 1 (Two chip solution with MMA8452Q and HMC5883L)
357
c3d511365552 Add Support for new end-2019 hardware:
heinrichsweikamp
parents: 356
diff changeset
22 #define DEVICE_COMPASS_HMC5883L 0x3C // Hardware gen 1 (Two chip solution with MMA8452Q and HMC5883L)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23
165
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
24 #define DEVICE_COMPASS_303D 0x3C // Hardware gen 2 (Single chip solution LSM303D)
357
c3d511365552 Add Support for new end-2019 hardware:
heinrichsweikamp
parents: 356
diff changeset
25
165
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
26 #define DEVICE_COMPASS_303AGR 0x3C // Hardware gen 3 (Single chip solution LSM303AGR)
357
c3d511365552 Add Support for new end-2019 hardware:
heinrichsweikamp
parents: 356
diff changeset
27 #define DEVICE_ACCELARATOR_303AGR 0x32 // Hardware gen 3 (Single chip solution LSM303AGR)
c3d511365552 Add Support for new end-2019 hardware:
heinrichsweikamp
parents: 356
diff changeset
28
c3d511365552 Add Support for new end-2019 hardware:
heinrichsweikamp
parents: 356
diff changeset
29 // Compass 3 defines (Can move in separate .h file...)
c3d511365552 Add Support for new end-2019 hardware:
heinrichsweikamp
parents: 356
diff changeset
30 #define WHOIAM_VALUE_LSM303AGR 0x33
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 /* Battery Gas Gauge */
165
e9cce686fe41 Minor: Some documentation for new hardware
heinrichsweikamp
parents: 38
diff changeset
33 #define DEVICE_BATTERYGAUGE 0xC8 // LTC2941 battery gauge
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34
545
e595d2d1f77f Add I2C address for external bulkhead ADC (Hardware gen 3 only) to i2c.h
heinrichsweikamp
parents: 357
diff changeset
35 /* ADC for external bulkhead */
554
3328189786e7 Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents: 545
diff changeset
36 #define DEVICE_EXTERNAL_ADC 0xD0 // MCP3424 with Adr0=GND and Adr1=GND (Hardware gen 3 only)
545
e595d2d1f77f Add I2C address for external bulkhead ADC (Hardware gen 3 only) to i2c.h
heinrichsweikamp
parents: 357
diff changeset
37
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 HAL_StatusTypeDef I2C_Master_Transmit( uint16_t DevAddress, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 HAL_StatusTypeDef I2C_Master_TransmitNoStop( uint16_t DevAddress, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 HAL_StatusTypeDef I2C_Master_Receive( uint16_t DevAddress, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 HAL_StatusTypeDef MX_I2C1_Init(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 void I2C_DeInit(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 HAL_StatusTypeDef I2C1_Status(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 GPIO_PinState MX_I2C1_TestAndClear(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 //void I2C_Error(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 #endif /* I2C_H */