Private
Public Access
2
0

mraa: add a function that returns the number of uarts available

Signed-off-by: Tapani Utriainen <tapani@technexion.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Tapani Utriainen
2017-05-18 20:56:04 +08:00
committed by Brendan Le Foll
parent 04c5593cef
commit b7e8d96945
3 changed files with 28 additions and 0 deletions

View File

@@ -201,6 +201,13 @@ int mraa_get_platform_combined_type();
*/
unsigned int mraa_get_pin_count();
/**
* Get the number of usable UARTs, board must be initialised.
*
* @return number of usable UARTs on the platform, returns -1 on failure.
*/
int mraa_get_uart_count(void);
/**
* Get platform usable I2C bus count, board must be initialised.
*

View File

@@ -178,6 +178,18 @@ getPinCount()
return mraa_get_pin_count();
}
/**
* Get platform usable UART count, board must be initialised.
*
* @return number of usable UARTs on the current platform. Function will
* return -1 on failure
*/
inline int
getUartCount()
{
return mraa_get_uart_count();
}
/**
* Get platform usable I2C bus count, board must be initialised.
*

View File

@@ -750,6 +750,15 @@ mraa_get_platform_version(int platform_offset)
}
}
int
mraa_get_uart_count(void)
{
if (plat == NULL) {
return -1;
}
return plat->uart_dev_count;
}
int
mraa_get_i2c_bus_count()
{