uart: add C++ Uart module and links to swig
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -30,3 +30,4 @@
|
||||
#include "mraa/gpio.hpp"
|
||||
#include "mraa/i2c.hpp"
|
||||
#include "mraa/spi.hpp"
|
||||
#include "mraa/uart.hpp"
|
||||
|
||||
57
api/mraa/uart.hpp
Normal file
57
api/mraa/uart.hpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "uart.h"
|
||||
|
||||
namespace mraa {
|
||||
|
||||
/**
|
||||
* @brief C++ API to UART (enabling only)
|
||||
*
|
||||
* This file defines the UART C++ interface for libmraa
|
||||
*/
|
||||
class Uart {
|
||||
public:
|
||||
/**
|
||||
* Uart Constructor, takes a pin number which will map directly to the
|
||||
* linux uart number, this 'enables' the uart, nothing more
|
||||
*
|
||||
* @param uart the index of the uart set to use
|
||||
*/
|
||||
Uart(int uart) {
|
||||
m_uart = mraa_uart_init(uart);
|
||||
}
|
||||
/**
|
||||
* Uart destructor
|
||||
*/
|
||||
~Uart() {
|
||||
return;
|
||||
}
|
||||
private:
|
||||
mraa_uart_context m_uart;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -23,6 +23,7 @@ functionality.
|
||||
| @ref aio.h "aio" | @ref mraa::Aio "Aio class" |
|
||||
| @ref pwm.h "pwm" | @ref mraa::Pwm "Pwm class" |
|
||||
| @ref spi.h "spi" | @ref mraa::Spi "Spi class" |
|
||||
| @ref uart.h "uart" | @ref mraa::Uart "Uart class" |
|
||||
| @ref common.h "common" | @ref mraa "common" |
|
||||
</center>
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ install (TARGETS mraa DESTINATION lib)
|
||||
|
||||
if (DOXYGEN_FOUND)
|
||||
set (CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND})
|
||||
set (DOCCLASSES aio gpio i2c pwm spi)
|
||||
set (DOCCLASSES aio gpio i2c pwm spi uart)
|
||||
# CPP class headers
|
||||
foreach (_file ${DOCCLASSES})
|
||||
add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}_class_doc.i
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
%include pwm_class_doc.i
|
||||
%include aio_class_doc.i
|
||||
%include spi_class_doc.i
|
||||
%include uart_class_doc.i
|
||||
#endif
|
||||
|
||||
%{
|
||||
@@ -17,6 +18,7 @@
|
||||
#include "i2c.hpp"
|
||||
#include "spi.hpp"
|
||||
#include "aio.hpp"
|
||||
#include "uart.hpp"
|
||||
%}
|
||||
|
||||
%init %{
|
||||
@@ -51,3 +53,7 @@
|
||||
#### AIO ####
|
||||
|
||||
%include "aio.hpp"
|
||||
|
||||
#### UART ####
|
||||
|
||||
%include "uart.hpp"
|
||||
|
||||
Reference in New Issue
Block a user