12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- #include "sdk_common.h"
- #if NRF_MODULE_ENABLED(NRF_FPRINTF)
- #include <stdarg.h>
- #include "nrf_assert.h"
- #include "nrf_fprintf_format.h"
- void nrf_fprintf_buffer_flush(nrf_fprintf_ctx_t * const p_ctx)
- {
- ASSERT(p_ctx != NULL);
- if (p_ctx->io_buffer_cnt == 0)
- {
- return;
- }
- p_ctx->fwrite(p_ctx->p_user_ctx,
- p_ctx->p_io_buffer,
- p_ctx->io_buffer_cnt);
- p_ctx->io_buffer_cnt = 0;
- }
- void nrf_fprintf(nrf_fprintf_ctx_t * const p_ctx,
- char const * p_fmt,
- ...)
- {
- ASSERT(p_ctx != NULL);
- ASSERT(p_ctx->fwrite != NULL);
- ASSERT(p_ctx->p_io_buffer != NULL);
- ASSERT(p_ctx->io_buffer_size > 0);
- if (p_fmt == NULL)
- {
- return;
- }
- va_list args = {0};
- va_start(args, p_fmt);
- nrf_fprintf_fmt(p_ctx, p_fmt, &args);
- va_end(args);
- }
- #endif
|