NXP Touch Cursor example for LPCXpresso54608, modified for use with Mbed OS.

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stdio_thread.cpp Source File

stdio_thread.cpp

00001 #include <stdarg.h>
00002 #include <stdio.h>
00003 #include "mbed.h"
00004 
00005 #include "stdio_thread.h"
00006 
00007 Mutex printf_mutex;
00008 
00009 int safe_printf(const char *format, ...) {
00010 
00011     printf_mutex.lock();
00012 
00013     va_list args;
00014     va_start(args, format);
00015     int num_bytes = vprintf(format, args);
00016 
00017     va_end(args);
00018     printf_mutex.unlock();
00019 
00020     return num_bytes;
00021 }