Git Product home page Git Product logo

Comments (1)

kutukvpavel avatar kutukvpavel commented on June 12, 2024

Well, I stumbled upon this strange design decision too (good thing I looked at the code before trying to use the lib). The "WaitForData" name of the functions is actually very misleading. Under the hood there's no wait cycle, just an if statement, that returns 0 if the data is not ready yet, so you are supposed to create your own wait cycle, kinda like:

ads1220.Start_Conv();
int32_t data;  
while ((data = ads1220.Read_WaitForData(), data) == 0);  
Serial.println(data);  

God knows why the developers have implemented it this way. The library in general looks unfinished, to say the least. For example, field "NewDataAvailable" is defined, but never used. There are nested includes (cpp file includes headers already included in the .h file...), they don't hurt, but are completely redundant.

Personally, since we have defined DRDY pin in our own code, I would've written the wait cycle like this (though _WaitForData starts to look even more WTFish here):

ads1220.Start_Conv();  
while(digitalRead(your_DRDY_definition_here));  
int32_t data = ads1220.Read_WaitForData();  
Serial.println(data);  

This library is more like a nice template you can start development with, that has all necessary constants declared and SPI mechanics hidden. But you'll still have to extend it.

Edit: I've looked some more into the lib, and it appears that all read functions, except the most basic Read_WaitForData, are just a copy/paste of the latter with minor modifications. Yeah, so don't expect them to work at all, at least out-of-the-box. Probably, I'll make a proper fork at some point, since I'm using ads1220 on an stm32-based board often.

from protocentral_ads1220.

Related Issues (15)

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.