PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
simpleterm.c
1 /*
2  * @file SimpleTerm.c
3  * SimpleTerm startup default constructor
4  *
5  * Copyright (c) 2013, Parallax Inc.
6  * Written by Steve Denson
7  */
8 #include <propeller.h>
9 #include "simpletext.h"
10 
11 /*
12  * SimpleTerm uses global pointers for IO - it is the default debug module.
13  * Functions like putChar, putDec, putLine are default IO and use the globals.
14  * Removed confusing #ifdef. Startup delay moved from serial_open to here.
15  */
16 HUBDATA terminal *dport_ptr = 0;
17 volatile int simpleterm_echo;
18 //volatile char simpleterm_ec[3];
19 //volatile char simpleterm_ecs[3];
20 volatile char simpleterm_ecA;
21 volatile char simpleterm_ecB;
22 volatile char simpleterm_ecsA;
23 volatile char simpleterm_ecsB;
24 
25 __attribute__((constructor))
27 {
28  if(dport_ptr != 0)
29  return dport_ptr;
30 
31  //dport_ptr = serial_open(31,30,0,115200);
32  //dport_ptr = serial_open(31,30,ECHO_RX_TO_TX,115200);
33  dport_ptr = serial_open(31,30,0,115200);
34 
35  //memcpy(&dport_ptr->ec, "\r\n", 3);
36  dport_ptr->ecA = '\r';
37  dport_ptr->ecB = '\n';
38  //memcpy(&dport_ptr->ecs, "\r\0", 3);
39  dport_ptr->ecsA = '\r';
40  dport_ptr->ecsB = 0;
41 
42 
43 
45  return dport_ptr;
46 }
47 
52 {
53  return dport_ptr;
54 }
55 
56 /*
57 +--------------------------------------------------------------------
58 | TERMS OF USE: MIT License
59 +--------------------------------------------------------------------
60 Permission is hereby granted, free of charge, to any person obtaining
61 a copy of this software and associated documentation files
62 (the "Software"), to deal in the Software without restriction,
63 including without limitation the rights to use, copy, modify, merge,
64 publish, distribute, sublicense, and/or sell copies of the Software,
65 and to permit persons to whom the Software is furnished to do so,
66 subject to the following conditions:
67 
68 The above copyright notice and this permission notice shall be
69 included in all copies or substantial portions of the Software.
70 
71 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
72 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
73 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
74 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
75 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
76 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
77 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
78 +--------------------------------------------------------------------
79 */
80 
81 
simpleterm_pointer
terminal * simpleterm_pointer(void)
Get default device pointer to SimpleIDE Terminal.
Definition: simpleterm.c:51
CLKFREQ
#define CLKFREQ
Returns the current clock frequency.
Definition: propeller.h:46
simpletext.h
This library provides a collection of functions for communicating with text devices such as SimpleIDE...
HUBDATA
#define HUBDATA
HUBDATA tells compiler to put data into HUB RAM section. This is mostly useful in XMM modes where dat...
Definition: propeller.h:32
text_struct
Structure that contains data used by simple text device libraries.
Definition: simpletext.h:81
waitcnt
#define waitcnt(a)
Wait until system counter reaches a value.
Definition: propeller.h:176
CNT
#define CNT
The system clock count.
Definition: propeller1.h:151
simpleterm_open
terminal * simpleterm_open(void)
Reopens the SimpleIDE Terminal connection if it was closed previously. The SimpleIDE Terminal connect...
serial_open
serial * serial_open(int rxpin, int txpin, int mode, int baudrate)
Open a simple (half duplex) serial connection.
Definition: serial_open.c:14
text_struct::ecA
volatile char ecA
Definition: simpletext.h:97