# 成功读取电压并显示
This commit is contained in:
32
Lib/ina226.h
32
Lib/ina226.h
@ -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
|
Reference in New Issue
Block a user