Mercurial > public > ostc4
annotate Small_CPU/Inc/i2c.h @ 554:3328189786e7
Added external ADC interface functionality (MCP3424):
Added communication protocoll to read data from external ADC. At the moment 16bit and 18bit resolutions are supported. External data will be read and forwarded depending on the conversion time of the ADC.
author | Ideenmodellierer |
---|---|
date | Thu, 12 Nov 2020 19:46:03 +0100 |
parents | e595d2d1f77f |
children | 91a8f9893e68 |
rev | line source |
---|---|
38 | 1 /* Define to prevent recursive inclusion -------------------------------------*/ |
2 #ifndef I2C_H | |
3 #define I2C_H | |
4 | |
165 | 5 /* Pressure Sensor */ |
357 | 6 #define DEVICE_PRESSURE_MS5803 0xEE // gen 1 and gen 2 use 0xEE (MS5803) |
7 #define DEVICE_PRESSURE_MS5837 0xEC // end-2019 hardware (gen 3) uses 0xEC (MS5837) | |
38 | 8 |
165 | 9 /* Compass/Accelerometer */ |
357 | 10 #define COMPASS_NOT_RECOGNIZED 0xAA ///< id used with hardwareCompass |
11 #define compass_generation1 0x01 // Hardware gen 1 (Two chip solution with MMA8452Q and HMC5883L) | |
12 #define compass_generation2 0x02 // Hardware gen 2 (Single chip solution LSM303D) | |
13 #define compass_generation3 0x03 // Hardware gen 3 (Single chip solution LSM303AGR) | |
14 | |
165 | 15 #define DEVICE_ACCELARATOR_MMA8452Q 0x38 // Hardware gen 1 (Two chip solution with MMA8452Q and HMC5883L) |
357 | 16 #define DEVICE_COMPASS_HMC5883L 0x3C // Hardware gen 1 (Two chip solution with MMA8452Q and HMC5883L) |
38 | 17 |
165 | 18 #define DEVICE_COMPASS_303D 0x3C // Hardware gen 2 (Single chip solution LSM303D) |
357 | 19 |
165 | 20 #define DEVICE_COMPASS_303AGR 0x3C // Hardware gen 3 (Single chip solution LSM303AGR) |
357 | 21 #define DEVICE_ACCELARATOR_303AGR 0x32 // Hardware gen 3 (Single chip solution LSM303AGR) |
22 | |
23 // Compass 3 defines (Can move in separate .h file...) | |
24 #define WHOIAM_VALUE_LSM303AGR 0x33 | |
38 | 25 |
26 /* Battery Gas Gauge */ | |
165 | 27 #define DEVICE_BATTERYGAUGE 0xC8 // LTC2941 battery gauge |
38 | 28 |
545
e595d2d1f77f
Add I2C address for external bulkhead ADC (Hardware gen 3 only) to i2c.h
heinrichsweikamp
parents:
357
diff
changeset
|
29 /* ADC for external bulkhead */ |
554
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
545
diff
changeset
|
30 #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
|
31 |
38 | 32 |
33 /* Includes ------------------------------------------------------------------*/ | |
34 #include "stm32f4xx_hal.h" | |
35 | |
36 HAL_StatusTypeDef I2C_Master_Transmit( uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |
37 HAL_StatusTypeDef I2C_Master_TransmitNoStop( uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |
38 HAL_StatusTypeDef I2C_Master_Receive( uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |
39 HAL_StatusTypeDef MX_I2C1_Init(void); | |
40 void I2C_DeInit(void); | |
41 HAL_StatusTypeDef I2C1_Status(void); | |
42 | |
43 GPIO_PinState MX_I2C1_TestAndClear(void); | |
44 | |
45 //void I2C_Error(void); | |
46 | |
47 | |
48 #endif /* I2C_H */ |