11// copies of the Software, and to permit persons to whom the Software is
12// furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice shall be included in
15// all copies or substantial portions of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23// THE SOFTWARE.
24//
25// \brief Tiny printf, sprintf and snprintf implementation, optimized for speed on
26// embedded systems with a very limited resources.
27// Use this instead of bloated standard/newlib printf.
28// These routines are thread safe and reentrant.
29//
31
32#ifndef PICO_PRINTF_H_
33#define PICO_PRINTF_H_
34
41#ifdef __cplusplus
42extern"C" {
43#endif
44
45#include "pico.h"
46#include <stdio.h>
47#include <stdarg.h>
48
49// PICO_CONFIG: PICO_PRINTF_ALWAYS_INCLUDED, Whether to always include printf code even if only called weakly (by panic), type=bool, default=1 in debug build 0 otherwise, group=pico_printf
50#ifndef PICO_PRINTF_ALWAYS_INCLUDED
51#ifndef NDEBUG
52#define PICO_PRINTF_ALWAYS_INCLUDED 1
53#else
54#define PICO_PRINTF_ALWAYS_INCLUDED 0
55#endif
56#endif
57
58#if LIB_PICO_PRINTF_PICO
59// weak raw printf may be a puts if printf has not been called,
60// so that we can support gc of printf when it isn't called
61//
62// it is called raw to distinguish it from the regular printf which