mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
OP-995: Fixes for correct battery monitor readout
This commit is contained in:
parent
51a7f27b99
commit
ab1c9c157f
@ -128,8 +128,7 @@ static void init_pins(void)
|
||||
|
||||
GPIO_StructInit(&GPIO_InitStructure);
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
|
||||
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
|
||||
for (uint32_t i = 0; i < PIOS_ADC_NUM_PINS; ++i) {
|
||||
if (config[i].port == NULL) {
|
||||
continue;
|
||||
|
@ -846,6 +846,16 @@ void PIOS_Board_Init(void)
|
||||
PIOS_DEBUG_Init(pios_tim_servoport_all_pins, NELEMENTS(pios_tim_servoport_all_pins));
|
||||
#endif
|
||||
|
||||
// Disable GPIO_A8 Pullup to prevent wrong results on battery voltage readout
|
||||
GPIO_InitTypeDef gpioA8 ={
|
||||
.GPIO_Speed = GPIO_Speed_2MHz,
|
||||
.GPIO_Mode = GPIO_Mode_IN,
|
||||
.GPIO_PuPd = GPIO_PuPd_NOPULL,
|
||||
.GPIO_Pin = GPIO_Pin_8,
|
||||
.GPIO_OType = GPIO_OType_OD,
|
||||
};
|
||||
GPIO_Init(GPIOA, &gpioA8);
|
||||
|
||||
if (PIOS_I2C_Init(&pios_i2c_mag_pressure_adapter_id, &pios_i2c_mag_pressure_adapter_cfg)) {
|
||||
PIOS_DEBUG_Assert(0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user