Private
Public Access
2
0
Commit Graph

705 Commits

Author SHA1 Message Date
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
Philippe Coval
17ee0c9669 mraa.c: fix FTBFS on printf by adding format
gcc-4.8.2 fails to build from source and complains :

  error: format not a string literal and no format arguments

Signed-off-by: Philippe Coval <philippe.coval@open.eurogiciel.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-12 18:12:37 +00:00
Brendan Le Foll
219eeed5f8 x86.c: remove duplicate case statement
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2001-01-01 02:53:16 +00:00
Brendan Le Foll
c45e3c8c58 x86/intel_minnow_max.c: remove definitions duplication
Since gpios are +256 in 3.18+ kernels this stops dual definitions and possible
issues later on if errors are found

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2001-01-01 02:53:16 +00:00
Brendan Le Foll
5dc28d9800 x86/intel_minnow_max.c: add board gpio count
Whilst this value is not used because it's only required by the aio module it
is interesting to have this information if we want to expose it to the user

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2001-01-01 02:53:16 +00:00
John 'Warthog9' Hawley
d8bef92bbe x86/intel_minnow_max.c: Adjust gpio pins based on kernel version
This should adjust the pinouts, at runtime, based on the current
kernel that's in use.  The Linux kernel made a change between
3.17 and 3.18 ( specifically ea584595fc85e65796335033dfca25ed655cd0ed )
that changed the numbering for GPIOs.  This obviously breaks everything
for mraa on the MinnowBoard MAX if you have a 3.18 or newer kernel.

Signed-off-by: John 'Warthog9' Hawley <john.hawley@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2001-01-01 02:53:16 +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
Thomas Ingleby
a76061a981 x86/galileo_gen2: correct mistake on IO11 for SPI
Fixes #89

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-09 16:47:01 +00:00
Kurt Eckhardt
3efb7a03e1 intel_edison_fab_c.c: move gpio_close_pre to miniboard
The gpio_close_pre was put on the wrong board definition. So calling close of
GPIO pin on mini-board caused a fault

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-06 17:49:51 +00:00
Brendan Le Foll
ec5c09fe37 I2c-compass.cpp: fix incorrect usage of write/writeByte
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-06 11:37:07 +00:00
Brendan Le Foll
461015a22f bmp85.js: add i2c read/write example
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-06 11:24:56 +00:00
Brendan Le Foll
f14654a120 mraajs.i: add i2c read/write function typemaps
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-06 11:24:56 +00:00
Brendan Le Foll
23fca714e1 bmp85.py: add simple example of new i2c read func
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-06 11:24:55 +00:00
Brendan Le Foll
31b16735e9 python-mraa.i: Add typemaps to make I2c::{read,write} natural
Typemaps now make uint8_t *data, int length map to a bytearray

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-06 11:24:55 +00:00
Brendan Le Foll
9bcd652c21 mraa.i: remove std::string conversion
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-06 11:24:54 +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
d6bbd0bf38 mraa.c: fix missing break statement in case switch
Missing in mraa_pin_mode_test causes an erroneous syslog message. Fixes #86

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-05 23:04:50 +00:00
Kurt Eckhardt
41956b07d6 pwm.c: cache period
There is an issue that  mraa_pwm_write would fail, because mraa_pwm_read
would fail and return 0.  When the read fails, journalctl shows an
error:
Dec 28 18:01:38 Edison libmraa[365]: pwm: Error in reading period

So now trying version, where the pwm object caches the period, that is
updated whenever you do a read or write of the period.  Side benefit is
that the write should be sped up.

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-05 15:24:28 +00:00
Brendan Le Foll
3eb0a8dbf7 i2c: use I2C_FUNCS to store funcs map
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-05 14:49:48 +00:00
Brendan Le Foll
a65a906e9e i2c: fix brackets around if statement
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-05 14:38:50 +00:00
Brendan Le Foll
cc9a4f59b5 edison: add mraa_i2c_frequency replace hook for i2c-6
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-05 14:38:50 +00:00
Brendan Le Foll
ab3af9cc2d i2c: add busnum to context
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-05 14:38:49 +00:00
Brendan Le Foll
836d953cb7 i2c: remove hz from context
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-05 14:38:48 +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
87e242a07b helloedison.c: add edison type example
This small example shows the use of mraa_get_pin and documents the owner
concept

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-05 14:35:56 +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
Kurt Eckhardt
bc05ce7078 x86/galileo-gen2: Speed up mraa_gpio_dir
Made like changes to Edison to cache the output enable.

Note: different than Edison as the pin structure holds enable pin number
instead of external array.

2nd note: noticed PU resistors are also in structure but there is also
external array.

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-19 14:40:02 +00:00
Kurt Eckhardt
455ab6f063 x86/edison: Speed up mraa_gpio_dir
Reasonable speed up in the mraa_gpio_dir on the Edison Arduino board

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-19 14:40:02 +00:00
Kurt Eckhardt
21d88d15eb gpio.c: add advance_func->gpio_close_pre
Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-19 14:40:01 +00:00
Brendan Le Foll
e7649db96d contributing.md: fix styling issues
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-18 22:39:34 +00:00
Brendan Le Foll
2574efdb1d mraa.c: mraa_pin_mode_test should check against b->gpio_count -1
It's already the case for rpi & MMAX but it should be noted that on 1 indexed
boards gpio_count should be +1

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-18 14:28:36 +00:00
Brendan Le Foll
1ee5e25f85 mraa.c: add syslog msg in case we get an unknown pinmode
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-18 14:13:04 +00:00
Brendan Le Foll
a769f78e83 mraa.c: fix uart mraa_pin_mode_test
switch statement was missing a clause for MRAA_PIN_UART meaning it always
returned False

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-18 14:11:27 +00:00
Brendan Le Foll
d58adefa3c mraa.c: fix aio mraa_pin_mode_test
test was adding board gpio_count to pin so that 0 would use the info for pin 14
on some boards when asking for aio capability

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-18 14:07:59 +00:00
Alex Tereschenko
3c4742c6e4 mraa.c: Fixed potential segfault on free()-ing NULL in mraa_deinit()
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-16 21:22:59 +00:00
Brendan Le Foll
e5835fa0da mraa.c: remove DEBUG define
debug DEFINE crept in from 6bc2b0fb53

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-16 20:38:06 +00:00
Alex Tereschenko
083db5bd27 mraa.c: added user check into mraa_init() & increase verbosity
mraa_init() will now:
- print user name and EUID of the process instead of UID,
- print full platform text name in addition to numeric type,
- return, log and print an error if started by non-root user

Fixes #64

Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-16 20:33:30 +00:00
Brendan Le Foll
4d8b82eedb gpio.c: styling, avoid bracketless if statements
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-15 16:23:18 +00:00
Brendan Le Foll
875c48cd04 contributing.md: Add developer certificate of origin stuff
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-15 16:23:18 +00:00
Brendan Le Foll
71118af233 mraa.c: do not check return value of mraa_gpio_dir when used on muxes
Doing so breaks galileo gen2 (gpio2) and others. Failing early is rather
pointless in any case so we may as well attempt the write, muxes do not
neccesarily have directions that work

Fixes #68

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-15 11:50:54 +00:00
Thomas Ingleby
f7256f1d5b x86/galileo-gen2: correct SPI MOSI mux info
Fixes #67

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2014-12-12 20:41:00 +00:00
Thomas Ingleby
f6a05b128d x86/edison: only toggle tristate on physical pins
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2014-12-12 12:25:29 +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
Brendan Le Foll
4944f42d9a intel_edison_fab_c.c: ignore failed tristate writes when doing direction set
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-11 10:50:57 +00:00
Brendan Le Foll
643bb99892 mraa.c: fix error handling & leak in mraa_setup_mux_mapped
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-10 15:38:14 +00:00
Brendan Le Foll
da15fdb6da binding.gyp.cmake: fix architecture name for 32bit x86
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-10 14:52:23 +00:00
Brendan Le Foll
0c086d8540 mraa.i: remove comments breaking builds with SWIG 3.0.3
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2014-12-10 11:06:13 +00:00