PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
TextDevices
libsimpletext
getBin.c
1
/*
2
* @file getBin.c
3
* Function to get a binary number from the terminal.
4
*
5
* Copyright (c) 2013, Parallax Inc.
6
* Written by Steve Denson
7
*/
8
#include "
simpletext.h
"
9
10
int
getBin
(
void
)
11
{
12
extern
text_t
*dport_ptr;
13
return
readBin
(dport_ptr);
14
}
15
16
int
readBin
(
text_t
*text)
17
{
18
int
rc = 0;
19
char
buf[40];
20
char
*str = _safe_gets(text, buf, 39);
21
if
(*str)
22
_scanf_getl(str, &rc, 2, 32, 0);
/* not signed */
23
return
rc;
24
}
25
26
/*
27
+--------------------------------------------------------------------
28
| TERMS OF USE: MIT License
29
+--------------------------------------------------------------------
30
Permission is hereby granted, free of charge, to any person obtaining
31
a copy of this software and associated documentation files
32
(the "Software"), to deal in the Software without restriction,
33
including without limitation the rights to use, copy, modify, merge,
34
publish, distribute, sublicense, and/or sell copies of the Software,
35
and to permit persons to whom the Software is furnished to do so,
36
subject to the following conditions:
37
38
The above copyright notice and this permission notice shall be
39
included in all copies or substantial portions of the Software.
40
41
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
42
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
43
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
44
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
45
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
46
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
47
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48
+--------------------------------------------------------------------
49
*/
50
getBin
int getBin(void)
Get binary number from the debug port.
Definition:
getBin.c:10
simpletext.h
This library provides a collection of functions for communicating with text devices such as SimpleIDE...
text_struct
Structure that contains data used by simple text device libraries.
Definition:
simpletext.h:81
readBin
int readBin(text_t *device)
Get binary number from the device.
Definition:
getBin.c:16
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17