@web-font-path: "roboto-debian.css";
v2.2.0 (RP2040)
Loading...
Searching...
No Matches
stdio.h
Go to the documentation of this file.
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _PICO_STDIO_H
#define _PICO_STDIO_H
#include "pico.h"
// PICO_CONFIG: PICO_STDOUT_MUTEX, Enable/disable mutex around stdout, type=bool, default=1, group=pico_stdio
#ifndef PICO_STDOUT_MUTEX
#define PICO_STDOUT_MUTEX 1
#endif
// PICO_CONFIG: PICO_STDIO_ENABLE_CRLF_SUPPORT, Enable/disable CR/LF output conversion support, type=bool, default=1, group=pico_stdio
#ifndef PICO_STDIO_ENABLE_CRLF_SUPPORT
#define PICO_STDIO_ENABLE_CRLF_SUPPORT 1
#endif
// 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
#ifndef PICO_STDIO_DEFAULT_CRLF
#define PICO_STDIO_DEFAULT_CRLF 1
#endif
// 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
#ifndef PICO_STDIO_STACK_BUFFER_SIZE
#define PICO_STDIO_STACK_BUFFER_SIZE 128
#endif
// 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
#ifndef PICO_STDIO_DEADLOCK_TIMEOUT_MS
#define PICO_STDIO_DEADLOCK_TIMEOUT_MS 1000
#endif
// PICO_CONFIG: PICO_STDIO_SHORT_CIRCUIT_CLIB_FUNCS, Directly replace common stdio functions such as putchar from the C-library to avoid pulling in lots of c library code for simple output, type=bool, default=1, advanced=true, group=pico_stdio
#ifndef PICO_STDIO_SHORT_CIRCUIT_CLIB_FUNCS
#define PICO_STDIO_SHORT_CIRCUIT_CLIB_FUNCS 1
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
typedef struct stdio_driver stdio_driver_t;
bool stdio_init_all(void);
bool stdio_deinit_all(void);
void stdio_flush(void);
int stdio_getchar_timeout_us(uint32_t timeout_us);
static inline int getchar_timeout_us(uint32_t timeout_us) {
return stdio_getchar_timeout_us(timeout_us);
}
void stdio_set_driver_enabled(stdio_driver_t *driver, bool enabled);
void stdio_filter_driver(stdio_driver_t *driver);
void stdio_set_translate_crlf(stdio_driver_t *driver, bool translate);
int stdio_putchar_raw(int c);
static inline int putchar_raw(int c) {
return stdio_putchar_raw(c);
}
int stdio_puts_raw(const char *s);
static inline int puts_raw(const char *s) {
return stdio_puts_raw(s);
}
void stdio_set_chars_available_callback(void (*fn)(void*), void *param);
int stdio_get_until(char *buf, int len, absolute_time_t until);
int stdio_put_string(const char *s, int len, bool newline, bool cr_translation);
int stdio_getchar(void);
int stdio_putchar(int);
int stdio_puts(const char *s);
int stdio_vprintf(const char *format, va_list va);
int __printflike(1, 0) stdio_printf(const char* format, ...);
#ifdef __cplusplus
}
#endif
#endif
stdio_init_all
bool stdio_init_all(void)
Initialize all of the present standard stdio types that are linked into the binary.
Definition stdio.c:200
stdio_put_string
int stdio_put_string(const char *s, int len, bool newline, bool cr_translation)
Prints a buffer to stdout with optional newline and carriage return insertion.
Definition stdio.c:92
stdio_getchar_timeout_us
int stdio_getchar_timeout_us(uint32_t timeout_us)
Return a character from stdin if there is one available within a timeout.
Definition stdio.c:255
stdio_puts
int stdio_puts(const char *s)
Alias for puts that definitely does not go thru the implementation in the standard C library even whe...
Definition stdio.c:308
stdio_set_chars_available_callback
void stdio_set_chars_available_callback(void(*fn)(void *), void *param)
get notified when there are input characters available
Definition stdio.c:282
stdio_putchar
int stdio_putchar(int)
Alias for putchar that definitely does not go thru the implementation in the standard C library even ...
Definition stdio.c:302
getchar_timeout_us
static int getchar_timeout_us(uint32_t timeout_us)
Alias for stdio_getchar_timeout_us for backwards compatibility.
Definition stdio.h:97
stdio_get_until
int stdio_get_until(char *buf, int len, absolute_time_t until)
Waits until a timeout to read at least one character into a buffer.
Definition stdio.c:116
stdio_set_driver_enabled
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:151
stdio_putchar_raw
int stdio_putchar_raw(int c)
putchar variant that skips any CR/LF conversion if enabled
Definition stdio.c:138
stdio_flush
void stdio_flush(void)
Flushes any buffered output.
Definition stdio.c:168
puts_raw
static int puts_raw(const char *s)
Alias for stdio_puts_raw for backwards compatibility.
Definition stdio.h:150
stdio_vprintf
int stdio_vprintf(const char *format, va_list va)
Alias for vprintf that definitely does not go thru the implementation in the standard C library even ...
Definition stdio.c:317
stdio_set_translate_crlf
void stdio_set_translate_crlf(stdio_driver_t *driver, bool translate)
control conversion of line feeds to carriage return on transmissions
Definition stdio.c:267
stdio_getchar
int stdio_getchar(void)
Alias for getchar that definitely does not go thru the implementation in the standard C library even ...
Definition stdio.c:294
stdio_deinit_all
bool stdio_deinit_all(void)
Deinitialize all of the present standard stdio types that are linked into the binary.
Definition stdio.c:226
stdio_puts_raw
int stdio_puts_raw(const char *s)
puts variant that skips any CR/LF conversion if enabled
Definition stdio.c:144
stdio_filter_driver
void stdio_filter_driver(stdio_driver_t *driver)
Control limiting of output to a single driver.
Definition stdio.c:263
putchar_raw
static int putchar_raw(int c)
Alias for stdio_putchar_raw for backwards compatibility.
Definition stdio.h:138
__printflike
int __printflike(1, 0) stdio_printf(const char *format
Alias for printf that definitely does not go thru the implementation in the standard C library even w...
Definition stdio.c:368
absolute_time_t
uint64_t absolute_time_t
An opaque 64 bit timestamp in microseconds.
Definition types.h:43
pico.h
stdio_driver
Definition driver.h:12