44 lines
985 B
C
44 lines
985 B
C
#ifndef CONFIGURATION_H
|
|
#define CONFIGURATION_H
|
|
|
|
#include "nvs.h"
|
|
#include "nvs_flash.h"
|
|
#include "esp_adc/adc_oneshot.h"
|
|
|
|
#include "scd4x_data.h"
|
|
#include "APlib.h"
|
|
#include "ledController.h"
|
|
|
|
struct battery_data {
|
|
uint8_t battery_percent;
|
|
uint16_t min_raw; // 0% as a raw adc reading
|
|
uint16_t scale; // scaling between raw adc reading and percent
|
|
};
|
|
typedef struct battery_data battery_data_t;
|
|
|
|
struct battery_conf {
|
|
battery_data_t* data;
|
|
adc_channel_t adc_channel;
|
|
adc_oneshot_unit_handle_t* adc_handle;
|
|
uint16_t poll_delay;
|
|
};
|
|
typedef struct battery_conf battery_conf_t;
|
|
|
|
battery_conf_t* get_battery_configuration(nvs_handle_t nvs);
|
|
|
|
struct configuration_data {
|
|
scd4x_data_t* measure;
|
|
scd4x_config_t* sensor;
|
|
led_disp_config_t* leds;
|
|
uint8_t led_nb;
|
|
uint8_t wireless;
|
|
wifi_config_t* wifi_config;
|
|
char hostname[16];
|
|
battery_conf_t* battery_conf;
|
|
};
|
|
typedef struct configuration_data configuration_data_t;
|
|
|
|
void init_conf_from_nvs(configuration_data_t* conf);
|
|
|
|
#endif
|