Giter VIP home page Giter VIP logo

Comments (8)

wollewald avatar wollewald commented on July 20, 2024

Hi @xiyangdiy,

there two ways to create your ADS1220 object:

ADS1220_WE ads = ADS1220_WE(ADS1220_CS_PIN, ADS1220_DRDY_PIN);
// or:
ADS1220_WE ads = ADS1220_WE(ADS1220_CS_PIN, ADS1220_DRDY_PIN, &SPI);

The second option uses "SPIClass *s". If you work with just one SPI object, then it doesn't make a difference which option you take. The SPI object is passed as a reference (with the "&"). That means the original object is used. So it's not too interesting for MCUs which only have one SPI interface. But if you work for example with an ESP32 which has two SPI interfaces and you want to use both then you would need to pass the SPI objects.

from ads1220_we.

wollewald avatar wollewald commented on July 20, 2024

By the way thanks for the first star! And sorry for all the releases with the last weeks. Since it is new, I still found some bugs.

from ads1220_we.

xiyangdiy avatar xiyangdiy commented on July 20, 2024

Thank you for your answer. Can this library use SoftSPI? If so, do you have a specific example? I found a library, its name is "SoftSPIB", it can customize spi pins, but I don't know how to use it with "ADS1220_WE" library.

from ads1220_we.

xiyangdiy avatar xiyangdiy commented on July 20, 2024

My MCU is ESP32-S3.

from ads1220_we.

wollewald avatar wollewald commented on July 20, 2024

That would need some changes in the library. You would define the SoftSPIB Object like this:

SoftSPIB mySPI(12, 13, 4);

and then pass the mySPI object like this:

ADS1220_WE ads = ADS1220_WE(ADS1220_CS_PIN, ADS1220_DRDY_PIN, &mySPI); 

On the library side you would need a constructor that takes the SoftSPIB object, like:

ADS1220_WE::ADS1220_WE(int cs, int drdy, SoftSPIB *s){
     _softSPI = s;

A variable would need to be defined:

SoftSPI *_softSPI;

And then finally all SPI functions (line 324 till the end) in ADS1220_WE.cpp would need to be changed to the corresponding SoftSPIB functions, beauce they are a bit different.

So in summary: the library could be adjusted, but with some effort.

If may ask why do you want to use SoftSPIB? Why don't you just use the standard SPI interface of the ESP32?

from ads1220_we.

wollewald avatar wollewald commented on July 20, 2024

I have just tried an example sketch with an ESP32 Development Board using the standard SPI interface. I only had to adjust the DRDY Pin and the CS Pin. The rest was unchanged.

from ads1220_we.

xiyangdiy avatar xiyangdiy commented on July 20, 2024

Thanks for your enthusiastic answer!
I'm just a beginner, your answer helped me a lot!

from ads1220_we.

wollewald avatar wollewald commented on July 20, 2024

You are welcome!

from ads1220_we.

Related Issues (4)

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.