72 lines
1.2 KiB
C
Executable File
72 lines
1.2 KiB
C
Executable File
#ifndef METER_H_
|
|
#define METER_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
/**
|
|
* @brief Estrutura com os dados de medição trifásica.
|
|
*/
|
|
typedef struct MeterData
|
|
{
|
|
float vrmsA;
|
|
float vrmsB;
|
|
float vrmsC;
|
|
float irmsA;
|
|
float irmsB;
|
|
float irmsC;
|
|
int32_t wattA;
|
|
int32_t varA;
|
|
int32_t vaA;
|
|
int32_t wattB;
|
|
int32_t varB;
|
|
int32_t vaB;
|
|
int32_t wattC;
|
|
int32_t varC;
|
|
int32_t vaC;
|
|
} MeterData;
|
|
|
|
/**
|
|
* @brief Inicializa o hardware do medidor e recursos internos (SPI, mutex).
|
|
*/
|
|
void meter_init(void);
|
|
|
|
/**
|
|
* @brief Inicia a task de medição.
|
|
*/
|
|
void meter_start(void);
|
|
|
|
/**
|
|
* @brief Para a task de medição e reseta dados.
|
|
*/
|
|
void meter_stop(void);
|
|
|
|
/**
|
|
* @brief Zera todos os campos da estrutura de dados do medidor.
|
|
*/
|
|
void meter_initData(void);
|
|
|
|
/**
|
|
* @brief Retorna uma cópia segura dos dados atuais do medidor.
|
|
*
|
|
* @return MeterData Cópia da última leitura válida.
|
|
*/
|
|
MeterData meter_getData(void);
|
|
|
|
|
|
/**
|
|
* @brief Check if meter task is currently running.
|
|
*
|
|
* @return true if running, false otherwise.
|
|
*/
|
|
bool meter_is_running(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* METER_H_ */ |