Files
watch-watch/main/ina226_monitor.h

30 lines
1018 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Developed by TComLab
* Version: v0.1
* Date: 2025-12-15
*/
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include "esp_err.h"
typedef struct {
float voltage_v;
float current_ma;
float power_mw;
} ina226_reading_t;
// Ініціалізує INA226: конфігурує I2C та калібрує вимірювач.
esp_err_t ina226_monitor_init(void);
// true, якщо драйвер вже ініціалізований.
bool ina226_monitor_ready(void);
// INA226 підтримує один канал, але інтерфейс залишається узагальненим.
size_t ina226_monitor_channel_count(void);
// Зчитує нові дані; out_reading може бути NULL, якщо дані не потрібні.
esp_err_t ina226_monitor_sample(ina226_reading_t *out_reading);
// Повертає кеш останнього вимірювання або NULL, якщо модуль неактивний.
const ina226_reading_t *ina226_monitor_get_last(void);