Code Monkey home page Code Monkey logo

ina260's Introduction

Arduino INA260 Library

Introduction

This is a small library which exposes the functionality of Texas Instruments' INA260 current-sense amplifier I2C device. It is necessary to read the INA260 datasheet first to understand how the device works. There should be a 1:1 mapping between the datasheet and the types and functions exposed in this library, wherever possible.

The library also includes several helper and conversion functions which users of this device may find useful.

Installation

Check-out the Git repository or extract a .zip of it to a directory named INA260 in your Arduino Sketch directory's libraries sub-directory. Refer to the Installing Additional Arduino Libraries Guide for more information on installing Arduino libraries.

Documentation

The best sources of information are the TI INA260 datasheet and the INA260.h header file. Since this is a thin wrapper over the INA260 I2C interface, you should be able to work out how to use this API based on the information provided in the datasheet. See also the examples directory for working examples on using the library.

Dependencies

This library uses only the standard Arduino/Wire libraries and modern C++ standard library/compiler. It makes use of some GCC-specific extensions and assumes the target architecture is little endian. For most uses this doesn't matter, unless you're porting the library to a new architecture or compiler. The examples assume you have the Arduino connected by USB/serial and can use the Arduino IDE's Serial Monitor/Plotter functionality.

ina260's People

Contributors

codebrainz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jaseem343 buelowp

ina260's Issues

How can I print/view this union/struc?

If I consider this section you code:

  // create an instance of the register structure. note the ={0} used
  // to zero-initialize the instance. You could also use memset() or
  // manually initialize all of the fields to zero. All of the fields
  // are written to the config. register so you want to make sure you
  // know what they're all set to.
  INA260::ConfigurationRegister configReg = {0, 0, 0, 0, 0};
  
  configReg.mode   = INA260::MODE_ISH_VBUS_CONTINUOUS;  // continuously sample voltage and current (this is default)
  configReg.ishct  = INA260::ISHCT_1_1MS;               // allow 2.116ms also for the ADC sampling of the current
  configReg.vbusct = INA260::VBUSCT_1_1MS;              // allow 2.116ms for the ADC sampling of the bus voltage
  configReg.avg    = INA260::AVG_16;                    // average 64 samples for each reading
  
  ina260.writeConfigurationRegister(configReg);         //Write the configuration register to the INA260 over I2C

How can I print configReg to see the bit pattern?

Regards, M.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.