-
Notifications
You must be signed in to change notification settings - Fork 23
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
zephyrCommon: Implement analogRead()/analogReference() #54
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds a big chunk of code to overlay files, hence for adding further variants it maybe useful to have documentation for what all is needed to get analog working in these overlays.
Do you think you can also add documentation for the same?
@@ -0,0 +1,4 @@ | |||
CONFIG_GPIO=y | |||
CONFIG_ADC=y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all this can be shifted into the project's global KConfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it.
samples/analog_input/README.rst
Outdated
:goals: build flash | ||
:compact: | ||
|
||
Change ``arduino_nano_33_ble`` appropriately for other supported boards. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This README needs updating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot it.😱
Update README did.
The 'io-channels' node under the 'zephyr,user' defines available ADC channels. The 'io-channel-pins' defines the mapping of ADC channels to pin numbers. API looks up the 'io-channel-pins' when querying the ADC channel by digital pin number. So it should be in the same order as 'io-channels' node. For original Arduino API compatibility, adc resolution should configure as 10-bit. ADC that is on MCU supported by Zephyr exists only 16-bit resolution currently. So it supports resolutions up to 16-bit. Signed-off-by: TOKITA Hiroshi <[email protected]>
Add a sample to demonstrate how to use analogRead API Signed-off-by: TOKITA Hiroshi <[email protected]>
@DhruvaG2000 |
Code looks good, but let me test this patch on real hardware before approving and merging. |
Okay, No need to hurry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Built and tested on my arduino nano 33 ble sense, and it works OK.
The 'io-channels' node under the 'zephyr,user' defines
available ADC channels.
The 'io-channel-pins' defines the mapping of ADC channels
to pin numbers. API looks up the 'io-channel-pins' when
querying the ADC channel by digital pin number.
So it should be in the same order as 'io-channels' node.
For original Arduino API compatibility, ADC resolution
should configure as 10-bit.
ADC that is on MCU supported by Zephyr exists
only 16-bit resolution currently.
So it supports resolutions up to 16-bit.
Signed-off-by: TOKITA Hiroshi [email protected]