NinjaFlight
|
#include "stdbool.h"
#include "stdint.h"
#include "string.h"
#include <platform.h>
#include "common/maths.h"
#include "common/filter.h"
#include "drivers/adc.h"
#include "drivers/system.h"
#include "config/config.h"
#include "config/feature.h"
#include "sensors/battery.h"
Macros | |
#define | VBATT_PRESENT_THRESHOLD_MV 10 |
#define | VBATT_LPF_FREQ 1.0f |
#define | VBATTERY_STABLE_DELAY 40 |
#define | VBATT_HYSTERESIS 1 |
#define | ADCVREF 3300 |
Functions | |
void | battery_init (struct battery *self, const struct battery_config *config) |
uint16_t | battery_get_voltage (struct battery *self) |
uint8_t | battery_get_cell_count (struct battery *self) |
int32_t | battery_get_current (struct battery *self) |
int32_t | battery_get_spent_capacity (struct battery *self) |
uint16_t | battery_get_cell_voltage (struct battery *self) |
uint16_t | _battery_adc_to_voltage (struct battery *self, uint16_t src) |
void | battery_update (struct battery *self) |
battery_state_t | battery_get_state (struct battery *self) |
const char * | battery_get_state_str (struct battery *self) |
void | battery_update_current_meter (struct battery *self, int32_t lastUpdateAt) |
uint8_t | battery_get_remaining_percent (struct battery *self) |
uint8_t | battery_get_remaining_capacity (struct battery *self) |
#define ADCVREF 3300 |
#define VBATT_HYSTERESIS 1 |
#define VBATT_LPF_FREQ 1.0f |
#define VBATT_PRESENT_THRESHOLD_MV 10 |
#define VBATTERY_STABLE_DELAY 40 |
uint16_t _battery_adc_to_voltage | ( | struct battery * | self, |
uint16_t | src | ||
) |
uint8_t battery_get_cell_count | ( | struct battery * | self | ) |
uint16_t battery_get_cell_voltage | ( | struct battery * | self | ) |
int32_t battery_get_current | ( | struct battery * | self | ) |
uint8_t battery_get_remaining_capacity | ( | struct battery * | self | ) |
uint8_t battery_get_remaining_percent | ( | struct battery * | self | ) |
int32_t battery_get_spent_capacity | ( | struct battery * | self | ) |
battery_state_t battery_get_state | ( | struct battery * | self | ) |
const char* battery_get_state_str | ( | struct battery * | self | ) |
uint16_t battery_get_voltage | ( | struct battery * | self | ) |
void battery_init | ( | struct battery * | self, |
const struct battery_config * | config | ||
) |
void battery_update | ( | struct battery * | self | ) |
void battery_update_current_meter | ( | struct battery * | self, |
int32_t | lastUpdateAt | ||
) |