mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 22:05:17 +03:00
Disable bmp085 interrupt if no baro
This commit is contained in:
parent
14a95a3f18
commit
3fdbe68ee1
1 changed files with 27 additions and 21 deletions
|
@ -154,11 +154,6 @@ bool bmp085Detect(const bmp085Config_t *config, baro_t *baro)
|
|||
if (bmp085InitDone)
|
||||
return true;
|
||||
|
||||
delay(20); // datasheet says 10ms, we'll be careful and do 20.
|
||||
ack = i2cRead(BMP085_I2C_ADDR, BMP085_CHIP_ID__REG, 1, &data); /* read Chip Id */
|
||||
if(!ack)
|
||||
return false;
|
||||
|
||||
#if defined(BARO_XCLR_GPIO) && defined(BARO_EOC_GPIO)
|
||||
if (config) {
|
||||
EXTI_InitTypeDef EXTI_InitStructure;
|
||||
|
@ -193,6 +188,10 @@ bool bmp085Detect(const bmp085Config_t *config, baro_t *baro)
|
|||
UNUSED(config);
|
||||
#endif
|
||||
|
||||
delay(20); // datasheet says 10ms, we'll be careful and do 20.
|
||||
|
||||
ack = i2cRead(BMP085_I2C_ADDR, BMP085_CHIP_ID__REG, 1, &data); /* read Chip Id */
|
||||
if (ack) {
|
||||
bmp085.chip_id = BMP085_GET_BITSLICE(data, BMP085_CHIP_ID);
|
||||
bmp085.oversampling_setting = 3;
|
||||
|
||||
|
@ -211,8 +210,15 @@ bool bmp085Detect(const bmp085Config_t *config, baro_t *baro)
|
|||
baro->calculate = bmp085_calculate;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BARO_EOC_GPIO
|
||||
EXTI_InitTypeDef EXTI_InitStructure;
|
||||
// Disable EXTI interrupt for barometer EOC
|
||||
EXTI_InitStructure.EXTI_Line = EXTI_Line14;
|
||||
EXTI_InitStructure.EXTI_LineCmd = DISABLE;
|
||||
EXTI_Init(&EXTI_InitStructure);
|
||||
|
||||
unregisterExti15_10_CallbackHandler(BMP085_EOC_EXTI_Handler);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue