2021-06-05 21:20:12 +02:00
|
|
|
#ifndef MEASUREMENT_H
|
|
|
|
#define MEASUREMENT_H
|
|
|
|
|
|
|
|
#include <fxp_basic.h>
|
|
|
|
|
|
|
|
struct MeasurementResult
|
|
|
|
{
|
|
|
|
fxp_t u_bat; // in Volt
|
|
|
|
fxp_t u_solar; // in Volt
|
|
|
|
fxp_t u_sw; // in Volt
|
|
|
|
fxp_t i_solar; // in Ampere
|
|
|
|
fxp_t i_load; // in Ampere
|
|
|
|
fxp_t temperature; // in degrees Celsius
|
2021-06-18 23:37:16 +02:00
|
|
|
|
|
|
|
// exponentially averaged versions of the above
|
|
|
|
fxp_t avg_u_bat;
|
|
|
|
fxp_t avg_u_solar;
|
|
|
|
fxp_t avg_u_sw;
|
|
|
|
fxp_t avg_i_solar;
|
|
|
|
fxp_t avg_i_load;
|
|
|
|
fxp_t avg_temperature;
|
2021-06-05 21:20:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
void measurement_init(void);
|
|
|
|
void measurement_start(void);
|
|
|
|
void measurement_wait_for_completion(void);
|
|
|
|
void measurement_finalize(struct MeasurementResult *result);
|
|
|
|
|
|
|
|
#endif // MEASUREMENT_H
|