NXP Touch Cursor example for LPCXpresso54608, modified for use with Mbed OS.
The tutorial for this example can be found here: https://os.mbed.com/blog/entry/How-to-LPCXpresso54608-touch-panel/
utilities/stdio_thread.cpp@0:c107a6f8c368, 2018-04-11 (annotated)
- Committer:
- jplunkett
- Date:
- Wed Apr 11 20:46:55 2018 +0000
- Revision:
- 0:c107a6f8c368
Init
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jplunkett | 0:c107a6f8c368 | 1 | #include <stdarg.h> |
jplunkett | 0:c107a6f8c368 | 2 | #include <stdio.h> |
jplunkett | 0:c107a6f8c368 | 3 | #include "mbed.h" |
jplunkett | 0:c107a6f8c368 | 4 | |
jplunkett | 0:c107a6f8c368 | 5 | #include "stdio_thread.h" |
jplunkett | 0:c107a6f8c368 | 6 | |
jplunkett | 0:c107a6f8c368 | 7 | Mutex printf_mutex; |
jplunkett | 0:c107a6f8c368 | 8 | |
jplunkett | 0:c107a6f8c368 | 9 | int safe_printf(const char *format, ...) { |
jplunkett | 0:c107a6f8c368 | 10 | |
jplunkett | 0:c107a6f8c368 | 11 | printf_mutex.lock(); |
jplunkett | 0:c107a6f8c368 | 12 | |
jplunkett | 0:c107a6f8c368 | 13 | va_list args; |
jplunkett | 0:c107a6f8c368 | 14 | va_start(args, format); |
jplunkett | 0:c107a6f8c368 | 15 | int num_bytes = vprintf(format, args); |
jplunkett | 0:c107a6f8c368 | 16 | |
jplunkett | 0:c107a6f8c368 | 17 | va_end(args); |
jplunkett | 0:c107a6f8c368 | 18 | printf_mutex.unlock(); |
jplunkett | 0:c107a6f8c368 | 19 | |
jplunkett | 0:c107a6f8c368 | 20 | return num_bytes; |
jplunkett | 0:c107a6f8c368 | 21 | } |