libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::Logger< dest > Class Template Reference

Interface for simple USB logging. More...

Detailed Description

template<LoggerDestination dest = LOGGER_INTERNAL>
class daisy::Logger< dest >

Interface for simple USB logging.

Author
Alexander Petrov-Savchenko (axp@s.nosp@m.oft-.nosp@m.amp.c.nosp@m.om)
Date
November 2020

Simple Example:

#include "daisy_seed.h"
using namespace daisy;
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) {}
}
This is the higher-level interface for the Daisy board. All basic peripheral configuration/initiali...
Definition daisy_seed.h:19
Definition leddriver.h:33
void Init(I2CHandle i2c, const uint8_t(&addresses)[numDrivers], DmaBuffer dma_buffer_a, DmaBuffer dma_buffer_b, dsy_gpio_pin oe_pin={DSY_GPIOX, 0})
Definition leddriver.h:65
Hardware defines and helpers for daisy field platform.
Definition index.h:2

#include <logger.h>

Public Member Functions

 Logger ()
 

Static Public Member Functions

static void Print (const char *format,...)
 
static void PrintLine (const char *format,...)
 
static void StartLog (bool wait_for_pc=false)
 
static void PrintV (const char *format, va_list va)
 
static void PrintLineV (const char *format, va_list va)
 

Protected Types

enum  LoggerConsts { LOGGER_SYNC_OUT = 0 , LOGGER_SYNC_IN = 2 }
 

Static Protected Member Functions

static void TransmitSync (const void *buffer, size_t bytes)
 
static void TransmitBuf ()
 
static void AppendNewLine ()
 
static constexpr size_t NewLineSeqLength ()
 

Static Protected Attributes

static char tx_buff_ [128]
 
static size_t tx_ptr_ = 0
 
static size_t pc_sync_ = LOGGER_SYNC_OUT
 
static LoggerImpl< destimpl_
 

Member Enumeration Documentation

◆ LoggerConsts

template<LoggerDestination dest = LOGGER_INTERNAL>
enum daisy::Logger::LoggerConsts
protected

Internal constants

Enumerator
LOGGER_SYNC_OUT 
LOGGER_SYNC_IN 

successfully transmit this many packets before switching to blocking transfers

Constructor & Destructor Documentation

◆ Logger()

template<LoggerDestination dest = LOGGER_INTERNAL>
daisy::Logger< dest >::Logger ( )
inline

Object constructor

Member Function Documentation

◆ AppendNewLine()

template<LoggerDestination dest = LOGGER_INTERNAL>
static void daisy::Logger< dest >::AppendNewLine ( )
staticprotected

Trim control characters and append clean newline sequence, if there's room in the buffer

◆ NewLineSeqLength()

template<LoggerDestination dest = LOGGER_INTERNAL>
static constexpr size_t daisy::Logger< dest >::NewLineSeqLength ( )
inlinestaticconstexprprotected

Constexpr function equivalent of strlen(LOGGER_NEWLINE)

< custom newline character sequence

◆ Print()

template<LoggerDestination dest = LOGGER_INTERNAL>
static void daisy::Logger< dest >::Print ( const char format,
  ... 
)
static

Print formatted string

◆ PrintLine()

template<LoggerDestination dest = LOGGER_INTERNAL>
static void daisy::Logger< dest >::PrintLine ( const char format,
  ... 
)
static

Print formatted string appending line termination sequence

◆ PrintLineV()

template<LoggerDestination dest = LOGGER_INTERNAL>
static void daisy::Logger< dest >::PrintLineV ( const char format,
va_list  va 
)
static

Variadic argument variant of PrintLine()

◆ PrintV()

template<LoggerDestination dest = LOGGER_INTERNAL>
static void daisy::Logger< dest >::PrintV ( const char format,
va_list  va 
)
static

Variadic argument variant of Print()

◆ StartLog()

template<LoggerDestination dest = LOGGER_INTERNAL>
static void daisy::Logger< dest >::StartLog ( bool  wait_for_pc = false)
static

Start the logging session.

Parameters
wait_for_pcblock until remote terminal is ready

◆ TransmitBuf()

template<LoggerDestination dest = LOGGER_INTERNAL>
static void daisy::Logger< dest >::TransmitBuf ( )
staticprotected

Transfer accumulated data

◆ TransmitSync()

template<LoggerDestination dest = LOGGER_INTERNAL>
static void daisy::Logger< dest >::TransmitSync ( const void buffer,
size_t  bytes 
)
inlinestaticprotected

Blocking wrapper for Transmit()


The documentation for this class was generated from the following file: