Private
Public Access
2
0
Commit Graph

182 Commits

Author SHA1 Message Date
Brendan Le Foll
ffcf3d7d07 clang-format: run clang-format on C/C++ code
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-03-23 15:15:48 +00:00
Brendan Le Foll
824618ccf1 mraajs: update for node.js 0.12 API differences
This requires setting #define SWIG_V8_VERSION 0x032873 in the
mraajsJAVASCRIPT_wrap.cxx file. Note most v8 APIs now require v8::Isolate and
v8::Persistent is no longer a v8::Handle so the gpio.hpp for ISR support is
also modified by this change

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-03-19 18:26:05 +00:00
Brendan Le Foll
e03eec3ce1 common: fix documentation string on mraa_init
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-03-19 09:30:25 +00:00
Michael Ring
827e1974bf api/mraa: add mraa_get_pin_name
Add mraa_get_pin_name to get the real world name of the pin.

Signed-off-by: Michael Ring <mail@michael-ring.org>
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-03-19 00:16:32 +00:00
Gabriel Smith
0dd03950e4 i2c.hpp: Remove tab
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-03-03 16:31:47 +00:00
Gabriel Smith
caf1383325 i2c: Add functions for bulk read from register
Functions issue a write command for the register to read from and then a read
command without a stop signal in between

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-03-03 16:26:57 +00:00
Brendan Le Foll
f854a2b410 spi: return int instead of uint8_t in mraa_spi_write
This stops the error code getting lost since -1 wraps around to 0xFF when cast
to a uint8_t. This fixes #146

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-03-03 16:20:30 +00:00
Brendan Le Foll
3b3b940000 spi.h: fix docstring style
Function doc should not start on comment start line since every other header
doesn't do it

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-02-27 16:54:23 +00:00
Brendan Le Foll
a747c80f63 spi: styling & docstring fix
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-02-27 16:17:04 +00:00
Brendan Le Foll
efdbf4b0a8 common: add C++ init() call and explain reason to call again
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-02-25 15:44:06 +00:00
Brendan Le Foll
d6891e8bd7 isr.js: add node.js isr example
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-02-18 16:41:31 +00:00
Brendan Le Foll
008184c305 nodejs: Add isr support to node.js
This commit adds isr support to node.js mraa module, it also forces
SWIGJAVASCRIPT to be set at compile time by cmake (SWIG uses SWIGJAVASCRIPT and
not SWIGNODE in it's preprocessor). This uses libuv uv_queue_work to call v8isr
and is all done at a C++ level unlike the python isr, so this reuses the
mraa_gpio_isr call. This closes #110

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-02-18 16:41:01 +00:00
Michael Ring
921e27ac22 spi.hpp: Fix indentation of comment
Signed-off-by: Michael Ring <mail@michael-ring.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-02-17 15:39:54 +00:00
Michael Ring
55ac2e8996 spi: Add 16bit wide convenience functions for spi
Signed-off-by: Michael Ring <mail@michael-ring.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-02-17 15:39:54 +00:00
Michael Ring
f9ae045697 api/mraa/types.h renamed enum for raspberry to make it more global
Signed-off-by: Michael Ring <mail@michael-ring.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-02-15 22:39:56 +00:00
Brendan Le Foll
fca0efa254 pwm.hpp: fix pin/chipid order in raw init
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-02-09 16:40:09 +00:00
Alex Tereschenko
cd6701d604 aio.c: added normalized read returning a float in a 0.0-1.0 range
Closes #32.

Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-02-04 18:22:20 +00:00
Thomas Ingleby
212be299fd api: remove internal strut from public API
Moved for internal use only

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-21 16:33:00 +00:00
Thomas Ingleby
e8bc227a92 api/platform_name: Change return when null platform
Easier to error check against

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-21 15:39:29 +00:00
Thomas Ingleby
53a9a7dce4 internal/platform_name: move to const char*
Instead of plain char* to avoid need to malloc and do all the needed
error checking needed that goes along with that.

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-21 15:35:54 +00:00
Thomas Ingleby
067487f9ec mraa/platform: add mraa_get_pin_count()
Will return physical pin count.
Closes #75

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-21 15:17:34 +00:00
Thomas Ingleby
c3980c217c gpio: add function to get raw gpio number.
Will return the GPIO number used within SYSFS
Closes #63

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-20 18:33:12 +00:00
Thomas Ingleby
25bd897ec5 uart: use const char* instead of plain char*
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-20 17:14:12 +00:00
Thomas Ingleby
9cfbc87924 uart: add function mraa_uart_get_dev_path
Used for getting the path to the character device under linux for uart
device. i.e. "/dev/ttyS0"

Adds paths to existing platforms.
Closes #84

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-20 16:08:49 +00:00
Kurt Eckhardt
20d229168b gpio: mraa_gpio_dir allow output to set val
There is an issue that when you take an IO pin that has an external PU
resistor and switch it from INPUT to OUTPUT the state of the pin will go
down before you can set it back high.

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-20 10:43:16 +00:00
Brendan Le Foll
5af11978ca spi: add mraa_spi_init_raw
This lets you access a spidev device directly without any checking in the style
of mraa_i2c_init_raw

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-14 11:52:36 +00:00
Brendan Le Foll
16fc50bc31 spi.hpp: styling/identation fix
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-14 11:52:15 +00:00
Brendan Le Foll
c28eea88f7 i2c.hpp: fix doxygen comment for return of read()
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-14 11:52:13 +00:00
Brendan Le Foll
f51afc1fbc pwm.hpp: Pwm constructor optional arg order change
This means that you can initialise a non raw Pwm pin without having to redefine
chipid as -1 (anything but -1 enables raw mode for Pwm)

Fixes #93.

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-14 11:52:13 +00:00
Brendan Le Foll
b7a0856f51 spi: Make Spi write() work from SWIG with typemaps
This change also changes the C++ API write(char) call to writeByte(uint8_t) and
the write() call now takes a uint8_t* instead of a char*. This should not alter
any code significantly and does not affect the C API.

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-14 11:52:12 +00:00
Thomas Ingleby
62c3264b2c api/spi: Add Spi_Modes to CPP headers.
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-09 17:14:50 +00:00
Brendan Le Foll
c45388b602 i2c.hpp: Change I2c class API to ressemble C API
I2c class now uses more C like constructs for added efficiency when using C++
and no longer returns a binary string when doing read() calls. This change also
removes the use of std::string in the SWIG API for read/write which never
worked very well. This also renames single write/read calls to {write,read}Byte
as whilst overloading works in C++ well it's a little confusing and only works
because {write,read}() calls have 2 arguments which will not be the case in the
SWIG API where those calls take a single argument (bytearray or node::Buffer),
especially in js where functions have no explicit args this does not work well.

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-06 11:24:53 +00:00
Brendan Le Foll
fc5d37d391 i2c: set_frequency now takes a mraa_i2c_mode_t
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-05 14:38:48 +00:00
Brendan Le Foll
6651d49b6a types.h: add edison numbering enums
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-05 12:23:34 +00:00
yoneken
74d172cb6c gpio: Add a function to get a pin number from mraa_gpio_context
Signed-off-by: Kenta Yonekura <yoneken@ieee.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-21 17:43:31 +00:00
Thomas Ingleby
f277e7d35a doc/spi: correct description of SPI
SPI is not System Package Interface

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2014-12-11 15:23:25 +00:00
Thomas Ingleby
ea38d8c397 raspberry pi: add model b definition
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2014-12-08 15:41:16 +00:00
Brendan Le Foll
8f1c542d5d common.h: move functions from types.h
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-02 23:19:54 +00:00
Brendan Le Foll
261f04f94d types.h: Move mraa_pinmodes_t to types.h
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-02 23:18:20 +00:00
Thomas Ingleby
d1185efc0a mraa: add mraa_get_platform_name
getPlatformName for c++/swig API
Closes #35

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2014-11-26 15:17:28 +00:00
Brendan Le Foll
d99bfa45a3 i2c.h: fix typo in doxygen comment
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-11-24 08:04:08 +00:00
Henry Bruce
6bc2b0fb53 intel_minnow_max: Added platform definition
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-11-20 15:08:31 +00:00
Brendan Le Foll
75be9992fd i2c: fix I2c::read() call
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-11-20 14:10:56 +00:00
Brendan Le Foll
19d7dad364 i2c: remove smbus helper library & clean up command use in API
This commit changes the mraa_i2c_read() API call behaviour, a register should
now always be set when using this call. The smbus helper library is no longer
required since the code is now all contained from i2c.c which avoids multiple
function calls

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-11-20 12:03:31 +00:00
Brendan Le Foll
e9de25d797 spi.hpp: remove transfer command from SWIG APIs
Transfer command works with a uint8_t buffer that is written into, this does
not work in SWIG APIs and will cause a copy in either case, so the API call is
not useful. Remove to stop confusion.

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-11-20 12:03:31 +00:00
Brendan Le Foll
7dc29aa3b7 common.hpp: add missing docstring param for setLogLevel
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-11-20 12:03:31 +00:00
Brendan Le Foll
ac1c60d4fe i2c: add clean {write, read}data functions
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-11-20 12:03:31 +00:00
Brendan Le Foll
1133b32b5a i2c.hpp: reorder & style header
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-11-20 12:03:31 +00:00
Brendan Le Foll
274d5b2d50 i2c: use uint8_t when appropriate and remove char
Object APIs used signed chars for some operations which are not appropriate
when using i2c.

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-11-05 11:25:38 +00:00
Anton Krasovsky
cbf4c7447f i2c: add api call to read byte from a specified register
Signed-off-by: Anton Krasovsky <anton@no-mad.net>
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2014-10-31 01:17:17 +00:00