##// END OF EJS Templates
sync
sync

File last commit:

r29:54cc31ae3ae3 default
r29:54cc31ae3ae3 default
Show More
ina226.h
66 lines | 2.2 KiB | text/x-c | CLexer
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
sync
r28 /*------------------------------------------------------------------------------
-- This file is a part of the libuc, microcontroler library
-- Copyright (C) 2011, Alexis Jeandet
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-------------------------------------------------------------------------------
-- Author : Alexis Jeandet
-- Mail : alexis.jeandet@gmail.com
-------------------------------------------------------------------------------*/
#ifndef INA226_H
#define INA226_H
#include <i2c.h>
#include <uhandle.h>
typedef struct INA226_t
{
i2c_t i2cdev;
uint8_t devAddress;
uint32_t shuntmOhm;
uint32_t CurrentRangeuAmp;
}INA226_t;
extern int ina226open(INA226_t* dev,i2c_t i2cdev,uint8_t A0,uint8_t A1,uint32_t shuntmOhm, uint32_t CurrentRangeuAmp);
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r29 extern uint16_t ina226getID(INA226_t* dev);
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
sync
r28 extern int ina226calibrate(INA226_t* dev,uint32_t shuntmOhm, uint32_t CurrentRangeuAmp);
extern uint32_t ina226getBusVoltage(INA226_t* dev);
extern uint32_t ina226getPower(INA226_t* dev);
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r29 extern uint32_t ina226getCurrent(INA226_t* dev);
extern uint16_t ina226getReg(INA226_t* dev,char reg);
extern int ina226setReg(INA226_t* dev,char reg,int16_t value);
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
sync
r28
#define INA226_I2C_ADDRESS 0x40
#define INA226_Die_ID_Reg 0xFF
jeandet@PC-DE-JEANDET.lab-lpp.local
sync
r29 #define INA226_Configuration_Reg 0
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
sync
r28 #define INA226_Shunt_Voltage_Reg 1
#define INA226_Bus_Voltage_Reg 2
#define INA226_Power_Reg 3
#define INA226_Current_Reg 4
#define INA226_Calibration_Reg 5
#define INA226_Mask_Enable_Reg 6
#define INA226_Alert_Limit_Reg 7
#endif