Giter Site home page Giter Site logo

arduino-ina219's People

Contributors

jarzebski avatar spirituallyinsane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

arduino-ina219's Issues

No need to wait after Wire.requestFrom() and no Wire.beginTransmission() or endTransmission() should be used with Wire.requestFrom().

When the Wire.requestFrom() returns, the I2C transaction has completely finished and the received data is waiting in a buffer in the Wire library. There is nothing to wait for after the Wire.requestFrom(). The Wire.available() and Wire.read() only use that buffer, they are not involved in the I2C bus transaction.
The while-loop to wait for something can be removed.

The Wire.beginTransmission() and Wire.endTransmission() are only used when writing data. They should not be used with Wire.requestFrom().

Bus voltage needs to be unsigned.

The value stored in the Bus Voltage register are unsigned, so the bits should be written into an unsigned uint16_t instead of an int16_t value before doing the scaling math and returning a float. Otherwise it will be treated as two's complement, and any bus voltage over about 16 volts will return a negative number.

This would fix it:

float INA219::readBusVoltage(void)
{
    uint16_t voltage;

    voltage = readRegister16(INA219_REG_BUSVOLTAGE);
    voltage >>= 3;

    return (voltage * 0.004);

Add support for Arduino with STM32

Please add support for Arduino framework for STM32 chips.
I can confirm that it works for me after minor changes. Maybe I'll even make a pull request later, when I have some spare time.

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.