PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
TextDevices
libsimpletext
serial_close.c
1
/*
2
* @file SimpleSerial_close.c
3
*
4
* Copyright (c) 2013, Parallax Inc.
5
* Written by Steve Denson
6
*/
7
#include <propeller.h>
8
#include <stdlib.h>
9
#include "
serial.h
"
10
11
void
serial_close
(
serial
*device)
12
{
13
if
(!device)
14
return
;
15
Serial_t
*sp = (
Serial_t
*) device->
devst
;
16
OUTA
&= ~(1 << sp->
tx_pin
);
17
DIRA
&= ~(1 << sp->
tx_pin
);
18
DIRA
&= ~(1 << sp->
rx_pin
);
19
free((
void
*)device->
devst
);
20
free(device);
21
device = 0;
22
}
23
24
/*
25
+--------------------------------------------------------------------
26
| TERMS OF USE: MIT License
27
+--------------------------------------------------------------------
28
Permission is hereby granted, free of charge, to any person obtaining
29
a copy of this software and associated documentation files
30
(the "Software"), to deal in the Software without restriction,
31
including without limitation the rights to use, copy, modify, merge,
32
publish, distribute, sublicense, and/or sell copies of the Software,
33
and to permit persons to whom the Software is furnished to do so,
34
subject to the following conditions:
35
36
The above copyright notice and this permission notice shall be
37
included in all copies or substantial portions of the Software.
38
39
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
40
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
41
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
43
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
44
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
45
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46
+--------------------------------------------------------------------
47
*/
OUTA
#define OUTA
Use to set output pin states when corresponding DIRA bits are 1.
Definition:
propeller1.h:157
serial_info::tx_pin
int tx_pin
Definition:
serial.h:58
text_struct::devst
volatile void * devst
Definition:
simpletext.h:90
serial.h
This library supports creating and managing one or more half duplex serial connections with periphera...
serial_info
Defines serial interface structure of 9 contiguous int variables.
Definition:
serial.h:55
serial_close
void serial_close(serial *device)
Close serial connection.
Definition:
serial_close.c:11
serial_info::rx_pin
int rx_pin
Definition:
serial.h:57
text_struct
Structure that contains data used by simple text device libraries.
Definition:
simpletext.h:81
DIRA
#define DIRA
Use to set pins to input (0) or output (1).
Definition:
propeller1.h:161
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17