mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-22 13:04:53 +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 "SerialConsole.h"
|
||||||
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "NodeDB.h"
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#define Port Serial
|
#define Port Serial
|
||||||
|
|
||||||
SerialConsole console;
|
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)
|
SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port)
|
||||||
{
|
{
|
||||||
canWrite = false; // We don't send packets to our port until it has talked to us first
|
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);
|
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;
|
extern SerialConsole console;
|
||||||
|
Loading…
Reference in New Issue
Block a user