PWM double edge, library extension & documentation

10 Sep 2009

Hi Simon,

While fiddling with the PWM module I started wondering about how to implement the double edge functionality properly. This feature is not supported by PwmOut, which I can understand, yet it would be nice to be able to add a custom module that does implement this. In fact, what it comes down to is that I would like to write my own modules that can be used the same way as the modules in the library, without rewriting all the stuff you allready implemented. Unfortunately documentation is lacking (at least I can't find it). I went through all the trunk header files and managed to reconstruct some bits, but nothing about this Base class for instance. Would it be possible to get some documentation about the basics of the library? What do I get if I my class inherits from Base? What is the overhead? And how exactly is the board initialised? All pins are inputs when main starts, I suppose? From register inspection I deduced that the PWM1 pclk is 15 MHz. These are important details that I feel should be documented somewhere.

I think the mbed library is pretty nice and allows for rapid prototyping in many cases, but allready for my simplest project I needed to dive deeper, because the library alone is not sufficient. This would not be a problem if f.i. the library sources were available for inspection, but without proper documentation I might almost as well roll my own.

So, any chances of getting more documentation?

Regards,

Clemens

10 Sep 2009

Hi Clemens,

Clemens Valens wrote:
Would it be possible to get some documentation about the basics of the library?

This is a very valid request, yes. I'd like to create documentation to include the library structure/concepts, and how to write your own.

If i'm honest, this won't start to happen within the next couple of weeks as we try and get this ready to go live. But i'm very much in favour of ensuring we can get to a point where you can pick and choose where you use pre-built functionality, and where you roll your own.

To start with, you are probably best rolling your own pwm by just poking registers to get the basic functionality working like you would on another platform - you can still use all the other mbed libraries at the same time, so it'd be just in this differentiating area. It can then be wrapped up to be more user friendly in time. A good place to be looking is http://mbed.org/projects/libraries/svn/mbed/trunk/LPC2368/LPC23xx.h and the manual (see http://mbed.org/nxp/lpc2368/technical-reference/).

If you can keep a list or post what information you find you need to know as you progress, and how you approach it (liek a log book), that will really help us understand the most appropriate way to present this documentation and guide people to extend the functionality.

Thanks,
Simon