QuikSPI Library for INA239 & Arduino

Hello Folks. I was wondering if anyone could look over why this library called QuickSPI doesn't work. It's a GitHub spi library for the INA239 power monitor sensor.
QuickSPI
I got the device reading and working with Arduino's SPI library but just couldn't keep myself away from figuring out the trouble with the QuickSPI library from github. When I compile the example code for this library it gives me errors that a .h file does not exist, so I moved that .h file into the directory one level above that. From there it just seems like more errors beyond my understanding. The below code is the example I tried.

#include <SPI.h>
#include <QuickSPI.h>

#define Pin_SPI_nCS_ADC 10
SPIClass mySPI(SPI);

INA239<> ina(mySPI, Pin_SPI_nCS_ADC, SPISettings(1000000, SPI_MSBFIRST, SPI_MODE1));

void setup() {
    ina.Configure();
}

void loop() {
    // Example of automatically generated register read method
    // This method is automatically generated from
    //    QUICKSPI_DEFINE_REGISTER16_RO(ManufacturerID, (0x3E << 2) | ReadFlag) {};
    uint32_t manufacturerId = zoneADC.readManufacturerID(); // Should be 0x5449
    
    // Example 
    float current = zoneADC.ComputeCurrent();
    float voltage = zoneADC.ComputeVoltage();
    
    // TODO Your code goes here...
}

I won't use that library, it seems to be unfinished. The example in the README doesn't compile and doesn't make sense that way. The InA239.hpp seems to implement the INA239 class for the object declared in the globals section (it's not included in the example though) but "zoneADC" is not declared anyway and appears "magically" in the loop(). It's not your fault, the example is simply wrong.

1 Like

I understand. Thanks for taking a look at it with me.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.