Comments (1)
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)
- Should support SPI transaction. HOT 2
- am I drawing too much current on analog inputs?
- Struggling with getting it to work... HOT 1
- Running multiple SPI devices CAN give some issues.
- Resistive Bridge Measurement
- Add software SPI support HOT 1
- Question about unprecise messurment HOT 2
- MOSI, MISO, and SCLK pins
- Few more issues in library HOT 1
- Startup problem with battery
- Unable to add library in arduino 1.6.12
- Bad NewDataAvailable test in example/Basic HOT 1
- external vref HOT 1
- Trying to use this with Geophone SM-24 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from protocentral_ads1220.