Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 2 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
10 years, 2 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.