Skip to content

Commit e296a07

Browse files
committed
Modify-PutChar-for-Testing
Putchar modified to allow the use of CRSRXY, CRSRX, and CRSRY.
1 parent 745719b commit e296a07

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed
Binary file not shown.
Binary file not shown.

Learn/Simple Libraries/TextDevices/libsimpletext/putChar.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
*
66
* Copyright (c) 2013, Parallax Inc.
77
* Written by Steve Denson
8+
*
9+
* Modified by Andy Lindsay to correct bug in terminal cursor control
10+
* with 2, 14, and 15.
811
*/
12+
13+
/*
914
#include "simpletext.h"
1015
1116
void putChar(char c)
@@ -15,6 +20,33 @@ void putChar(char c)
1520
dport_ptr->txChar(dport_ptr, '\r');
1621
dport_ptr->txChar(dport_ptr, c);
1722
}
23+
*/
24+
25+
#include "simpletext.h"
26+
27+
volatile char st_cursorPosition = 0;
28+
29+
void putChar(char c)
30+
{
31+
extern text_t *dport_ptr;
32+
if((c == '\n') && (st_cursorPosition == 0))
33+
{
34+
dport_ptr->txChar(dport_ptr, '\r');
35+
}
36+
else
37+
{
38+
st_cursorPosition--;
39+
}
40+
dport_ptr->txChar(dport_ptr, c);
41+
42+
if(c == 2 || c == 14 || c == 15)
43+
{
44+
if(c > 2)
45+
st_cursorPosition = 1;
46+
else
47+
st_cursorPosition = 2;
48+
}
49+
}
1850

1951
/*
2052
+--------------------------------------------------------------------

Learn/Update Your Learn Folder.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ <h2 style="font-family:verdana;">Update History</h2>
5353
Update 8/27/2016
5454

5555
<ul>
56+
<li>
57+
Modify putChar to allow for use of CRSRXY, CRSRX, and CRSRY.
58+
</li>
59+
5660
<li>
5761
Add libcolormath to Simple Libraries Utility folder.
5862
</li>

0 commit comments

Comments
 (0)