[388] | 1 | /**
|
---|
| 2 | * @file vtsend.h
|
---|
| 3 | * @author CuBeatSystems
|
---|
| 4 | * @author Shinichiro Nakamura
|
---|
| 5 | * @copyright
|
---|
| 6 | * ===============================================================
|
---|
| 7 | * Natural Tiny Shell (NT-Shell) Version 0.3.1
|
---|
| 8 | * ===============================================================
|
---|
| 9 | * Copyright (c) 2010-2016 Shinichiro Nakamura
|
---|
| 10 | *
|
---|
| 11 | * Permission is hereby granted, free of charge, to any person
|
---|
| 12 | * obtaining a copy of this software and associated documentation
|
---|
| 13 | * files (the "Software"), to deal in the Software without
|
---|
| 14 | * restriction, including without limitation the rights to use,
|
---|
| 15 | * copy, modify, merge, publish, distribute, sublicense, and/or
|
---|
| 16 | * sell copies of the Software, and to permit persons to whom the
|
---|
| 17 | * Software is furnished to do so, subject to the following
|
---|
| 18 | * conditions:
|
---|
| 19 | *
|
---|
| 20 | * The above copyright notice and this permission notice shall be
|
---|
| 21 | * included in all copies or substantial portions of the Software.
|
---|
| 22 | *
|
---|
| 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
| 24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
| 25 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
| 26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
| 27 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
| 28 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
| 29 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
| 30 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
| 31 | */
|
---|
| 32 |
|
---|
| 33 | #ifndef VTSEND_H
|
---|
| 34 | #define VTSEND_H
|
---|
| 35 |
|
---|
| 36 | #define VTSEND_COLOR_BLACK (0)
|
---|
| 37 | #define VTSEND_COLOR_RED (1)
|
---|
| 38 | #define VTSEND_COLOR_GREEN (2)
|
---|
| 39 | #define VTSEND_COLOR_YELLOW (3)
|
---|
| 40 | #define VTSEND_COLOR_BLUE (4)
|
---|
| 41 | #define VTSEND_COLOR_MAGENTA (5)
|
---|
| 42 | #define VTSEND_COLOR_CYAN (6)
|
---|
| 43 | #define VTSEND_COLOR_WHITE (7)
|
---|
| 44 |
|
---|
| 45 | #define VTSEND_ATTR_OFF (0)
|
---|
| 46 | #define VTSEND_ATTR_BOLD_ON (1)
|
---|
| 47 | #define VTSEND_ATTR_UNDERSCORE (4)
|
---|
| 48 | #define VTSEND_ATTR_BLINK_ON (5)
|
---|
| 49 | #define VTSEND_ATTR_REVERSE (7)
|
---|
| 50 | #define VTSEND_ATTR_CONCEALED_ON (8)
|
---|
| 51 |
|
---|
| 52 | typedef int (*VTSEND_SERIAL_WRITE)(const char *buf, const int siz, void *extobj);
|
---|
| 53 |
|
---|
| 54 | typedef struct {
|
---|
| 55 | VTSEND_SERIAL_WRITE uart_write;
|
---|
| 56 | void *extobj;
|
---|
| 57 | } vtsend_t;
|
---|
| 58 |
|
---|
| 59 | #ifdef __cplusplus
|
---|
| 60 | extern "C" {
|
---|
| 61 | #endif
|
---|
| 62 |
|
---|
| 63 | int vtsend_init(vtsend_t *p, VTSEND_SERIAL_WRITE uart_write, void *extobj);
|
---|
| 64 | int vtsend_cursor_position(vtsend_t *p, const int column, const int line);
|
---|
| 65 | int vtsend_cursor_up(vtsend_t *p, const int n);
|
---|
| 66 | int vtsend_cursor_down(vtsend_t *p, const int n);
|
---|
| 67 | int vtsend_cursor_forward(vtsend_t *p, const int n);
|
---|
| 68 | int vtsend_cursor_backward(vtsend_t *p, const int n);
|
---|
| 69 | int vtsend_cursor_position_save(vtsend_t *p);
|
---|
| 70 | int vtsend_cursor_position_restore(vtsend_t *p);
|
---|
| 71 | int vtsend_erase_display(vtsend_t *p);
|
---|
| 72 | int vtsend_erase_line(vtsend_t *p);
|
---|
| 73 | int vtsend_set_color_foreground(vtsend_t *p, const int color);
|
---|
| 74 | int vtsend_set_color_background(vtsend_t *p, const int color);
|
---|
| 75 | int vtsend_set_attribute(vtsend_t *p, const int attr);
|
---|
| 76 | int vtsend_set_scroll_region(vtsend_t *p, const int top, const int bottom);
|
---|
| 77 | int vtsend_set_cursor(vtsend_t *p, const int visible);
|
---|
| 78 | int vtsend_reset(vtsend_t *p);
|
---|
| 79 |
|
---|
| 80 | int vtsend_draw_box(
|
---|
| 81 | vtsend_t *p,
|
---|
| 82 | const int x1, const int y1, const int x2, const int y2);
|
---|
| 83 | int vtsend_fill_box(
|
---|
| 84 | vtsend_t *p,
|
---|
| 85 | const int x1, const int y1, const int x2, const int y2);
|
---|
| 86 |
|
---|
| 87 | #ifdef __cplusplus
|
---|
| 88 | }
|
---|
| 89 | #endif
|
---|
| 90 |
|
---|
| 91 | #endif
|
---|
| 92 |
|
---|