PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
putChar.c
1 /*
2  * @file putChar.c
3  * Function to print a char to the default terminal.
4  * If c is \n, append \r.
5  *
6  * Copyright (c) 2013, Parallax Inc.
7  * Written by Steve Denson
8  *
9  * Modified by Andy Lindsay to correct bug in terminal cursor control
10  * with 2, 14, and 15.
11  */
12 
13 /*
14 #include "simpletext.h"
15 
16 void putChar(char c)
17 {
18  extern text_t *dport_ptr;
19  if(c == '\n')
20  dport_ptr->txChar(dport_ptr, '\r');
21  dport_ptr->txChar(dport_ptr, c);
22 }
23 */
24 
25 //static char t1 = 0;
26 //static char t2 = 0;
27 
28 #include "simpletext.h"
29 
30 void putChar(char c)
31 {
32  extern text_t *dport_ptr;
33 
34  #ifdef ST_SLASH_ReturN
35  if(c == '\n')
36  dport_ptr->txChar(dport_ptr, '\r');
37  dport_ptr->txChar(dport_ptr, c);
38  #endif
39 
40 
41  #ifdef SIMPLETEXT_ECS
42  //
43  if((c != dport_ptr->ecA) && (c != dport_ptr->ecB))
44  {
45  dport_ptr->txChar(dport_ptr, c);
46  }
47  else
48  {
49  char tA = dport_ptr->ecsA;
50  char tB = dport_ptr->ecsB;
51  if(tA) dport_ptr->txChar(dport_ptr, tA);
52  if(tB) dport_ptr->txChar(dport_ptr, tB);
53  }
54  //
55  #endif
56 
57  #ifdef ST_NO_CHAR_SUBS
58  dport_ptr->txChar(dport_ptr, c);
59  #endif
60 }
61 
62 /*
63 +--------------------------------------------------------------------
64 | TERMS OF USE: MIT License
65 +--------------------------------------------------------------------
66 Permission is hereby granted, free of charge, to any person obtaining
67 a copy of this software and associated documentation files
68 (the "Software"), to deal in the Software without restriction,
69 including without limitation the rights to use, copy, modify, merge,
70 publish, distribute, sublicense, and/or sell copies of the Software,
71 and to permit persons to whom the Software is furnished to do so,
72 subject to the following conditions:
73 
74 The above copyright notice and this permission notice shall be
75 included in all copies or substantial portions of the Software.
76 
77 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
78 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
79 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
80 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
81 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
82 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
83 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
84 +--------------------------------------------------------------------
85 */
86 
text_struct::txChar
int(* txChar)(struct text_struct *p, int ch)
Definition: simpletext.h:86
simpletext.h
This library provides a collection of functions for communicating with text devices such as SimpleIDE...
putChar
void putChar(char c)
Print a char to the debug port.
Definition: putChar.c:30
text_struct
Structure that contains data used by simple text device libraries.
Definition: simpletext.h:81
text_struct::ecA
volatile char ecA
Definition: simpletext.h:97