2016-06-10 10:15:13 UTC
I've implemented an AFEC driver for SAM34 by wrapping Atmel's ASF code. The idea
is to have common driver for all SAM chips supporting it. The implementation
needs more work, but the basic ADC example works.
Been working on this driver intermittently for a while now, but I realised it's
best to push it upstream in case someone else is interested in this development
and to have it taken in consideration in API changes (like the recent
adc_receive one). Also I would like some feedback on the direction taken.
My repo for this is here: https://github.com/orbifx/nuttx/tree/sam-afec (Note I
have purposely tracked the .config file until I'm done developing this). The
patch I'm attaching doesn't contain the .config of course.
A summary of the files affected per directory.
The architecture specific code for the sam34. I think Atmel's driver supports
other architectures like SAMV and SAMS. I've only tested on SAM4E16E. If others
have other chips please give it a try.
There are some experimental functions (sam_afec_channel_*) which are not being
used by default and I would like some feedback on. From what I realised, an ADC
driver with multiple channels is supposed to use the channel feature of the ADC
interface. But can that allow for someone to open one of the channels as a
stream via a file descriptor? As an experiment I made a separate set of
functions for registering a channel as a file. I've pulled back from this idea
till I consider it some more. Any thoughts?
The code required for the evaluation board I used for my development.
The generic SAM driver from Atmel's ASF. I've tried to avoid changing this as
much as I could. Any changes are limited to the top of any affected files so
that doing a diff against future releases by Atmel will be straightforward.
There is a small patch for the ADC example, but I'd rather if there wasn't. If
anyone has ideas on this please share them. They are two IOCTL calls necessary
for configuring the driver.