Files
JYF_STC15W4K_wireless_charge/Lib/ina226.h
2025-03-19 17:25:17 +08:00

31 lines
654 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.

#ifndef __INA226_H__
#define __INA226_H__
#include "delay.h"
#include "config.h"
#include "iic.h"
// 寄存器地址定义
#define CONFIG_REG 0x00
#define SHUNT_V_REG 0x01
#define BUS_V_REG 0x02
#define POWER_REG 0x03
#define CURRENT_REG 0x04
#define CAL_REG 0x05
#define ID_REG 0xFF
// I²C地址A0/A1接地
#define INA226_ADDR 0x80
// 函数声明
void INA226_Init (float r_shunt, float max_current);
void INA226_WriteReg (uint8_t reg, uint16_t value);
uint16_t INA226_ReadReg (uint8_t reg);
// float INA226_ReadShuntVoltage (void);
float INA226_ReadBusVoltage (void);
float INA226_ReadCurrent (void);
float INA226_ReadPower (void);
#endif