stdio.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _PICO_STDIO_H
8#define _PICO_STDIO_H
9
17#include "pico.h"
18
19// PICO_CONFIG: PICO_STDOUT_MUTEX, Enable/disable mutex around stdout, type=bool, default=1, group=pico_stdio
20#ifndef PICO_STDOUT_MUTEX
21#define PICO_STDOUT_MUTEX 1
22#endif
23
24// PICO_CONFIG: PICO_STDIO_ENABLE_CRLF_SUPPORT, Enable/disable CR/LF output conversion support, type=bool, default=1, group=pico_stdio
25#ifndef PICO_STDIO_ENABLE_CRLF_SUPPORT
26#define PICO_STDIO_ENABLE_CRLF_SUPPORT 1
27#endif
28
29// PICO_CONFIG: PICO_STDIO_DEFAULT_CRLF, Default for CR/LF conversion enabled on all stdio outputs, type=bool, default=1, depends=PICO_STDIO_ENABLE_CRLF_SUPPORT, group=pico_stdio
30#ifndef PICO_STDIO_DEFAULT_CRLF
31#define PICO_STDIO_DEFAULT_CRLF 1
32#endif
33
34// PICO_CONFIG: PICO_STDIO_STACK_BUFFER_SIZE, Define printf buffer size (on stack)... this is just a working buffer not a max output size, min=0, max=512, default=128, group=pico_stdio
35#ifndef PICO_STDIO_STACK_BUFFER_SIZE
36#define PICO_STDIO_STACK_BUFFER_SIZE 128
37#endif
38
39// PICO_CONFIG: PICO_STDIO_DEADLOCK_TIMEOUT_MS, Time after which to assume stdio_usb is deadlocked by use in IRQ and give up, type=int, default=1000, group=pico_stdio
40#ifndef PICO_STDIO_DEADLOCK_TIMEOUT_MS
41#define PICO_STDIO_DEADLOCK_TIMEOUT_MS 1000
42#endif
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48
49typedef struct stdio_driver stdio_driver_t;
50
63bool stdio_init_all(void);
64
68void stdio_flush(void);
69
76int getchar_timeout_us(uint32_t timeout_us);
77
85void stdio_set_driver_enabled(stdio_driver_t *driver, bool enabled);
86
96
105void stdio_set_translate_crlf(stdio_driver_t *driver, bool translate);
106
110int putchar_raw(int c);
111
115int puts_raw(const char *s);
116
123void stdio_set_chars_available_callback(void (*fn)(void*), void *param);
124
125#ifdef __cplusplus
126}
127#endif
128
129#endif
bool stdio_init_all(void)
Initialize all of the present standard stdio types that are linked into the binary.
Definition: stdio.c:283
void stdio_set_chars_available_callback(void(*fn)(void *), void *param)
get notified when there are input characters available
Definition: stdio.c:339
int puts_raw(const char *s)
puts variant that skips any CR/LF conversion if enabled
Definition: stdio.c:158
void stdio_set_driver_enabled(stdio_driver_t *driver, bool enabled)
Adds or removes a driver from the list of active drivers used for input/output.
Definition: stdio.c:200
void stdio_flush(void)
Flushes any buffered output.
Definition: stdio.c:217
int putchar_raw(int c)
putchar variant that skips any CR/LF conversion if enabled
Definition: stdio.c:152
int getchar_timeout_us(uint32_t timeout_us)
Return a character from stdin if there is one available within a timeout.
Definition: stdio.c:312
void stdio_set_translate_crlf(stdio_driver_t *driver, bool translate)
control conversion of line feeds to carriage return on transmissions
Definition: stdio.c:324
void stdio_filter_driver(stdio_driver_t *driver)
Control limiting of output to a single driver.
Definition: stdio.c:320
Definition: driver.h:12