libmraa: Fix compilation warnings about unsigned ints
Make better use of unsigned/signed ints, signed ints are preffered unless there is a good reason not to. Signed-off-by: Alexandru Timohi <alexandru.timohi@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
022b36355f
commit
828338a69a
@@ -159,7 +159,7 @@ const char* mraa_get_platform_version(int platform_offset);
|
|||||||
* @param priority Value from typically 0 to 99
|
* @param priority Value from typically 0 to 99
|
||||||
* @return The priority value set
|
* @return The priority value set
|
||||||
*/
|
*/
|
||||||
int mraa_set_priority(const unsigned int priority);
|
int mraa_set_priority(const int priority);
|
||||||
|
|
||||||
/** Get the version string of mraa autogenerated from git tag
|
/** Get the version string of mraa autogenerated from git tag
|
||||||
*
|
*
|
||||||
@@ -214,7 +214,7 @@ int mraa_get_i2c_bus_count();
|
|||||||
* @param i2c_bus the logical I2C bus number
|
* @param i2c_bus the logical I2C bus number
|
||||||
* @return I2C adapter number in sysfs. Function will return -1 on failure
|
* @return I2C adapter number in sysfs. Function will return -1 on failure
|
||||||
*/
|
*/
|
||||||
int mraa_get_i2c_bus_id(unsigned int i2c_bus);
|
int mraa_get_i2c_bus_id(int i2c_bus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get specified platform pincount, board must be initialised.
|
* Get specified platform pincount, board must be initialised.
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ getVersion()
|
|||||||
* @return The priority value set
|
* @return The priority value set
|
||||||
*/
|
*/
|
||||||
inline int
|
inline int
|
||||||
setPriority(const unsigned int priority)
|
setPriority(const int priority)
|
||||||
{
|
{
|
||||||
return mraa_set_priority(priority);
|
return mraa_set_priority(priority);
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ getI2cBusCount()
|
|||||||
* @return I2C adapter number in sysfs. Function will return -1 on failure
|
* @return I2C adapter number in sysfs. Function will return -1 on failure
|
||||||
*/
|
*/
|
||||||
inline int
|
inline int
|
||||||
getI2cBusId(unsigned int i2c_bus)
|
getI2cBusId(int i2c_bus)
|
||||||
{
|
{
|
||||||
return mraa_get_i2c_bus_id(i2c_bus);
|
return mraa_get_i2c_bus_id(i2c_bus);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,9 +253,9 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/*@{*/
|
/*@{*/
|
||||||
unsigned int bus_id; /**< ID as exposed in the system */
|
int bus_id; /**< ID as exposed in the system */
|
||||||
unsigned int scl; /**< i2c SCL */
|
int scl; /**< i2c SCL */
|
||||||
unsigned int sda; /**< i2c SDA */
|
int sda; /**< i2c SDA */
|
||||||
// mraa_drv_api_t drv_type; /**< Driver type */
|
// mraa_drv_api_t drv_type; /**< Driver type */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
} mraa_i2c_bus_t;
|
} mraa_i2c_bus_t;
|
||||||
@@ -268,10 +268,10 @@ typedef struct {
|
|||||||
unsigned int bus_id; /**< The Bus ID as exposed to the system. */
|
unsigned int bus_id; /**< The Bus ID as exposed to the system. */
|
||||||
unsigned int slave_s; /**< Slave select */
|
unsigned int slave_s; /**< Slave select */
|
||||||
mraa_boolean_t three_wire; /**< Is the bus only a three wire system */
|
mraa_boolean_t three_wire; /**< Is the bus only a three wire system */
|
||||||
unsigned int sclk; /**< Serial Clock */
|
int sclk; /**< Serial Clock */
|
||||||
unsigned int mosi; /**< Master Out, Slave In. */
|
int mosi; /**< Master Out, Slave In. */
|
||||||
unsigned int miso; /**< Master In, Slave Out. */
|
int miso; /**< Master In, Slave Out. */
|
||||||
unsigned int cs; /**< Chip Select, used when the board is a spi slave */
|
int cs; /**< Chip Select, used when the board is a spi slave */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
} mraa_spi_bus_t;
|
} mraa_spi_bus_t;
|
||||||
|
|
||||||
@@ -293,19 +293,19 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct _board_t {
|
typedef struct _board_t {
|
||||||
/*@{*/
|
/*@{*/
|
||||||
unsigned int phy_pin_count; /**< The Total IO pins on board */
|
int phy_pin_count; /**< The Total IO pins on board */
|
||||||
unsigned int gpio_count; /**< GPIO Count */
|
unsigned int gpio_count; /**< GPIO Count */
|
||||||
unsigned int aio_count; /**< Analog side Count */
|
unsigned int aio_count; /**< Analog side Count */
|
||||||
unsigned int i2c_bus_count; /**< Usable i2c Count */
|
int i2c_bus_count; /**< Usable i2c Count */
|
||||||
mraa_i2c_bus_t i2c_bus[12]; /**< Array of i2c */
|
mraa_i2c_bus_t i2c_bus[12]; /**< Array of i2c */
|
||||||
unsigned int def_i2c_bus; /**< Position in array of default i2c bus */
|
unsigned int def_i2c_bus; /**< Position in array of default i2c bus */
|
||||||
unsigned int spi_bus_count; /**< Usable spi Count */
|
int spi_bus_count; /**< Usable spi Count */
|
||||||
mraa_spi_bus_t spi_bus[12]; /**< Array of spi */
|
mraa_spi_bus_t spi_bus[12]; /**< Array of spi */
|
||||||
unsigned int def_spi_bus; /**< Position in array of defult spi bus */
|
unsigned int def_spi_bus; /**< Position in array of defult spi bus */
|
||||||
unsigned int adc_raw; /**< ADC raw bit value */
|
unsigned int adc_raw; /**< ADC raw bit value */
|
||||||
unsigned int adc_supported; /**< ADC supported bit value */
|
unsigned int adc_supported; /**< ADC supported bit value */
|
||||||
unsigned int def_uart_dev; /**< Position in array of defult uart */
|
unsigned int def_uart_dev; /**< Position in array of defult uart */
|
||||||
unsigned int uart_dev_count; /**< Usable spi Count */
|
int uart_dev_count; /**< Usable spi Count */
|
||||||
mraa_uart_dev_t uart_dev[6]; /**< Array of UARTs */
|
mraa_uart_dev_t uart_dev[6]; /**< Array of UARTs */
|
||||||
mraa_boolean_t no_bus_mux; /**< i2c/spi/adc/pwm/uart bus muxing setup not required */
|
mraa_boolean_t no_bus_mux; /**< i2c/spi/adc/pwm/uart bus muxing setup not required */
|
||||||
int pwm_default_period; /**< The default PWM period is US */
|
int pwm_default_period; /**< The default PWM period is US */
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ mraa_iio_write_string(mraa_iio_context dev, const char* attr_name, const char* d
|
|||||||
snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/%s", dev->num, attr_name);
|
snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/%s", dev->num, attr_name);
|
||||||
int fd = open(buf, O_WRONLY);
|
int fd = open(buf, O_WRONLY);
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
size_t len = strlen(data);
|
int len = strlen(data);
|
||||||
ssize_t status = write(fd, data, len);
|
ssize_t status = write(fd, data, len);
|
||||||
if (status == len)
|
if (status == len)
|
||||||
result = MRAA_SUCCESS;
|
result = MRAA_SUCCESS;
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ mraa_deinit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
mraa_set_priority(const unsigned int priority)
|
mraa_set_priority(const int priority)
|
||||||
{
|
{
|
||||||
struct sched_param sched_s;
|
struct sched_param sched_s;
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ mraa_iio_detect()
|
|||||||
mraa_result_t
|
mraa_result_t
|
||||||
mraa_setup_mux_mapped(mraa_pin_t meta)
|
mraa_setup_mux_mapped(mraa_pin_t meta)
|
||||||
{
|
{
|
||||||
int mi;
|
unsigned int mi;
|
||||||
mraa_result_t ret;
|
mraa_result_t ret;
|
||||||
mraa_gpio_context mux_i = NULL;
|
mraa_gpio_context mux_i = NULL;
|
||||||
int last_pin = -1;
|
int last_pin = -1;
|
||||||
@@ -675,7 +675,7 @@ mraa_get_i2c_bus_count()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
mraa_get_i2c_bus_id(unsigned i2c_bus)
|
mraa_get_i2c_bus_id(int i2c_bus)
|
||||||
{
|
{
|
||||||
if (plat == NULL) {
|
if (plat == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user