# 成功读取电压并显示

This commit is contained in:
jxh
2025-03-18 22:49:46 +08:00
parent 65614ace50
commit 7bcd4c1c17
17 changed files with 1120 additions and 863 deletions

View File

@ -3,29 +3,29 @@
#include "delay.h"
#include "iic.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
#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
#define INA226_ADDR 0x80
// 函数声明
void INA226_Init(uint16_t r_shunt, float max_current);
void INA226_WriteReg(uint8_t reg, uint16_t value);
uint16_t INA226_ReadReg(uint8_t reg);
void INA226_Init (uint16_t 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);
// float INA226_ReadShuntVoltage (void);
float INA226_ReadBusVoltage (void);
float INA226_ReadCurrent (void);
float INA226_ReadPower (void);
#endif