9 years, 11 months ago.

Finding API documentation

I've been looking into how to use a Serial device but to make the TX pin floating except while actually needing to transmit data. Looking through other peoples code and libraries I've seen mention of

serial_pinout_tx() pin_function()

as possible ways to achieve this. But searching the mbed site basically draws a blank on either of these functions or how to use them. Seeing as serial_pinout_tx() is declared in an mbed library (serial_api.h) where do I find its documentation? If you search for the function using the provide search mbed.org... facility "No results found." is returned. Google knows more!

TIA

1 Answer

9 years, 11 months ago.

Here is the source code for the LPC1768 serial (but from there you can also find the others): http://mbed.org/users/mbed_official/code/mbed-src/file/aeeefa19f7de/targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c. serial_pinout_tx seems a bit like legacy code to me, the init function already sets pinouts directly.

The easiest way coding wise to do it is by making it DigitalIn when not needed, but then you need to make it Serial again when you want to transmit, and it recalculates the baudrate, which is a bit of overkill. The function you probably need is pin_function. (defined here for LPC1768: http://mbed.org/users/mbed_official/code/mbed-src/file/aeeefa19f7de/targets/hal/TARGET_NXP/TARGET_LPC176X/pinmap.c). GPIO is function 0 (you need to make sure it is set to input (default) and probably no pull-up (not default). You can probably do that by first making a digitalin on the pin with the correct settings). UART pin functions is in the file I linked first, in the table the last column, so it depends on your pins.

Thanks very much for the pointers to these sources, it's a shame the search doesn't find them. You must know your way around the sources very well!

Thanks again.

posted by Peter Allnutt 19 May 2014

Best is to use google, with site:mbed.org, but also that is far from perfect. And yeah while you can find it, you need to know a bit the route to take it. The source code is called mbed-src, and my browser immediatly remembers it when I type it and takes me to it.

posted by Erik - 19 May 2014