New method request

04 Nov 2010

Hello, I would like to request two new methods for the AnalogIn class. It would be nice to be able to perform asynchronous analog reads (since they take so long to acquire). I think the addition of a start() method and an attach() method would be a welcome Addition to the API. A call to start() would start the aquision and the attch() method would allow us to have some isr to execute when the aquision is complete :) Thanks!

04 Nov 2010

Check out alternative ADC implementation from Simon Blandford.

04 Nov 2010

Lol! Actually I already have simon's code loaded into my workspace, but have had no time to play. My main concern is that I want an official solution, so that if the underlying CPU changes the mbed library will hide any differences between the architectures... I have been burned too often with custom library solutions, that break sometime in the future :)

04 Nov 2010

Hi Matt,

It'd be great if you could have a play with the alternative ADC implementation, and see if you manage to successfully get the type of results/behaviour you want. If it does give you the advantages you are after, i'll certainly look at making it official!

And good to see you recognise the benefits of a stable API :) I hope these benefits will become even more apparent in the future...

Thanks,

Simon

04 Nov 2010

Hi Simon,

I have had a long look at Simon Blandford's ADC library and it does offer the functionality that I would like from the ADC hardware. But it is not an elegant fit for the the mbed API. I believe the power of mbed comes from it's attempt at an orthogonal design.

The mbed API treats each pin as an object with a set related methods which follow a common pattern, i.e. a method on the AnalogIn object is also found on the DigitalIn object (if it makes sense). Thus once one has been learned, the user already has a good idea how to use the other.

It would be nice to retrofit the extra ADC functionality to the existing AnalogIn class. If that is what you meant by making it "official", then yay! :)