serial_c_iface.cpp File Reference
#include "serial_c_iface.h"
Description
Wraps the Arduino Serial object and provides a simple printf implementation for C.
- Copyright
- Copyright 2017 The University of British Columbia, IonDB Project Contributors (see AUTHORS.md)
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- 1.Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2.Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- 3.Neither the name of the copyright holder nor the names of its contributors
- may be used to endorse or promote products derived from this software without specific prior written permission.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file serial_c_iface.cpp.
Include dependency graph for serial_c_iface.cpp:
Functions | |
int | serial_printf_c (const char *format,...) |
A version of printf that limits the number of characters printed per call. More... | |
int | serial_print (const char *buffer) |
A print function wrapping Arduino's serial stream. More... | |
void | serial_init (int baud_rate) |
Initializes serial port 0 for communications. More... | |
void | serial_close () |
Closes the communication port so that the pins can be used as general I/O. More... | |
Function Documentation
void serial_close | ( | ) |
Closes the communication port so that the pins can be used as general I/O.
Definition at line 83 of file serial_c_iface.cpp.
void serial_init | ( | int | baud_rate | ) |
Initializes serial port 0 for communications.
By default the port is set up at N-8-1.
- Parameters
-
baud_rate The buad rate to be used.
Definition at line 76 of file serial_c_iface.cpp.
int serial_print | ( | const char * | buffer | ) |
A print function wrapping Arduino's serial stream.
- Parameters
-
buffer Pointer to the character array / buffer to print.
- Returns
- The number of characters outputted.
Definition at line 63 of file serial_c_iface.cpp.
Here is the caller graph for this function:
int serial_printf_c | ( | const char * | format, |
... | |||
) |
A version of printf that limits the number of characters printed per call.
When additional characters are requested for printing, the print fails.
- Parameters
-
format The string that contains the text to be written to serial. ... Variable arguments of data used by the format.
- Returns
- The number of characters written. Returns a negative value on failure.
Definition at line 41 of file serial_c_iface.cpp.
int serial_print(const char *buffer)
A print function wrapping Arduino's serial stream.
Definition: serial_c_iface.cpp:63
Here is the call graph for this function: