Linduino
1.3.0
Linear Technology Arduino-Compatible Demonstration Board
UserInterface.h
Go to the documentation of this file.
1
//! @todo Review this file.
2
/*
3
UserInterface.h
4
5
UserInterface routines are used to read and write user data through the Arduino's
6
serial interface.
7
8
Copyright 2018(c) Analog Devices, Inc.
9
10
All rights reserved.
11
12
Redistribution and use in source and binary forms, with or without
13
modification, are permitted provided that the following conditions are met:
14
- Redistributions of source code must retain the above copyright
15
notice, this list of conditions and the following disclaimer.
16
- Redistributions in binary form must reproduce the above copyright
17
notice, this list of conditions and the following disclaimer in
18
the documentation and/or other materials provided with the
19
distribution.
20
- Neither the name of Analog Devices, Inc. nor the names of its
21
contributors may be used to endorse or promote products derived
22
from this software without specific prior written permission.
23
- The use of this software may or may not infringe the patent rights
24
of one or more patent holders. This license does not release you
25
from the requirement that you obtain separate licenses from these
26
patent holders to use this software.
27
- Use of the software either in source or binary form, must be run
28
on or directly connected to an Analog Devices Inc. component.
29
30
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
31
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
32
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
33
IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
34
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35
LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
36
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
37
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
38
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40
*/
41
42
#ifndef USERINTERFACE_H
43
#define USERINTERFACE_H
44
45
#include <stdint.h>
46
47
#define UI_BUFFER_SIZE 64
48
#define SERIAL_TERMINATOR '\n'
49
50
// io buffer
51
extern
char
ui_buffer
[
UI_BUFFER_SIZE
];
52
53
// Read data from the serial interface into the ui_buffer buffer
54
uint8_t
read_data
();
55
56
// Read a float value from the serial interface
57
float
read_float
();
58
59
// Read an integer from the serial interface.
60
// The routine can recognize Hex, Decimal, Octal, or Binary
61
// Example:
62
// Hex: 0x11 (0x prefix)
63
// Decimal: 17
64
// Octal: O21 (leading letter O prefix)
65
// Binary: B10001 (leading letter B prefix)
66
int32_t
read_int
();
67
68
// Read a string from the serial interface. Returns a pointer to the ui_buffer.
69
char
*
read_string
();
70
71
// Read a character from the serial interface
72
int8_t
read_char
();
73
74
#endif // USERINTERFACE_H
read_string
char * read_string()
Definition:
UserInterface.cpp:109
read_int
int32_t read_int()
Definition:
UserInterface.cpp:93
read_data
uint8_t read_data()
Definition:
UserInterface.cpp:49
ui_buffer
char ui_buffer[UI_BUFFER_SIZE]
Definition:
UserInterface.cpp:46
read_float
float read_float()
Definition:
UserInterface.cpp:78
UI_BUFFER_SIZE
#define UI_BUFFER_SIZE
Definition:
UserInterface.h:47
read_char
int8_t read_char()
Definition:
UserInterface.cpp:116
LTSketchbook
libraries
UserInterface
UserInterface.h
Generated on Thu Mar 19 2020 10:59:37 for Linduino by
1.8.13