Hi Martin,
I got lwadc working under MQX 4.0.1 for the K20 - I would not consider the effort required to do this as "trivial". It took me an honest three days with the need to reload MQX twice.
The files that need to be copied from the K21 bsp to another Kinetis bsp are:
init_lwadc.c (this will also have to be modified after being copied over)
lwadc_kadc_prv.h
lwadc_kadc.c
lwadc_kadc.h (this will also have to be modified after being copied over)
lwadc_k20.c (this will also have to be modified after being copied over)
lwadc.h
And the following bsp files will have to be modified:
user_config.h
twrk20d72m.h (for the Tower System that I am working with)
bsp_prv.h
bsp.h
init_bsp.h
adc_mk20,h
.cproject
.project
Normally, I would publish the steps I used to get to this point, but there is a good chance that somebody following them will trash the bsp and have to reload it. I'm not sure how to document the steps so that somebody would have a good chance at success, especially for different devices/boards (I have only done it for the TWRK20D72M).
Despite the work, the lwadc does work very well and handles multiple channels as well as ADCs quite well. The only comment that I would make that if you are reading channels across multiple ADCs you should put in a few ms delay between reads (this actually isn't a problem for my application) - if you are reading different channels in the same ADC, then you won't have any problems.
Any comments, or is there a utility for adding a driver like this easily that I'm not aware of? Are there any plans to include lwadc for Kinetis in future versions of MQX?
Thanx,
myke