Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# vt100.c

Go to the documentation of this file.

    00001 /*! \file vt100.c \brief VT100 terminal function library. */
    00002 //*****************************************************************************
    00003 //
    00004 // File Name    : 'vt100.c'
    00005 // Title        : VT100 terminal function library
    00006 // Author       : Pascal Stang - Copyright (C) 2002
    00007 // Created      : 2002.08.27
    00008 // Revised      : 2002.08.27
    00009 // Version      : 0.1
    00010 // Target MCU   : Atmel AVR Series
    00011 // Editor Tabs  : 4
    00012 //
    00013 // NOTE: This code is currently below version 1.0, and therefore is considered
    00014 // to be lacking in some functionality or documentation, or may not be fully
    00015 // tested.  Nonetheless, you can expect most functions to work.
    00016 //
    00017 // This code is distributed under the GNU Public License
    00018 //      which can be found at http://www.gnu.org/licenses/gpl.txt
    00019 //
    00020 //*****************************************************************************
    00021
    00022 #include <avr/io.h>
    00023 #include <avr/interrupt.h>
    00024 #include <avr/pgmspace.h>
    00025
    00026 #include "global.h"
    00027 #include "rprintf.h"
    00028 #include "vt100.h"
    00029
    00030 // Program ROM constants
    00031
    00032 // Global variables
    00033
    00034 // Functions
    00035 void vt100Init(void)
    00036 {
    00037     // initializes terminal to "power-on" settings
    00038     // ESC c
    00039     rprintfProgStrM("\x1B\x63");
    00040 }
    00041
    00042 void vt100ClearScreen(void)
    00043 {
    00044     // ESC [ 2 J
    00045     rprintfProgStrM("\x1B[2J");
    00046 }
    00047
    00048 void vt100SetAttr(u08 attr)
    00049 {
    00050     // ESC [ Ps m
    00051     rprintf("\x1B[%dm",attr);
    00052 }
    00053
    00054 void vt100SetCursorMode(u08 visible)
    00055 {
    00056     if(visible)
    00057         // ESC [ ? 25 h
    00058         rprintf("\x1B[?25h");
    00059     else
    00060         // ESC [ ? 25 l
    00061         rprintf("\x1B[?25l");
    00062 }
    00063
    00064 void vt100SetCursorPos(u08 line, u08 col)
    00065 {
    00066     // ESC [ Pl ; Pc H
    00067     rprintf("\x1B[%d;%dH",line,col);
    00068 }
    00069