Support for Trill capacitive sensors#657
Conversation
2f58e13 to
929dd95
Compare
|
Hi y'all! This is looking great! While I think there is quite a bit that would make this feel more like the rest of the libDaisy, but I'd be happy to merge it with a few minor tweaks. At a minimum I think we'll want to:
From a style/consistency perspective, there are a few more changes that would affect the API if they're changed later:
Since this would be a new device, I'm open to the API changing a bit over time. So the bullet-list items aren't strictly necessary at this time, but would be welcome at any point. However, I would like for the initial few points to be addressed before we merge it. I don't foresee any of the recent/upcoming changes having an impact on your PR. So no rush. Thanks again for the contribution, and let me know if you any questions! |
comparisons, added definition for __try/__catch which were failing the CI
…format wouldn't know how to handle it
used:
clang-format-11 --verbose -i src/dev/trill/*{.cpp,.h} examples/Trill*/*{.cpp.h}
|
@giuliomoro I was able to do a bit of testing with this, and noticed that my sensors are on firmware version 2, which lead to a few issues. So in order for the Trill example to work properly, I needed to modify the After this modification, and the addition of: LDFLAGS += -u _printf_floatto the Makefile to allow printing of floats I was able to see my Trill Bar working correctly. If the expectation is for this to work with multiple firmware versions on the sensors (I'm not aware of how to update mine, but I haven't looked into it much yet), then we should put a conditional check for this as well. I do also have a Trill Craft, but I haven't tested that example yet (I need to the correct jumpers in my office to get it connected to the daisy), but it looks like it does not require the floating point print linker setting mentioned above. Apart from that, I think at a minimum I'd like for the three minor changes I mentioned last month to get made, and then we can merge this. When we do merge this, I'll make a note in the corresponding release's notes (and maybe also in the Trill class docstring as well) to indicate that we'll treat this API as unstable for now so we can work gradually make it a bit more consistent with the rest of libDaisy without qualifying each tweak as a major version change. Please let me know if you have any questions. |
|
@giuliomoro can you have a look at the comments? would be nice to move this forward! |
|
@dromer I'd love to, but it's going to be a month till we ship the thing I am currently working on, before I can get back to this. I'd really want to get this merged swiftly and not add unnecessary burdens, but I want to have a look ahead for maintainability purposes. In general I'd really wish I could just drop the upstream files in here, with minimal wrapping modifications, rather than having to rename methods and variables to conform to a style. I appreciate that daisy strives to present a uniform-ish interface, but if that means that all changes for external libraries (such as this one, not sure if you have others or plan to) will require more effort to be backported, it may be an obstacle to keeping the library up to date. So, wrt #657 (comment) @stephenhensley , would it be OK to only do the numbered list items and not the bullet points? An alternative is to provide a small wrapping class (e.g.:
Or, even better, the most maintainable solution:
|
|
The wrapping class actually sounds like a pretty good idea as it would give the most consistent user-facing API while keeping the Trill library separate and easy to update (a submodule sounds good!) Of course lets see what @stephenhensley has to say ;) |
|
@giuliomoro thanks for your reply! I'll have to think a bit on the overall plan, but my initial thoughts are that the minimum criteria from my first comment:
would still be things I'd consider requirements for this to be merged, with all other style-conformance/uniformity being optional. My initial impression of this contribution was to provide (with the linux driver as a starting point) an API for accessing trill sensors that would eventually feel consistent with the rest of libDaisy, and not just a bundling the existing trill-linux sources into libDaisy (similar to how CMSIS DSP is currently included in the library). With that said, I am open to the latter approach, whether that includes switching the directly copied files to be located in a submodule, or leaving modified copies within libDaisy (maybe more clearly in a separate third-party source directory). |
This is the "Linux" library (available here) wrapped into libDaisy. The low-level I2c I/O stuff is done here: https://github.com/giuliomoro/libDaisy/blob/64c08470c079693cd9e2ab59cf2b85a5cff4727c/src/dev/trill/I2c.h
Contributions by me and @virvel .
Tested by @dromer and @virvel when it was based on 17ee39b.
Previous discussion giuliomoro#1
Closes #602