mraa.c: Replaced string values with #defines
Signed-off-by: Houman Brinjcargorabi <hbrinjcar@gmail.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
c976e9f982
commit
4277a3ee23
12
src/mraa.c
12
src/mraa.c
@@ -1210,7 +1210,7 @@ mraa_init_io(const char* desc)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strncmp(type, "GPIO", 4) == 0) {
|
||||
if (strncmp(type, GPIO_KEY, strlen(GPIO_KEY)) == 0) {
|
||||
if (raw) {
|
||||
if (mraa_init_io_helper(&str, &pin, delim) == MRAA_SUCCESS) {
|
||||
return (void*) mraa_gpio_init_raw(pin);
|
||||
@@ -1219,7 +1219,7 @@ mraa_init_io(const char* desc)
|
||||
return NULL;
|
||||
}
|
||||
return (void*) mraa_gpio_init(pin);
|
||||
} else if (strncmp(type, "I2C", 3) == 0) {
|
||||
} else if (strncmp(type, I2C_KEY, strlen(I2C_KEY)) == 0) {
|
||||
if (raw) {
|
||||
if (mraa_init_io_helper(&str, &pin, delim) == MRAA_SUCCESS) {
|
||||
return (void*) mraa_i2c_init_raw(pin);
|
||||
@@ -1228,13 +1228,13 @@ mraa_init_io(const char* desc)
|
||||
return NULL;
|
||||
}
|
||||
return (void*) mraa_i2c_init(pin);
|
||||
} else if (strncmp(type, "AIO", 3) == 0) {
|
||||
} else if (strncmp(type, AIO_KEY, strlen(AIO_KEY)) == 0) {
|
||||
if (raw) {
|
||||
syslog(LOG_ERR, "mraa_init_io: Aio doesn't have a RAW mode");
|
||||
return NULL;
|
||||
}
|
||||
return (void*) mraa_aio_init(pin);
|
||||
} else if (strncmp(type, "PWM", 3) == 0) {
|
||||
} else if (strncmp(type, PWM_KEY, strlen(PWM_KEY)) == 0) {
|
||||
if (raw) {
|
||||
if (mraa_init_io_helper(&str, &id, delim) != MRAA_SUCCESS) {
|
||||
syslog(LOG_ERR, "mraa_init_io: Pwm, unable to convert the chip id string into a useable Int");
|
||||
@@ -1247,7 +1247,7 @@ mraa_init_io(const char* desc)
|
||||
return (void*) mraa_pwm_init_raw(id, pin);
|
||||
}
|
||||
return (void*) mraa_pwm_init(pin);
|
||||
} else if (strncmp(type, "SPI", 3) == 0) {
|
||||
} else if (strncmp(type, SPI_KEY, strlen(SPI_KEY)) == 0) {
|
||||
if (raw) {
|
||||
if (mraa_init_io_helper(&str, &id, delim) != MRAA_SUCCESS) {
|
||||
syslog(LOG_ERR, "mraa_init_io: Spi, unable to convert the bus string into a useable Int");
|
||||
@@ -1260,7 +1260,7 @@ mraa_init_io(const char* desc)
|
||||
return (void*) mraa_spi_init_raw(id, pin);
|
||||
}
|
||||
return (void*) mraa_spi_init(pin);
|
||||
} else if (strncmp(type, "UART", 4) == 0) {
|
||||
} else if (strncmp(type, UART_KEY, strlen(UART_KEY)) == 0) {
|
||||
if (raw) {
|
||||
return (void*) mraa_uart_init_raw(str);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user