forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathserial.h
55 lines (43 loc) · 1.7 KB
/
serial.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
//
// SPDX-License-Identifier: MIT
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "py/mpconfig.h"
#include "py/mpprint.h"
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
#include "py/misc.h"
extern vstr_t *boot_output;
#endif
void serial_early_init(void);
void serial_init(void);
void serial_write(const char *text);
// Only writes up to given length. Does not check for null termination at all.
uint32_t serial_write_substring(const char *text, uint32_t length);
char serial_read(void);
uint32_t serial_bytes_available(void);
bool serial_connected(void);
// Used for temporarily suppressing output to the console or display.
bool serial_console_write_disable(bool disabled);
bool serial_display_write_disable(bool disabled);
// These have no-op versions that are weak and the port can override. They work
// in tandem with the cross-port mechanics like USB and BLE.
void port_serial_early_init(void);
void port_serial_init(void);
bool port_serial_connected(void);
char port_serial_read(void);
uint32_t port_serial_bytes_available(void);
void port_serial_write_substring(const char *text, uint32_t length);
void board_serial_early_init(void);
void board_serial_init(void);
bool board_serial_connected(void);
char board_serial_read(void);
uint32_t board_serial_bytes_available(void);
void board_serial_write_substring(const char *text, uint32_t length);
extern const mp_print_t console_uart_print;
int console_uart_printf(const char *fmt, ...);
void print_hexdump(const mp_print_t *printer, const char *prefix, const uint8_t *buf, size_t len);