Skip to content
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

NuttX: update PWM and ADC blocks with recently added NuttX functionalities #21

Merged
merged 2 commits into from Jul 28, 2021

Conversation

michallenc
Copy link
Contributor

Patch NuttX: update ADC block to get the number of configured channels adds the usage of ioctl command ANIOC_GET_NCHANNELS that return the number of configured ADC channels so it does not have to be set by the user. It also changes the way read data are assigned to outputs so the block can now support reading from less channels that is configured in NuttX (for example reading just from channels 3 and 4 when channels 1 - 5 are configured).

Patch NuttX: update PWM block with additional -1 last channel number adds channel number -1 as the last element of used channels which indicates that no other channels are configured and NuttX driver can skip them.

This commit updates the ADC block to get the number of configured channels
directly from the driver by using ioctl command ANIOC_GET_NCHANNELS. This
replace the current state when the number of configured channels had to be
defined in the code by the user. Assigning the values read by ADC to the
block outputs is also change so the number of channels read by the block
does not have to be equal to the number of configured channels. This
allows the block to be more flexible for different configurations.

This commit also change the name of the files from nuttx_Adc to nuttx_ADC
as is the standard for the other blocks.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This change takes an advantage of NuttX PWM drivers prematurely leaving
configuration loops when number of the channel is -1. This number indicates
that all upcoming channels are not used so the driver does not need to
setup them.

The -1 value can be added only if number of used channel is less than the
number of configured channels, otherwise there would be a buffer overflow.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
@robertobucher robertobucher merged commit 7ff1b94 into robertobucher:master Jul 28, 2021
@michallenc michallenc deleted the adc_multichan branch August 6, 2021 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants