mraa: add accessor functions to return counts of spi, pwm, gpio and adcs
Signed-off-by: Tapani Utriainen <tapani@technexion.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
b7e8d96945
commit
d6edf76680
@@ -208,6 +208,34 @@ unsigned int mraa_get_pin_count();
|
|||||||
*/
|
*/
|
||||||
int mraa_get_uart_count(void);
|
int mraa_get_uart_count(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get platform usable I2C bus count, board must be initialised.
|
* Get platform usable I2C bus count, board must be initialised.
|
||||||
*
|
*
|
||||||
|
|||||||
36
src/mraa.c
36
src/mraa.c
@@ -759,6 +759,42 @@ mraa_get_uart_count(void)
|
|||||||
return plat->uart_dev_count;
|
return plat->uart_dev_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
mraa_get_spi_count(void)
|
||||||
|
{
|
||||||
|
if (plat == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return plat->spi_bus_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
mraa_get_pwm_count(void)
|
||||||
|
{
|
||||||
|
if (plat == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return plat->pwm_dev_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
mraa_get_gpio_count(void)
|
||||||
|
{
|
||||||
|
if (plat == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return plat->gpio_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
mraa_get_aio_count(void)
|
||||||
|
{
|
||||||
|
if (plat == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return plat->aio_count;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
mraa_get_i2c_bus_count()
|
mraa_get_i2c_bus_count()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user