-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AD400x: Add support for AD400x series #17
Conversation
threexc
commented
Feb 14, 2024
- Add AD400x/Base.m class, refactor AD4020
- Add AD4021, AD4022
- Add AD4000, AD4004, AD4008
- Add AD4001, AD4005
- Add AD4002, AD4006, AD4010
- Add AD4003, AD4007, AD4011
- Update docs, metadata
2c0a851
to
515491a
Compare
Updated to match the current version of the ad400x driver. |
Just to confirm - have the drivers added as part of this PR been tested with the AD4020 example script (after changing the class name in the example script)? |
515491a
to
4ba8159
Compare
I've tested that example flow manually in the MATLAB terminal. The AD4020 example script doesn't quite work as-is right now - it seems that when rx.Voltage() is called after rx(), it outputs this error:
I was planning on submitting a follow-up PR afterwards to remove that. Do you think that should be submitted first? EDIT: Specifically, the example script does this:
Which results in the error mentioned above. This makes sense at the driver level, but I'm not sure why it's in the example script. |
I suppose I could also just add that fix to this PR... :) |
Oh yes, that'd work too. |
4ba8159
to
ff1f14b
Compare
I think it's the kernel driver - if I do rx() in MATLAB and then try to read the raw voltage0 value with iio_info, I get I've pushed an update that removes the line from the example script. I'm wondering if the Voltage() function should really be in there at all, though. |
I think it should be possible to destroy the buffer for rx channels, and then do attribute reads/writes. Something like this, perhaps - https://github.com/analogdevicesinc/ToolboxCommon/blob/be769e5517eea786eb4c0b32e231d6a03be6c105/RxTx.m#L195 ? |
I've made a local change to inherit the RxTx contents and tried to call releaseChanBuffers/destroyBuf, but both give "Cannot access method" results (which seems reasonable). I'm not overly familiar with MATLAB's object-oriented quirks though - do you know if I'm missing something with the use of those functions, or do you mean that I should re-define them inside the AD400x Base.m module? |
On second thoughts - I'd say we can leave it be, and drop the It's better if I create an issue, and think through any refactoring that needs to be done to have an elegant solution that works for all the supported parts. |
ff1f14b
to
933ee56
Compare
I pushed a new version that removes the Voltage() function entirely, but left VoltageScale() and VoltageOffset(), which both work OK. Going to do a bit more testing and then I'll ping here when I think it's fully ready. |
- Add AD400x/Base.m class, refactor AD4020 - Add AD4021, AD4022 - Add AD4000, AD4004, AD4008 - Add AD4001, AD4005 - Add AD4002, AD4006, AD4010 - Add AD4003, AD4007, AD4011 - Update docs, metadata - Update examples/ad4020DataCapture.m to remove incorrect rx.Voltage() call Signed-off-by: Trevor Gamblin <[email protected]>
933ee56
to
41cb337
Compare
Should be good to go now. The version I pushed yesterday fixes datatypes for the AD4001 and AD4005, which I had mistakenly listed as int16 when refactoring to use the AD400x base class. |
Lgtm |
Thanks! |