Conversation
* Updated continuous adc to allow user to start/stop adc (instead of only being called in constructor/destructor) * Updated example to test starting/stopping of adc * Updated continuous adc to convert config struct into id so that there are no possible collisions between channels (e.g. if we wanted to read channel 0 from both ADC1 and ADC2 at the same time) * Updated continuous adc and oneshot adc to take AdcConfig as input argument for reading channel information instead of just the adc_channel_t which could collide * Updated examples that used adc to use new APIs (controller, joystick, thermistor) * Updated ads1x15 component to add missing pthread requirement for thread sleeping * Updated AdcConfig to support equality operators (for use with the std::find that we use) * Updated AdcConfig to support printing with libfmt * Rebuilt docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Motivation and Context
Previously, the
ContinuousAdchad a possibility of collision in the data storage it used for values and filtering stemming from the use ofadc_channel_tas the key (and as the input argument to the relevant functions. On theOneshotAdcsuch an API made sense because the oneshot adc hardware that it wraps can only be configured for a single adc unit at a time, however the continuous adc hardware supports reading from many channels across adc units. In this case, if the user wanted to read from the same channel ID (e.g.ADC_CHANNEL_0) on bothADC_UNIT_1andADC_UNIT_2, there would be a collision because there would be no way to distinguish the channel on the two units. By using our existingAdcConfigstructure which contains both the channel and the unit ids, we can resolve this collision. This required an update to the APIs (changing fromadc_channel_ttoAdcConfigas well as to the data storage used.Additionally, if the user wanted to manually start/stop the continuous adc hardware, they could not without constructing and destructing the ContinuousAdc objects. To make it easier and more useful to developers, this functionality has been broken out into
start()andstop()methods on theContinuousAdcobject. If the user tries to read information about an adc channel while it is stopped, the methods will returnstd::nullopt.How has this been tested?
adcexamplecontrollerexamplejoystickexamplethermistorexampleScreenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):
Types of changes
Checklist:
Software
.github/workflows/build.ymlfile to add my new test to the automated cloud build github action.