0.1.5 INA219

This commit is contained in:
Rob Tillaart 2023-09-24 11:25:28 +02:00
parent d951a8f2d4
commit da859c534f
6 changed files with 28 additions and 15 deletions

View File

@ -6,13 +6,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.1.5] - 2023-09-24
- Add Wire1 support for ESP32
- update readme.md
## [0.1.4] - 2023-06-12
- improve RP2040 support
- add address test in isConnected()
- update readme.md
- add array example
## [0.1.3] - 2023-03-31
- fix setBusADC() range check
- fix setShuntADC() range check

View File

@ -1,6 +1,6 @@
// FILE: INA219.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.4
// VERSION: 0.1.5
// DATE: 2021-05-18
// PURPOSE: Arduino library for INA219 voltage, current and power sensor
// URL: https://github.com/RobTillaart/INA219
@ -40,7 +40,7 @@ INA219::INA219(const uint8_t address, TwoWire *wire)
{
_address = address;
_wire = wire;
// not calibrated values by default.
// not calibrated values by default.
_current_LSB = 0;
_maxCurrent = 0;
_shunt = 0;
@ -50,7 +50,6 @@ INA219::INA219(const uint8_t address, TwoWire *wire)
#if defined (ESP8266) || defined(ESP32)
bool INA219::begin(const uint8_t sda, const uint8_t scl)
{
_wire = &Wire;
_wire->begin(sda, scl);
if (! isConnected()) return false;
return true;
@ -307,8 +306,6 @@ bool INA219::setMaxCurrentShunt(float maxCurrent, float shunt)
}
////////////////////////////////////////////////////////
//
// PRIVATE

View File

@ -1,7 +1,7 @@
#pragma once
// FILE: INA219.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.4
// VERSION: 0.1.5
// DATE: 2021-05-18
// PURPOSE: Arduino library for INA219 voltage, current and power sensor
// URL: https://github.com/RobTillaart/INA219
@ -14,7 +14,7 @@
#include "Wire.h"
#define INA219_LIB_VERSION (F("0.1.4"))
#define INA219_LIB_VERSION (F("0.1.5"))
class INA219
@ -63,7 +63,7 @@ public:
// factor = 1, 2, 4, 8
bool setGain(uint8_t factor = 1);
uint8_t getGain();
// mask
// mask
bool setBusADC(uint8_t mask = 0x03);
uint8_t getBusADC();
bool setShuntADC(uint8_t mask = 0x03);
@ -81,12 +81,12 @@ public:
bool setModeBusContinuous() { return setMode(6); };
bool setModeShuntBusContinuous() { return setMode(7); }; // default.
// CALIBRATION
// mandatory to set these! read datasheet.
// maxCurrent >= 0.001
// shunt >= 0.001
bool setMaxCurrentShunt(float maxCurrent = 3.4,
bool setMaxCurrentShunt(float maxCurrent = 3.4,
float shunt = 0.002);
bool isCalibrated() { return _current_LSB != 0.0; };
@ -104,7 +104,7 @@ public:
private:
uint16_t _readRegister(uint8_t reg);
uint16_t _writeRegister(uint8_t reg, uint16_t value);
float _current_LSB;

View File

@ -2,8 +2,11 @@
[![Arduino CI](https://github.com/RobTillaart/INA219/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![Arduino-lint](https://github.com/RobTillaart/INA219/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/INA219/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/INA219/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/INA219/actions/workflows/jsoncheck.yml)
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/INA219.svg)](https://github.com/RobTillaart/INA219/issues)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/INA219/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/INA219.svg?maxAge=3600)](https://github.com/RobTillaart/INA219/releases)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/INA219.svg)](https://registry.platformio.org/libraries/robtillaart/INA219)
# INA219
@ -257,3 +260,12 @@ to get the values in scientific notation like "3.5e-6"
- can't be sure so user is responsible
## Support
If you appreciate my libraries, you can support the development and maintenance.
Improve the quality of the libraries by providing issues and Pull Requests, or
donate through PayPal or GitHub sponsors.
Thank you,

View File

@ -15,9 +15,9 @@
"type": "git",
"url": "https://github.com/RobTillaart/INA219.git"
},
"version": "0.1.4",
"version": "0.1.5",
"license": "MIT",
"frameworks": "arduino",
"frameworks": "*",
"platforms": "*",
"headers": "INA219.h"
}

View File

@ -1,5 +1,5 @@
name=INA219
version=0.1.4
version=0.1.5
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for INA219 voltage, current and power sensor.