ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
Loading...
Searching...
No Matches
batt_adc.c File Reference

ADC1 injected-group binding for the battery (see batt_adc.h). More...

#include "batt_adc.h"
#include "app_config.h"
#include "stm32wbxx_hal.h"
#include "stm32wbxx_ll_adc.h"
#include "stm32wbxx_ll_bus.h"
#include "stm32wbxx_ll_gpio.h"
#include "stm32wbxx_ll_rcc.h"
Include dependency graph for batt_adc.c:

Go to the source code of this file.

Functions

static void delay_us (uint32_t us)
 
static void analog_pin (GPIO_TypeDef *port, uint32_t pin)
 
int batt_adc_init (void)
 0 = ok
 
int batt_adc_read (float *vbat_pin, float *cur_pin)
 0 = a new sample: pin voltages in volts
 

Variables

static uint8_t s_started
 

Detailed Description

ADC1 injected-group binding for the battery (see batt_adc.h).

Reference: RM0434 ยง16 (ADC), STM32WB55 datasheet (VREFINT_CAL).

Definition in file batt_adc.c.

Function Documentation

◆ delay_us()

static void delay_us ( uint32_t  us)
static

Definition at line 16 of file batt_adc.c.

References n.

Referenced by batt_adc_init().

Here is the caller graph for this function:

◆ analog_pin()

static void analog_pin ( GPIO_TypeDef *  port,
uint32_t  pin 
)
static

Definition at line 22 of file batt_adc.c.

References port.

Referenced by batt_adc_init().

Here is the caller graph for this function:

◆ batt_adc_init()

int batt_adc_init ( void  )

0 = ok

Definition at line 30 of file batt_adc.c.

References analog_pin(), APP_BATT_CUR_CH, APP_BATT_CUR_PIN, APP_BATT_CUR_PORT, APP_BATT_VBAT_CH, APP_BATT_VBAT_PIN, APP_BATT_VBAT_PORT, delay_us(), and s_started.

Referenced by app_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ batt_adc_read()

int batt_adc_read ( float *  vbat_pin,
float *  cur_pin 
)

0 = a new sample: pin voltages in volts

Definition at line 79 of file batt_adc.c.

References s_started.

Referenced by app_start().

Here is the caller graph for this function:

Variable Documentation

◆ s_started

uint8_t s_started
static

Definition at line 14 of file batt_adc.c.

Referenced by batt_adc_init(), and batt_adc_read().