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

Initial import of low-level ADC driver interface #616

Merged
merged 1 commit into from
Apr 10, 2014

Conversation

haukepetersen
Copy link
Contributor

Proposal of a low-level ADC driver interface.

Very simple ADC interface for single conversions that have to manually triggered. Most platforms are capable of many more fancy functions, but for simple usage this interface should suffice...

The mappings to pins and hardware conversion units is statically defined for each board in the 'periph_conf.h'.

The two helper functions are very useful, as most times ADC values are representing physical values that have completely different ranges, e.g. 10-bit ADC values from 0 to 1023 could be mapped to temperature values from -40.0°C to 120.0°C.

/**
* @brief Definition available ADC devices
*
* Each ADC device is base on a hardware ADC converter which can have one or more
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...based..., and ADC means "analog->digital converter", so the word "converter" is redundant

@haukepetersen
Copy link
Contributor Author

Dammit, that's what happens if you do turbo-commenting...

@OlegHahm OlegHahm added this to the Release NEXT MAJOR milestone Feb 5, 2014
*
* This file is subject to the terms and conditions of the LGPLv2 License.
* See the file LICENSE in the top level directory for more details.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Futile.

@OlegHahm
Copy link
Member

OlegHahm commented Feb 5, 2014

Maybe the API could also reflect the possiblity of reading the ADC using DMA? Or reading the ADC periodically?

@haukepetersen
Copy link
Contributor Author

Ok, as far as I looked through RIOTs code, almost all of the header files have a copyright notice in them, so we should try to be consitent - either way...

@OlegHahm
Copy link
Member

OlegHahm commented Feb 5, 2014

Well, ok then. It doesn't hurt. ;)

@haukepetersen
Copy link
Contributor Author

For the periodical/DMA applications - I left them out so far, as for (i) I wanted to keep the interface as slim as possible, for (ii) we don't have any hardcore ADC applications that depend on strict timings, and (iii) periodic and DMA based ADC runmodes do often need quite complex coupling of different MCU peripherals (alt least timer, ADC, maybe even synchronization with a center aligend PWM) and for this it is almost impossible to find a portable interface... But Im open to suggestions :-)

@OlegHahm
Copy link
Member

OlegHahm commented Feb 5, 2014

I have an example for (ii), but I agree that for these cases it's okay to extend the interface:
ACK

@haukepetersen
Copy link
Contributor Author

Added UNDEFINED device to adc_t and rebased. Can someone ack this?

@OlegHahm
Copy link
Member

OlegHahm commented Apr 1, 2014

ACK

@miri64
Copy link
Member

miri64 commented Apr 1, 2014

Please use direction tags in @param documentation

@haukepetersen
Copy link
Contributor Author

done

@OlegHahm
Copy link
Member

OlegHahm commented Apr 8, 2014

Squash and go.

@haukepetersen
Copy link
Contributor Author

sqashed and go.

haukepetersen added a commit that referenced this pull request Apr 10, 2014
Initial import of low-level ADC driver interface
@haukepetersen haukepetersen merged commit ef07dd1 into RIOT-OS:master Apr 10, 2014
@haukepetersen haukepetersen deleted the periph_driver_adc branch April 10, 2014 13:11
Fixed tons of spelling errors

Fixed typo in ADC_NUMOF macro

drivers: adjustment to low-level adc drvier IF

drivers: added [in|out] to doxygen @param comments
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.

4 participants