PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
simpleterm_close.c
1 /*
2  * @file SimpleTerm_close.c
3  * SimpleTerm close is rarely used.
4  *
5  * Copyright (c) 2013, Parallax Inc.
6  * Written by Steve Denson
7  */
8 #include "serial.h"
9 
10 extern HUBDATA terminal *dport_ptr;
11 extern volatile int simpleterm_echo;
12 //extern volatile char simpleterm_ec[3];
13 //extern volatile char simpleterm_ecs[3];
14 extern volatile char simpleterm_ecA;
15 extern volatile char simpleterm_ecB;
16 extern volatile char simpleterm_ecsA;
17 extern volatile char simpleterm_ecsB;
18 
20 {
21  extern text_t *dport_ptr;
22  if(!dport_ptr)
23  return;
24  simpleterm_echo = terminal_checkEcho(dport_ptr);
25  //memcpy(simpleterm_ec, dport_ptr->ec, 3);
26  //memcpy(simpleterm_ecs, dport_ptr->ecs, 3);
27  simpleterm_ecA = dport_ptr->ecA;
28  simpleterm_ecB = dport_ptr->ecB;
29  simpleterm_ecsA = dport_ptr->ecsA;
30  simpleterm_ecsB = dport_ptr->ecsB;
31  serial_close(dport_ptr);
32  dport_ptr = 0;
33 }
34 
35 terminal *simpleterm_reopen(int rxpin, int txpin, int mode, int baud)
36 {
37  if(simpleterm_echo) mode |= ECHO_RX_TO_TX;
39  dport_ptr = serial_open(rxpin, txpin, mode, baud);
40  //memcpy(dport_ptr->ec, simpleterm_ec, 3);
41  //memcpy(dport_ptr->ecs, simpleterm_ecs, 3);
42  dport_ptr->ecA = simpleterm_ecA;
43  dport_ptr->ecB = simpleterm_ecB;
44  dport_ptr->ecsA = simpleterm_ecsA;
45  dport_ptr->ecsB = simpleterm_ecsB;
46  return dport_ptr;
47 }
48 
49 /*
50 +--------------------------------------------------------------------
51 | TERMS OF USE: MIT License
52 +--------------------------------------------------------------------
53 Permission is hereby granted, free of charge, to any person obtaining
54 a copy of this software and associated documentation files
55 (the "Software"), to deal in the Software without restriction,
56 including without limitation the rights to use, copy, modify, merge,
57 publish, distribute, sublicense, and/or sell copies of the Software,
58 and to permit persons to whom the Software is furnished to do so,
59 subject to the following conditions:
60 
61 The above copyright notice and this permission notice shall be
62 included in all copies or substantial portions of the Software.
63 
64 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
65 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
66 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
67 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
68 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
69 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
70 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
71 +--------------------------------------------------------------------
72 */
73 
simpleterm_reopen
terminal * simpleterm_reopen(int rxpin, int txpin, int mode, int baud)
Closes and the simple terminal connection, and reopens it in the calling cog. Depending on the parame...
Definition: simpleterm_close.c:35
serial.h
This library supports creating and managing one or more half duplex serial connections with periphera...
ECHO_RX_TO_TX
#define ECHO_RX_TO_TX
Definition: simpletext.h:64
serial_close
void serial_close(serial *device)
Close serial connection.
Definition: serial_close.c:11
simpleterm_close
void simpleterm_close(void)
Closes the SimpleIDE Terminal connection in one cog so that it can be opened in another cog with simp...
Definition: simpleterm_close.c:19
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
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