Private
Public Access
2
0

api: Fixes for missing mraa methods.

This commit includes a set of small fixes flushed out from the google
unit tests.

    * Fixed missing implementations of mraa_get_*_count methods.
    * Fix for NULL string
    * Fix for MOCK platform C++ define.
    * Switched (void) -> () function definitions for consistency.

Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Noel Eck
2018-03-13 16:17:51 -07:00
parent 467cf5132d
commit fa40262d89
4 changed files with 15 additions and 11 deletions

View File

@@ -223,35 +223,35 @@ unsigned int mraa_get_pin_count();
*
* @return number of usable UARTs on the platform, returns -1 on failure.
*/
int mraa_get_uart_count(void);
int mraa_get_uart_count();
/**
* Get the number of usable SPI buses, board must be initialised.
*
* @return number of usable SPI buses on the platform, returns -1 on failure.
*/
int mraa_get_spi_bus_count(void);
int mraa_get_spi_bus_count();
/**
* Get the number of usable PWM pins, board must be initialised.
*
* @return number of PWMs on the current platform, -1 on failure.
*/
int mraa_get_pwm_count(void);
int mraa_get_pwm_count();
/**
* Get the number of usable GPIOs, board must be initialised.
*
* @return number of usable external GPIO pins on the board, -1 on failure.
*/
int mraa_get_gpio_count(void);
int mraa_get_gpio_count();
/**
* Get the number of usable analog pins, board must be initialised.
*
* @return number of usable ADC inputs on the platform and -1 on failure.
*/
int mraa_get_aio_bus_count(void);
int mraa_get_aio_count();
/**
* Get platform usable I2C bus count, board must be initialised.

View File

@@ -163,7 +163,10 @@ getPlatformName()
inline std::string
getPlatformVersion(int platform_offset=MRAA_MAIN_PLATFORM_OFFSET)
{
std::string ret_val(mraa_get_platform_version(platform_offset));
std::string ret_val;
const char* pv = mraa_get_platform_version(platform_offset);
if (pv != NULL)
ret_val = pv;
return ret_val;
}

View File

@@ -62,6 +62,7 @@ typedef enum {
GENERIC_FIRMATA = 1280, /**< Firmata uart platform/bridge */
ANDROID_PERIPHERALMANAGER = 95, /**< Android Things peripheral manager platform */
MOCK_PLATFORM = 96, /**< Mock platform, which requires no real hardware */
NULL_PLATFORM = 98,
UNKNOWN_PLATFORM = 99 /**< An unknown platform type, typically will load INTEL_GALILEO_GEN1 */
} Platform;