daisy::Logger¶
Module: LIBDAISY / HUMAN_INTERFACE / LOGGING
Interface for simple USB logging. More...
#include <logger.h>
Protected Types¶
Name | |
---|---|
enum | LoggerConsts |
Public Functions¶
Name | |
---|---|
Logger() | |
void | Print(const char * format, ... ) |
void | PrintLine(const char * format, ... ) |
void | StartLog(bool wait_for_pc =false) |
void | PrintV(const char * format, va_list va) |
void | PrintLineV(const char * format, va_list va) |
Protected Functions¶
Name | |
---|---|
void | TransmitSync(const void * buffer, size_t bytes) |
void | TransmitBuf() |
void | AppendNewLine() |
constexpr size_t | NewLineSeqLength() |
Protected Attributes¶
Name | |
---|---|
char[128] | tx_buff_ |
size_t | tx_ptr_ |
size_t | pc_sync_ |
LoggerImpl< dest > | impl_ |
Detailed Description¶
Interface for simple USB logging.
Author: Alexander Petrov-Savchenko ([email protected])
Date: November 2020
Simple Example: ```cpp
include "daisy_seed.h"¶
using namespace daisy;
DaisySeed hw;
int main(void) { // Initialize the Daisy Seed hw.Init(); // Start the log, and wait for connection hw.StartLog(true); // Print "Hello World" to the Serial Monitor hw.PrintLine("Hello World!"); while(1) {} }
_Filename: SerialPrint.cpp_
## Protected Types Documentation
### enum LoggerConsts
| Enumerator | Value | Description |
| ---------- | ----- | ----------- |
| LOGGER_SYNC_OUT | 0| |
| LOGGER_SYNC_IN | 2| successfully transmit this many packets before switching to blocking transfers |
Internal constants
## Public Functions Documentation
### function Logger
```cpp
inline Logger()
Object constructor
function Print¶
Print formatted string
function PrintLine¶
Print formatted string appending line termination sequence
function StartLog¶
Parameters:
- wait_for_pc block until remote terminal is ready
Start the logging session.
function PrintV¶
Variadic argument variant of Print()
function PrintLineV¶
Variadic argument variant of PrintLine()
Protected Functions Documentation¶
function TransmitSync¶
Blocking wrapper for Transmit()
function TransmitBuf¶
Transfer accumulated data
function AppendNewLine¶
Trim control characters and append clean newline sequence, if there's room in the buffer
function NewLineSeqLength¶
Constexpr function equivalent of strlen(LOGGER_NEWLINE)
< custom newline character sequence
Protected Attributes Documentation¶
variable tx_buff_¶
member variables buffer for log data
this needs to remain in SRAM to support startup-time printouts
variable tx_ptr_¶
current position in the buffer
variable pc_sync_¶
terminal synchronization state
start with non-blocking transfers to support startup-time printouts
variable impl_¶
underlying trasnfer implementation
Updated on 2024-01-03 at 19:41:01 +0000