mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-22 04:54:47 +00:00
add consolePrintf for C style code
This commit is contained in:
parent
772f2a15ff
commit
58715f454c
@ -1,13 +1,21 @@
|
||||
#include "SerialConsole.h"
|
||||
#include "NodeDB.h"
|
||||
#include "PowerFSM.h"
|
||||
#include "configuration.h"
|
||||
#include "NodeDB.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#define Port Serial
|
||||
|
||||
SerialConsole console;
|
||||
|
||||
void consolePrintf(const char *format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
console.vprintf(format, arg);
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port)
|
||||
{
|
||||
canWrite = false; // We don't send packets to our port until it has talked to us first
|
||||
|
@ -32,4 +32,7 @@ class SerialConsole : public StreamAPI, public RedirectablePrint
|
||||
virtual void onConnectionChanged(bool connected);
|
||||
};
|
||||
|
||||
// A simple wrapper to allow non class aware code write to the console
|
||||
void consolePrintf(const char *format, ...);
|
||||
|
||||
extern SerialConsole console;
|
||||
|
Loading…
Reference in New Issue
Block a user