mraa: add mraa_get_platform_name
getPlatformName for c++/swig API Closes #35 Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "common.h"
|
||||
#include "intel_de3815.h"
|
||||
|
||||
#define PLATFORM_NAME "Intel DE3815"
|
||||
#define MAX_SIZE 64
|
||||
#define SYSFS_CLASS_GPIO "/sys/class/gpio"
|
||||
|
||||
@@ -38,6 +39,10 @@ mraa_intel_de3815()
|
||||
if (b == NULL)
|
||||
return NULL;
|
||||
|
||||
b->platform_name_length = strlen(PLATFORM_NAME) + 1;
|
||||
b->platform_name = (char*) malloc(sizeof(char) * b->platform_name_length);
|
||||
strncpy(b->platform_name, PLATFORM_NAME, b->platform_name_length);
|
||||
|
||||
b->phy_pin_count = 18;
|
||||
//b->gpio_count = 14;
|
||||
b->aio_count = 0;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "common.h"
|
||||
#include "intel_edison_fab_c.h"
|
||||
|
||||
#define PLATFORM_NAME "Intel Edison"
|
||||
#define SYSFS_CLASS_GPIO "/sys/class/gpio"
|
||||
#define SYSFS_PINMODE_PATH "/sys/kernel/debug/gpio_debug/gpio"
|
||||
#define MAX_SIZE 64
|
||||
@@ -972,6 +973,10 @@ mraa_intel_edison_fab_c()
|
||||
if (b == NULL)
|
||||
return NULL;
|
||||
|
||||
b->platform_name_length = strlen(PLATFORM_NAME) + 1;
|
||||
b->platform_name = (char*) malloc(sizeof(char) * b->platform_name_length);
|
||||
strncpy(b->platform_name, PLATFORM_NAME, b->platform_name_length);
|
||||
|
||||
// This seciton will also check if the arduino board is there
|
||||
tristate = mraa_gpio_init_raw(214);
|
||||
if (tristate == NULL) {
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "intel_galileo_rev_d.h"
|
||||
|
||||
#define UIO_PATH "/dev/uio0"
|
||||
#define PLATFORM_NAME "Intel Galileo Gen 1"
|
||||
|
||||
static uint8_t *mmap_reg = NULL;
|
||||
static int mmap_fd = 0;
|
||||
@@ -123,6 +124,10 @@ mraa_intel_galileo_rev_d()
|
||||
if (b == NULL)
|
||||
return NULL;
|
||||
|
||||
b->platform_name_length = strlen(PLATFORM_NAME) + 1;
|
||||
b->platform_name = (char*) malloc(sizeof(char) * b->platform_name_length);
|
||||
strncpy(b->platform_name, PLATFORM_NAME, b->platform_name_length);
|
||||
|
||||
b->phy_pin_count = 20;
|
||||
b->gpio_count = 14;
|
||||
b->aio_count = 6;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#define MAX_SIZE 64
|
||||
#define SYSFS_CLASS_GPIO "/sys/class/gpio"
|
||||
#define PLATFORM_NAME "Intel Galileo Gen 2"
|
||||
|
||||
#define UIO_PATH "/dev/uio0"
|
||||
|
||||
@@ -275,6 +276,10 @@ mraa_intel_galileo_gen2()
|
||||
if (b == NULL)
|
||||
return NULL;
|
||||
|
||||
b->platform_name_length = strlen(PLATFORM_NAME) + 1;
|
||||
b->platform_name = (char*) malloc(sizeof(char) * b->platform_name_length);
|
||||
strncpy(b->platform_name, PLATFORM_NAME, b->platform_name_length);
|
||||
|
||||
b->phy_pin_count = 20;
|
||||
b->gpio_count = 14;
|
||||
b->aio_count = 6;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "common.h"
|
||||
#include "intel_minnow_max.h"
|
||||
|
||||
#define PLATFORM_NAME "MinnowBoard MAX"
|
||||
#define I2C_BUS_COUNT 10
|
||||
#define I2C_BUS_DEFAULT 7
|
||||
|
||||
@@ -76,6 +77,10 @@ mraa_intel_minnow_max()
|
||||
if (b == NULL)
|
||||
return NULL;
|
||||
|
||||
b->platform_name_length = strlen(PLATFORM_NAME) + 1;
|
||||
b->platform_name = (char*) malloc(sizeof(char) * b->platform_name_length);
|
||||
strncpy(b->platform_name, PLATFORM_NAME, b->platform_name_length);
|
||||
|
||||
b->phy_pin_count = MRAA_INTEL_MINNOW_MAX_PINCOUNT;
|
||||
//b->gpio_count = 14;
|
||||
b->aio_count = 0;
|
||||
|
||||
@@ -332,3 +332,11 @@ mraa_setup_uart(int index)
|
||||
|
||||
return MRAA_SUCCESS;
|
||||
}
|
||||
|
||||
char*
|
||||
mraa_get_platform_name()
|
||||
{
|
||||
if (plat == NULL)
|
||||
return "Unknown";
|
||||
return plat->platform_name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user