Skip to content

UART Logger destination#700

Open
stephenhensley wants to merge 2 commits into
masterfrom
logger-uart-target
Open

UART Logger destination#700
stephenhensley wants to merge 2 commits into
masterfrom
logger-uart-target

Conversation

@stephenhensley

Copy link
Copy Markdown
Collaborator

Using UART to print/debug is pretty common, and it makes sense for it to integrate with the existing Logger API.

This can already be DIY'd fairly easily, but this improves the convenience of working with typical printf variadic syntax, and makes it easy to switch from USB to a UART pin without having to refactor application code much.

Because there are many UART pins, there is an additional configuration step required.

As an example:

using Log = daisy::Logger<daisy::LOGGER_UART>;
...
int main(void) {
  // Set the hardware details (this method is only available to the UART logger destination.
  Log::Configure({daisy::UartHandler::Config::Peripheral::UART_7,
                  daisy::sprout::Hardware::kPinStLinkUartTx, 115200});
  
  // Then you can use as usual:
  Log::StartLog(false);


  while(1) {
    Log::PrintLine("Time since boot: %d ms", daisy::System::GetNow());
    daisy::System::Delay(1000);
  }
}

I am looking into getting the wait_for_pc stuff to work as expected, but so far it seems like the transmissions are successful whether a device is present or not.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

Test Results

167 tests  ±0   167 ✅ ±0   0s ⏱️ ±0s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 7fa9025. ± Comparison against base commit 08f2965.

♻️ This comment has been updated with latest results.

…ed note in docs for wait_for_pc not working with UART destination.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant