Private
Public Access
2
0

Peripheralman: Remove IIO from ioinit for android

Since peripheral manager does not build in the IIO source, ifdef's were
added around the initio functionality for IIO.

IMO this is an ugly fix, but I don't see a better way since the
PERIPHERALMAN architecture is qualified throughout the CMake and source
with ifdef's.

Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Noel Eck
2018-07-20 11:18:38 -07:00
parent 4487c98b6f
commit 6fe510a27f
3 changed files with 26 additions and 2 deletions

View File

@@ -40,7 +40,11 @@ extern "C" {
#include "aio.h"
#include "gpio.h"
#include "i2c.h"
#if !defined(PERIPHERALMAN)
#include "iio.h"
#endif
#include "pwm.h"
#include "spi.h"
#include "uart.h"
@@ -53,8 +57,10 @@ typedef struct _mraa_io_descriptor {
mraa_gpio_context* gpios;
int n_i2c;
mraa_i2c_context* i2cs;
#if !defined(PERIPHERALMAN)
int n_iio;
mraa_iio_context* iios;
#endif
int n_pwm;
mraa_pwm_context* pwms;
int n_spi;

View File

@@ -32,7 +32,11 @@
#include "aio.hpp"
#include "gpio.hpp"
#include "i2c.hpp"
#if !defined(PERIPHERALMAN)
#include "iio.hpp"
#endif
#include "pwm.hpp"
#include "spi.hpp"
#include "uart.hpp"
@@ -67,10 +71,12 @@ class MraaIo
i2cs.emplace_back(descs->i2cs[i]);
}
#if !defined(PERIPHERALMAN)
iios.reserve(descs->n_iio);
for (int i = 0; i < descs->n_iio; ++i) {
iios.emplace_back(descs->iios[i]);
}
#endif
pwms.reserve(descs->n_pwm);
for (int i = 0; i < descs->n_pwm; ++i) {
@@ -116,9 +122,11 @@ class MraaIo
if (descs->n_i2c) {
free(descs->i2cs);
}
#if !defined(PERIPHERALMAN)
if (descs->n_iio) {
free(descs->iios);
}
#endif
if (descs->n_pwm) {
free(descs->pwms);
}
@@ -140,7 +148,9 @@ class MraaIo
std::vector<Aio> aios;
std::vector<Gpio> gpios;
std::vector<I2c> i2cs;
#if !defined(PERIPHERALMAN)
std::vector<Iio> iios;
#endif
std::vector<Pwm> pwms;
std::vector<Spi> spis;
std::vector<Uart> uarts;