Private
Public Access
2
0
Commit Graph

631 Commits

Author SHA1 Message Date
Thomas Ingleby
6c73a8adce setup_mux_mapped: use HIGH/LOW instead
Avoids on some platforms where when setting a mux will set it low when
it wouldn't be safe to.

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-22 17:40:16 +00:00
Thomas Ingleby
e76d85eade gpio: add behaviour for pin without direction
If a gpio doesnt have a direction, like some muxes do, try and set value
if HIGH or LOW was passed.

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-22 17:40:16 +00:00
Petrus J.v.Rensburg
d88da134af contributing.md: Fix typo
Signed-off-by: Petrus J.v.Rensburg <petrus.jvrensburg@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-22 10:52: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
94dd44a2d3 example/gpio.c: Remove extern to plat
Use exposed api functions to get board information.
Added version option for version and name

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-21 16:24:21 +00:00
Thomas Ingleby
fb54307939 raspberry_pi_b: add missing platform name
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-21 15:43:27 +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
Brendan Le Foll
456646ca53 blink_onboard.c: explain use of calamari lure in example
Closes #96.

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-20 23:50:43 +00:00
Brendan Le Foll
e23325d9dd docs: add debugging doc
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-20 23:25:39 +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
Brendan Le Foll
4e5991779a cov: add some explicit includes that where missing
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-20 17:15:13 +00:00
Brendan Le Foll
e3dba949b6 i2c.c: Fix resource leak when I2C_FUNCS ioctl fails
This isn't a true failure condition just assume we have no features and carry
on

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-20 17:15:13 +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
Thomas Ingleby
ed4c68eba1 uart: cleanup and bring inline with standard
Removed mraa_setup_uart from core mraa.c moved logic within init
function
Add more syslog output for easier debugging.

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2015-01-20 14:44:28 +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
66eb476620 building.md: fix clang/clang++ arg
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-17 10:22:36 +00:00
Brendan Le Foll
5daad72fe0 docs: add more information to builds & contributing
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-16 14:01:43 +00:00
Brendan Le Foll
50ca84b600 mraajs.i: add %include carrays.i to fix generation with SWIG 3.0.4
Fixes #97

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-16 13:45:04 +00:00
Brendan Le Foll
c3e43e5984 cmake: make licensing of cmake modules really clear
Cmake modules have varying licensing, to make the distinctions clearer all
original licenses have been included and TargetArch.cmake has been explicitly
marked as LGPL 2.1 as it is based off work comming from qtbase

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-14 22:29:18 +00:00
Brendan Le Foll
21962f4d87 internals.md: add more internals documentation
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-14 15:56:29 +00:00
Brendan Le Foll
26106a2fb4 building.md: add more building information
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2015-01-14 15:56:07 +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
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