- unclear PERIPHERAL_ERROR_UNKNOWN error is returning too much
- change linux error type usage to error value defined by peripheral_io
Signed-off-by: Segwon <segwon.han@samsung.com>
Change-Id: I3196ed16afafa3a83ba5362287d7281dcd255192
17 files changed:
do { \
if (expr) { \
if (errno == EAGAIN) \
do { \
if (expr) { \
if (errno == EAGAIN) \
+ return PERIPHERAL_ERROR_TRY_AGAIN; \
char errmsg[MAX_ERR_LEN]; \
strerror_r(errno, errmsg, sizeof(errmsg)); \
_E("Failed the %s(%d) function. errmsg: %s", __FUNCTION__, __LINE__, errmsg); \
char errmsg[MAX_ERR_LEN]; \
strerror_r(errno, errmsg, sizeof(errmsg)); \
_E("Failed the %s(%d) function. errmsg: %s", __FUNCTION__, __LINE__, errmsg); \
+ return PERIPHERAL_ERROR_IO_ERROR; \
if (gpio_proxy == NULL) {
_E("Failed to create gpio proxy : %s", error->message);
g_error_free(error);
if (gpio_proxy == NULL) {
_E("Failed to create gpio proxy : %s", error->message);
g_error_free(error);
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
{
if (gpio_proxy == NULL) {
_E("Gpio proxy is NULL");
{
if (gpio_proxy == NULL) {
_E("Gpio proxy is NULL");
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
g_object_unref(gpio_proxy);
}
g_object_unref(gpio_proxy);
&error) == FALSE) {
_E("Failed to request daemon to gpio open : %s", error->message);
g_error_free(error);
&error) == FALSE) {
_E("Failed to request daemon to gpio open : %s", error->message);
g_error_free(error);
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
// TODO : If ret is not PERIPHERAL_ERROR_NONE, fd list it NULL from daemon.
}
// TODO : If ret is not PERIPHERAL_ERROR_NONE, fd list it NULL from daemon.
if (gpio->fd_direction < 0) {
_E("Failed to get fd for gpio direction : %s", error->message);
g_error_free(error);
if (gpio->fd_direction < 0) {
_E("Failed to get fd for gpio direction : %s", error->message);
g_error_free(error);
- ret = PERIPHERAL_ERROR_UNKNOWN;
+ ret = PERIPHERAL_ERROR_IO_ERROR;
}
gpio->fd_edge = g_unix_fd_list_get(fd_list, GPIO_FD_INDEX_EDGE, &error);
if (gpio->fd_edge < 0) {
_E("Failed to get fd for gpio edge : %s", error->message);
g_error_free(error);
}
gpio->fd_edge = g_unix_fd_list_get(fd_list, GPIO_FD_INDEX_EDGE, &error);
if (gpio->fd_edge < 0) {
_E("Failed to get fd for gpio edge : %s", error->message);
g_error_free(error);
- ret = PERIPHERAL_ERROR_UNKNOWN;
+ ret = PERIPHERAL_ERROR_IO_ERROR;
}
gpio->fd_value = g_unix_fd_list_get(fd_list, GPIO_FD_INDEX_VALUE, &error);
if (gpio->fd_value < 0) {
_E("Failed to get fd for gpio value : %s", error->message);
g_error_free(error);
}
gpio->fd_value = g_unix_fd_list_get(fd_list, GPIO_FD_INDEX_VALUE, &error);
if (gpio->fd_value < 0) {
_E("Failed to get fd for gpio value : %s", error->message);
g_error_free(error);
- ret = PERIPHERAL_ERROR_UNKNOWN;
+ ret = PERIPHERAL_ERROR_IO_ERROR;
}
g_object_unref(fd_list);
}
g_object_unref(fd_list);
if (i2c_proxy == NULL) {
_E("Failed to create i2c proxy : %s", error->message);
g_error_free(error);
if (i2c_proxy == NULL) {
_E("Failed to create i2c proxy : %s", error->message);
g_error_free(error);
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
{
if (i2c_proxy == NULL) {
_E("I2c proxy is NULL");
{
if (i2c_proxy == NULL) {
_E("I2c proxy is NULL");
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
g_object_unref(i2c_proxy);
}
g_object_unref(i2c_proxy);
&error) == FALSE) {
_E("Failed to request daemon to i2c open : %s", error->message);
g_error_free(error);
&error) == FALSE) {
_E("Failed to request daemon to i2c open : %s", error->message);
g_error_free(error);
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
// TODO : If ret is not PERIPHERAL_ERROR_NONE, fd list it NULL from daemon.
}
// TODO : If ret is not PERIPHERAL_ERROR_NONE, fd list it NULL from daemon.
if (i2c->fd < 0) {
_E("Failed to get fd for i2c : %s", error->message);
g_error_free(error);
if (i2c->fd < 0) {
_E("Failed to get fd for i2c : %s", error->message);
g_error_free(error);
+ ret = PERIPHERAL_ERROR_IO_ERROR;
}
g_object_unref(fd_list);
}
g_object_unref(fd_list);
if (pwm_proxy == NULL) {
_E("Failed to create pwm proxy : %s", error->message);
g_error_free(error);
if (pwm_proxy == NULL) {
_E("Failed to create pwm proxy : %s", error->message);
g_error_free(error);
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
{
if (pwm_proxy == NULL) {
_E("Pwm proxy is NULL");
{
if (pwm_proxy == NULL) {
_E("Pwm proxy is NULL");
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
g_object_unref(pwm_proxy);
}
g_object_unref(pwm_proxy);
&error) == FALSE) {
_E("Failed to request daemon to pwm open : %s", error->message);
g_error_free(error);
&error) == FALSE) {
_E("Failed to request daemon to pwm open : %s", error->message);
g_error_free(error);
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
// TODO : If ret is not PERIPHERAL_ERROR_NONE, fd list it NULL from daemon.
}
// TODO : If ret is not PERIPHERAL_ERROR_NONE, fd list it NULL from daemon.
if (pwm->fd_period < 0) {
_E("Failed to get fd for pwm period : %s", error->message);
g_error_free(error);
if (pwm->fd_period < 0) {
_E("Failed to get fd for pwm period : %s", error->message);
g_error_free(error);
- ret = PERIPHERAL_ERROR_UNKNOWN;
+ ret = PERIPHERAL_ERROR_IO_ERROR;
}
pwm->fd_duty_cycle = g_unix_fd_list_get(fd_list, PWM_FD_INDEX_DUTY_CYCLE, &error);
if (pwm->fd_duty_cycle < 0) {
_E("Failed to get fd for pwm duty cycle : %s", error->message);
g_error_free(error);
}
pwm->fd_duty_cycle = g_unix_fd_list_get(fd_list, PWM_FD_INDEX_DUTY_CYCLE, &error);
if (pwm->fd_duty_cycle < 0) {
_E("Failed to get fd for pwm duty cycle : %s", error->message);
g_error_free(error);
- ret = PERIPHERAL_ERROR_UNKNOWN;
+ ret = PERIPHERAL_ERROR_IO_ERROR;
}
pwm->fd_polarity = g_unix_fd_list_get(fd_list, PWM_FD_INDEX_POLARITY, &error);
if (pwm->fd_polarity < 0) {
_E("Failed to get fd for pwm polarity : %s", error->message);
g_error_free(error);
}
pwm->fd_polarity = g_unix_fd_list_get(fd_list, PWM_FD_INDEX_POLARITY, &error);
if (pwm->fd_polarity < 0) {
_E("Failed to get fd for pwm polarity : %s", error->message);
g_error_free(error);
- ret = PERIPHERAL_ERROR_UNKNOWN;
+ ret = PERIPHERAL_ERROR_IO_ERROR;
}
pwm->fd_enable = g_unix_fd_list_get(fd_list, PWM_FD_INDEX_ENABLE, &error);
if (pwm->fd_enable < 0) {
_E("Failed to get fd for pwm enable : %s", error->message);
g_error_free(error);
}
pwm->fd_enable = g_unix_fd_list_get(fd_list, PWM_FD_INDEX_ENABLE, &error);
if (pwm->fd_enable < 0) {
_E("Failed to get fd for pwm enable : %s", error->message);
g_error_free(error);
- ret = PERIPHERAL_ERROR_UNKNOWN;
+ ret = PERIPHERAL_ERROR_IO_ERROR;
}
g_object_unref(fd_list);
}
g_object_unref(fd_list);
if (spi_proxy == NULL) {
_E("Failed to create spi proxy : %s", error->message);
g_error_free(error);
if (spi_proxy == NULL) {
_E("Failed to create spi proxy : %s", error->message);
g_error_free(error);
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
{
if (spi_proxy == NULL) {
_E("Spi proxy is NULL");
{
if (spi_proxy == NULL) {
_E("Spi proxy is NULL");
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
g_object_unref(spi_proxy);
}
g_object_unref(spi_proxy);
&error) == FALSE) {
_E("Failed to request daemon to spi open : %s", error->message);
g_error_free(error);
&error) == FALSE) {
_E("Failed to request daemon to spi open : %s", error->message);
g_error_free(error);
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
// TODO : If ret is not PERIPHERAL_ERROR_NONE, fd list it NULL from daemon.
}
// TODO : If ret is not PERIPHERAL_ERROR_NONE, fd list it NULL from daemon.
if (spi->fd < 0) {
_E("Failed to get fd for spi : %s", error->message);
g_error_free(error);
if (spi->fd < 0) {
_E("Failed to get fd for spi : %s", error->message);
g_error_free(error);
- ret = PERIPHERAL_ERROR_UNKNOWN;
+ ret = PERIPHERAL_ERROR_IO_ERROR;
}
g_object_unref(fd_list);
}
g_object_unref(fd_list);
if (uart_proxy == NULL) {
_E("Failed to create uart proxy : %s", error->message);
g_error_free(error);
if (uart_proxy == NULL) {
_E("Failed to create uart proxy : %s", error->message);
g_error_free(error);
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
{
if (uart_proxy == NULL) {
_E("Uart proxy is NULL");
{
if (uart_proxy == NULL) {
_E("Uart proxy is NULL");
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
g_object_unref(uart_proxy);
}
g_object_unref(uart_proxy);
&error) == FALSE) {
_E("Failed to request daemon to uart open : %s", error->message);
g_error_free(error);
&error) == FALSE) {
_E("Failed to request daemon to uart open : %s", error->message);
g_error_free(error);
- return PERIPHERAL_ERROR_UNKNOWN;
+ return PERIPHERAL_ERROR_IO_ERROR;
}
// TODO : If ret is not PERIPHERAL_ERROR_NONE, fd list it NULL from daemon.
}
// TODO : If ret is not PERIPHERAL_ERROR_NONE, fd list it NULL from daemon.
if (uart->fd < 0) {
_E("Failed to get fd for uart : %s", error->message);
g_error_free(error);
if (uart->fd < 0) {
_E("Failed to get fd for uart : %s", error->message);
g_error_free(error);
- ret = PERIPHERAL_ERROR_UNKNOWN;
+ ret = PERIPHERAL_ERROR_IO_ERROR;
}
g_object_unref(fd_list);
}
g_object_unref(fd_list);
int ret = write(gpio->fd_direction, types[direction].type, types[direction].len);
CHECK_ERROR(ret != types[direction].len);
int ret = write(gpio->fd_direction, types[direction].type, types[direction].len);
CHECK_ERROR(ret != types[direction].len);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e edge)
}
int peripheral_interface_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e edge)
int ret = write(gpio->fd_edge, types[edge].type, types[edge].len);
CHECK_ERROR(ret != types[edge].len);
int ret = write(gpio->fd_edge, types[edge].type, types[edge].len);
CHECK_ERROR(ret != types[edge].len);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_gpio_write(peripheral_gpio_h gpio, uint32_t value)
}
int peripheral_interface_gpio_write(peripheral_gpio_h gpio, uint32_t value)
int ret = write(gpio->fd_value, types[value].type, types[value].len);
CHECK_ERROR(ret != types[value].len);
int ret = write(gpio->fd_value, types[value].type, types[value].len);
CHECK_ERROR(ret != types[value].len);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_gpio_read(peripheral_gpio_h gpio, uint32_t *value)
}
int peripheral_interface_gpio_read(peripheral_gpio_h gpio, uint32_t *value)
ret = read(gpio->fd_value, &gpio_buf, length);
CHECK_ERROR(ret != length);
ret = read(gpio->fd_value, &gpio_buf, length);
CHECK_ERROR(ret != length);
- if (gpio_buf[0] == '0')
+ if (gpio_buf[0] == '0') {
- else if (gpio_buf[0] == '1')
+ } else if (gpio_buf[0] == '1') {
_E("Error: gpio value is error \n");
_E("Error: gpio value is error \n");
+ return PERIPHERAL_ERROR_IO_ERROR;
+ }
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_gpio_close(peripheral_gpio_h gpio)
}
int peripheral_interface_gpio_close(peripheral_gpio_h gpio)
ret = close(gpio->fd_value);
CHECK_ERROR(ret != 0);
ret = close(gpio->fd_value);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_gpio_open_isr(peripheral_gpio_h gpio)
{
// TODO: set interrupted callback function
}
int peripheral_interface_gpio_open_isr(peripheral_gpio_h gpio)
{
// TODO: set interrupted callback function
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_gpio_close_isr(peripheral_gpio_h gpio)
{
// TODO: unset interrupted callback function
}
int peripheral_interface_gpio_close_isr(peripheral_gpio_h gpio)
{
// TODO: unset interrupted callback function
+ return PERIPHERAL_ERROR_NONE;
}
\ No newline at end of file
}
\ No newline at end of file
int ret = close(i2c->fd);
CHECK_ERROR(ret != 0);
int ret = close(i2c->fd);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_i2c_read(peripheral_i2c_h i2c, uint8_t *data, uint32_t length)
}
int peripheral_interface_i2c_read(peripheral_i2c_h i2c, uint8_t *data, uint32_t length)
int ret = read(i2c->fd, data, length);
CHECK_ERROR(ret != length);
int ret = read(i2c->fd, data, length);
CHECK_ERROR(ret != length);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_i2c_write(peripheral_i2c_h i2c, uint8_t *data, uint32_t length)
}
int peripheral_interface_i2c_write(peripheral_i2c_h i2c, uint8_t *data, uint32_t length)
int ret = write(i2c->fd, data, length);
CHECK_ERROR(ret != length);
int ret = write(i2c->fd, data, length);
CHECK_ERROR(ret != length);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_i2c_read_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t *data_out)
}
int peripheral_interface_i2c_read_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t *data_out)
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_i2c_write_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t data_in)
}
int peripheral_interface_i2c_write_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t data_in)
ret = ioctl(i2c->fd, I2C_SMBUS, &data_arg);
CHECK_ERROR(ret != 0);
ret = ioctl(i2c->fd, I2C_SMBUS, &data_arg);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_i2c_read_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_t *data_out)
}
int peripheral_interface_i2c_read_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_t *data_out)
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_i2c_write_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_t data_in)
}
int peripheral_interface_i2c_write_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_t data_in)
ret = ioctl(i2c->fd, I2C_SMBUS, &data_arg);
CHECK_ERROR(ret != 0);
ret = ioctl(i2c->fd, I2C_SMBUS, &data_arg);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
\ No newline at end of file
}
\ No newline at end of file
ret = close(pwm->fd_enable);
CHECK_ERROR(ret != 0);
ret = close(pwm->fd_enable);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_pwm_set_period(peripheral_pwm_h pwm, uint32_t period)
}
int peripheral_interface_pwm_set_period(peripheral_pwm_h pwm, uint32_t period)
ret = write(pwm->fd_period, pwm_buf, length);
CHECK_ERROR(ret != length);
ret = write(pwm->fd_period, pwm_buf, length);
CHECK_ERROR(ret != length);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle)
}
int peripheral_interface_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle)
ret = write(pwm->fd_duty_cycle, pwm_buf, length);
CHECK_ERROR(ret != length);
ret = write(pwm->fd_duty_cycle, pwm_buf, length);
CHECK_ERROR(ret != length);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity)
}
int peripheral_interface_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity)
int ret = write(pwm->fd_polarity, types[polarity].type, types[polarity].len);
CHECK_ERROR(ret != types[polarity].len);
int ret = write(pwm->fd_polarity, types[polarity].type, types[polarity].len);
CHECK_ERROR(ret != types[polarity].len);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_pwm_set_enable(peripheral_pwm_h pwm, bool enable)
}
int peripheral_interface_pwm_set_enable(peripheral_pwm_h pwm, bool enable)
int ret = write(pwm->fd_enable, types[enable].type, types[enable].len);
CHECK_ERROR(ret != types[enable].len);
int ret = write(pwm->fd_enable, types[enable].type, types[enable].len);
CHECK_ERROR(ret != types[enable].len);
+ return PERIPHERAL_ERROR_NONE;
int ret = close(spi->fd);
CHECK_ERROR(ret != 0);
int ret = close(spi->fd);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_spi_set_mode(peripheral_spi_h spi, peripheral_spi_mode_e mode)
}
int peripheral_interface_spi_set_mode(peripheral_spi_h spi, peripheral_spi_mode_e mode)
int ret = ioctl(spi->fd, SPI_IOC_WR_MODE, &mode);
CHECK_ERROR(ret != 0);
int ret = ioctl(spi->fd, SPI_IOC_WR_MODE, &mode);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_spi_set_bit_order(peripheral_spi_h spi, peripheral_spi_bit_order_e bit_order)
}
int peripheral_interface_spi_set_bit_order(peripheral_spi_h spi, peripheral_spi_bit_order_e bit_order)
int ret = ioctl(spi->fd, SPI_IOC_WR_LSB_FIRST, &bit_order);
CHECK_ERROR(ret != 0);
int ret = ioctl(spi->fd, SPI_IOC_WR_LSB_FIRST, &bit_order);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_spi_set_bits_per_word(peripheral_spi_h spi, uint8_t bits)
}
int peripheral_interface_spi_set_bits_per_word(peripheral_spi_h spi, uint8_t bits)
int ret = ioctl(spi->fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
CHECK_ERROR(ret != 0);
int ret = ioctl(spi->fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_spi_set_frequency(peripheral_spi_h spi, uint32_t freq)
}
int peripheral_interface_spi_set_frequency(peripheral_spi_h spi, uint32_t freq)
int ret = ioctl(spi->fd, SPI_IOC_WR_MAX_SPEED_HZ, &freq);
CHECK_ERROR(ret != 0);
int ret = ioctl(spi->fd, SPI_IOC_WR_MAX_SPEED_HZ, &freq);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_spi_read(peripheral_spi_h spi, uint8_t *rxbuf, uint32_t length)
}
int peripheral_interface_spi_read(peripheral_spi_h spi, uint8_t *rxbuf, uint32_t length)
ret = ioctl(spi->fd, SPI_IOC_MESSAGE(1), &xfer);
CHECK_ERROR(ret != 0);
ret = ioctl(spi->fd, SPI_IOC_MESSAGE(1), &xfer);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_spi_write(peripheral_spi_h spi, uint8_t *txbuf, uint32_t length)
}
int peripheral_interface_spi_write(peripheral_spi_h spi, uint8_t *txbuf, uint32_t length)
ret = ioctl(spi->fd, SPI_IOC_MESSAGE(1), &xfer);
CHECK_ERROR(ret != 0);
ret = ioctl(spi->fd, SPI_IOC_MESSAGE(1), &xfer);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_spi_transfer(peripheral_spi_h spi, uint8_t *txbuf, uint8_t *rxbuf, uint32_t length)
}
int peripheral_interface_spi_transfer(peripheral_spi_h spi, uint8_t *txbuf, uint8_t *rxbuf, uint32_t length)
int ret;
struct spi_ioc_transfer xfer;
int ret;
struct spi_ioc_transfer xfer;
- if (!txbuf || !rxbuf) return -EINVAL;
+ if (!txbuf || !rxbuf) return PERIPHERAL_ERROR_INVALID_PARAMETER;
memset(&xfer, 0, sizeof(xfer));
xfer.tx_buf = (unsigned long)txbuf;
memset(&xfer, 0, sizeof(xfer));
xfer.tx_buf = (unsigned long)txbuf;
ret = ioctl(spi->fd, SPI_IOC_MESSAGE(1), &xfer);
CHECK_ERROR(ret != 0);
ret = ioctl(spi->fd, SPI_IOC_MESSAGE(1), &xfer);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
ret = close(uart->fd);
CHECK_ERROR(ret != 0);
ret = close(uart->fd);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_uart_flush(peripheral_uart_h uart)
}
int peripheral_interface_uart_flush(peripheral_uart_h uart)
int ret = tcflush(uart->fd, TCIOFLUSH);
CHECK_ERROR(ret != 0);
int ret = tcflush(uart->fd, TCIOFLUSH);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_uart_set_baud_rate(peripheral_uart_h uart, peripheral_uart_baud_rate_e baud)
}
int peripheral_interface_uart_set_baud_rate(peripheral_uart_h uart, peripheral_uart_baud_rate_e baud)
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_uart_set_byte_size(peripheral_uart_h uart, peripheral_uart_byte_size_e byte_size)
}
int peripheral_interface_uart_set_byte_size(peripheral_uart_h uart, peripheral_uart_byte_size_e byte_size)
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_uart_set_parity(peripheral_uart_h uart, peripheral_uart_parity_e parity)
}
int peripheral_interface_uart_set_parity(peripheral_uart_h uart, peripheral_uart_parity_e parity)
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_uart_set_stop_bits(peripheral_uart_h uart, peripheral_uart_stop_bits_e stop_bits)
}
int peripheral_interface_uart_set_stop_bits(peripheral_uart_h uart, peripheral_uart_stop_bits_e stop_bits)
break;
default:
_E("Invalid parameter stop_bits");
break;
default:
_E("Invalid parameter stop_bits");
+ return PERIPHERAL_ERROR_INVALID_PARAMETER;
}
peripheral_interface_uart_flush(uart);
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
}
peripheral_interface_uart_flush(uart);
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_uart_set_flow_control(peripheral_uart_h uart, peripheral_uart_software_flow_control_e xonxoff, peripheral_uart_hardware_flow_control_e rtscts)
}
int peripheral_interface_uart_set_flow_control(peripheral_uart_h uart, peripheral_uart_software_flow_control_e xonxoff, peripheral_uart_hardware_flow_control_e rtscts)
else if (rtscts == PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE)
tio.c_cflag &= ~CRTSCTS;
else
else if (rtscts == PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE)
tio.c_cflag &= ~CRTSCTS;
else
+ return PERIPHERAL_ERROR_INVALID_PARAMETER;
if (xonxoff == PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF)
tio.c_iflag |= (IXON | IXOFF | IXANY);
else if (xonxoff == PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE)
tio.c_iflag &= ~(IXON | IXOFF | IXANY);
else
if (xonxoff == PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF)
tio.c_iflag |= (IXON | IXOFF | IXANY);
else if (xonxoff == PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE)
tio.c_iflag &= ~(IXON | IXOFF | IXANY);
else
+ return PERIPHERAL_ERROR_INVALID_PARAMETER;
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
ret = tcsetattr(uart->fd, TCSANOW, &tio);
CHECK_ERROR(ret != 0);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_uart_read(peripheral_uart_h uart, uint8_t *buf, uint32_t length)
}
int peripheral_interface_uart_read(peripheral_uart_h uart, uint8_t *buf, uint32_t length)
int ret = read(uart->fd, (void *)buf, length);
CHECK_ERROR(ret != length);
int ret = read(uart->fd, (void *)buf, length);
CHECK_ERROR(ret != length);
+ return PERIPHERAL_ERROR_NONE;
}
int peripheral_interface_uart_write(peripheral_uart_h uart, uint8_t *buf, uint32_t length)
}
int peripheral_interface_uart_write(peripheral_uart_h uart, uint8_t *buf, uint32_t length)
int ret = write(uart->fd, buf, length);
CHECK_ERROR(ret != length);
int ret = write(uart->fd, buf, length);
CHECK_ERROR(ret != length);
+ return PERIPHERAL_ERROR_NONE;
ret = system_info_get_platform_string(KEY_SYSTEM_MODEL_NAME, model_name);
if (ret != SYSTEM_INFO_ERROR_NONE) {
printf("[Message] Failed to get model name.\n\n");
ret = system_info_get_platform_string(KEY_SYSTEM_MODEL_NAME, model_name);
if (ret != SYSTEM_INFO_ERROR_NONE) {
printf("[Message] Failed to get model name.\n\n");
+ return PERIPHERAL_ERROR_NOT_SUPPORTED;
+ return PERIPHERAL_ERROR_NONE;
}
static int __get_feature(const char *key, bool *feature)
}
static int __get_feature(const char *key, bool *feature)
ret = system_info_get_platform_bool(key, feature);
if (ret != SYSTEM_INFO_ERROR_NONE) {
printf("[Message] Failed to feature (%s).\n\n", key);
ret = system_info_get_platform_bool(key, feature);
if (ret != SYSTEM_INFO_ERROR_NONE) {
printf("[Message] Failed to feature (%s).\n\n", key);
+ return PERIPHERAL_ERROR_NOT_SUPPORTED;
+ return PERIPHERAL_ERROR_NONE;
}
static int __test_peripheral_init()
{
}
static int __test_peripheral_init()
{
+ int ret = PERIPHERAL_ERROR_NONE;
char *model_name = NULL;
bool feature = false;
ret = __get_model_name(&model_name);
char *model_name = NULL;
bool feature = false;
ret = __get_model_name(&model_name);
- if (ret != 0) return ret;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_GPIO, &feature);
ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_GPIO, &feature);
- if (ret != 0) return ret;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = test_peripheral_io_gpio_initialize(model_name, feature);
ret = test_peripheral_io_gpio_initialize(model_name, feature);
- if (ret != 0) return ret;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_I2C, &feature);
ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_I2C, &feature);
- if (ret != 0) return ret;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = test_peripheral_io_i2c_initialize(model_name, feature);
ret = test_peripheral_io_i2c_initialize(model_name, feature);
- if (ret != 0) return ret;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_PWM, &feature);
ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_PWM, &feature);
- if (ret != 0) return ret;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = test_peripheral_io_pwm_initialize(model_name, feature);
ret = test_peripheral_io_pwm_initialize(model_name, feature);
- if (ret != 0) return ret;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_UART, &feature);
ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_UART, &feature);
- if (ret != 0) return ret;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = test_peripheral_io_uart_initialize(model_name, feature);
ret = test_peripheral_io_uart_initialize(model_name, feature);
- if (ret != 0) return ret;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_SPI, &feature);
ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_SPI, &feature);
- if (ret != 0) return ret;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = test_peripheral_io_spi_initialize(model_name, feature);
ret = test_peripheral_io_spi_initialize(model_name, feature);
- if (ret != 0) return ret;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
pass_count = 0;
ret = __test_peripheral_init();
pass_count = 0;
ret = __test_peripheral_init();
+ if (ret != PERIPHERAL_ERROR_NONE) {
printf("[Message] Failed test init...\n\n");
return -1;
}
printf("[Message] Failed test init...\n\n");
return -1;
}
else if (!strcmp(model, "artik"))
pin = GPIO_PIN_ARTIK530;
else
else if (!strcmp(model, "artik"))
pin = GPIO_PIN_ARTIK530;
else
+ return PERIPHERAL_ERROR_NO_DEVICE;
+ return PERIPHERAL_ERROR_NONE;
}
int test_peripheral_io_gpio_peripheral_gpio_open_p(void)
}
int test_peripheral_io_gpio_peripheral_gpio_open_p(void)
if (g_feature == false) {
ret = peripheral_gpio_open(pin, &gpio_h);
if (g_feature == false) {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_open(pin, NULL);
if (g_feature == false) {
ret = peripheral_gpio_open(pin, NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, NULL);
} else {
ret = peripheral_gpio_open(pin, NULL);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_open(GPIO_PIN_INVALID, &gpio_h);
if (g_feature == false) {
ret = peripheral_gpio_open(GPIO_PIN_INVALID, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(GPIO_PIN_INVALID, &gpio_h);
} else {
ret = peripheral_gpio_open(GPIO_PIN_INVALID, &gpio_h);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_close(gpio_h);
if (g_feature == false) {
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_close(NULL);
if (g_feature == false) {
ret = peripheral_gpio_close(NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_close(NULL);
} else {
ret = peripheral_gpio_close(NULL);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (g_feature == false) {
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH);
if (g_feature == false) {
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
if (g_feature == false) {
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_direction(NULL, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH);
if (g_feature == false) {
ret = peripheral_gpio_set_direction(NULL, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_set_direction(NULL, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH);
} else {
ret = peripheral_gpio_set_direction(NULL, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN - 1);
if (g_feature == false) {
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN - 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW + 1);
if (g_feature == false) {
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW + 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_NONE);
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_NONE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_NONE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_NONE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_RISING);
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_RISING);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_RISING);
if (ret != PERIPHERAL_ERROR_NONE && ret != PERIPHERAL_ERROR_TRY_AGAIN) {
peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_RISING);
if (ret != PERIPHERAL_ERROR_NONE && ret != PERIPHERAL_ERROR_TRY_AGAIN) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_FALLING);
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_FALLING);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_FALLING);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_FALLING);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_BOTH);
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_BOTH);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_BOTH);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_BOTH);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(NULL, PERIPHERAL_GPIO_EDGE_RISING);
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(NULL, PERIPHERAL_GPIO_EDGE_RISING);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_set_edge_mode(NULL, PERIPHERAL_GPIO_EDGE_RISING);
} else {
ret = peripheral_gpio_set_edge_mode(NULL, PERIPHERAL_GPIO_EDGE_RISING);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_NONE - 1);
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_NONE - 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_NONE - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_NONE - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_BOTH + 1);
if (g_feature == false) {
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_BOTH + 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_BOTH + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_BOTH + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_interrupted_cb(gpio_h, gpio_interrupted_cb, NULL);
if (g_feature == false) {
ret = peripheral_gpio_set_interrupted_cb(gpio_h, gpio_interrupted_cb, NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_RISING);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_RISING);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_set_interrupted_cb(gpio_h, gpio_interrupted_cb, NULL);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_set_interrupted_cb(gpio_h, gpio_interrupted_cb, NULL);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_interrupted_cb(NULL, gpio_interrupted_cb, NULL);
if (g_feature == false) {
ret = peripheral_gpio_set_interrupted_cb(NULL, gpio_interrupted_cb, NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_set_interrupted_cb(NULL, gpio_interrupted_cb, NULL);
} else {
ret = peripheral_gpio_set_interrupted_cb(NULL, gpio_interrupted_cb, NULL);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_set_interrupted_cb(gpio_h, NULL, NULL);
if (g_feature == false) {
ret = peripheral_gpio_set_interrupted_cb(gpio_h, NULL, NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_interrupted_cb(gpio_h, NULL, NULL);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_interrupted_cb(gpio_h, NULL, NULL);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
if (g_feature == false) {
ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_interrupted_cb(gpio_h, gpio_interrupted_cb, NULL);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_interrupted_cb(gpio_h, gpio_interrupted_cb, NULL);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
if (g_feature == false) {
ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_unset_interrupted_cb(NULL);
if (g_feature == false) {
ret = peripheral_gpio_unset_interrupted_cb(NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_unset_interrupted_cb(NULL);
} else {
ret = peripheral_gpio_unset_interrupted_cb(NULL);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_read(gpio_h, &value);
if (g_feature == false) {
ret = peripheral_gpio_read(gpio_h, &value);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_read(gpio_h, &value);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_read(gpio_h, &value);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_read(NULL, &value);
if (g_feature == false) {
ret = peripheral_gpio_read(NULL, &value);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_read(NULL, &value);
} else {
ret = peripheral_gpio_read(NULL, &value);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_read(gpio_h, NULL);
if (g_feature == false) {
ret = peripheral_gpio_read(gpio_h, NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_read(gpio_h, NULL);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_read(gpio_h, NULL);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_write(gpio_h, value);
if (g_feature == false) {
ret = peripheral_gpio_write(gpio_h, value);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_write(gpio_h, value);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_write(gpio_h, value);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_write(NULL, value);
if (g_feature == false) {
ret = peripheral_gpio_write(NULL, value);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_write(NULL, value);
} else {
ret = peripheral_gpio_write(NULL, value);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_gpio_write(gpio_h, value);
if (g_feature == false) {
ret = peripheral_gpio_write(gpio_h, value);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
} else {
ret = peripheral_gpio_open(pin, &gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_write(gpio_h, value);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_write(gpio_h, value);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_gpio_close(gpio_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_gpio_close(gpio_h);
}
ret = peripheral_gpio_close(gpio_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if ((!strcmp(model, "rpi3")) || (!strcmp(model, "artik")))
bus = I2C_BUS;
else
if ((!strcmp(model, "rpi3")) || (!strcmp(model, "artik")))
bus = I2C_BUS;
else
+ return PERIPHERAL_ERROR_NO_DEVICE;
+ return PERIPHERAL_ERROR_NONE;
}
int test_peripheral_io_i2c_peripheral_i2c_open_p(void)
}
int test_peripheral_io_i2c_peripheral_i2c_open_p(void)
if (g_feature == false) {
ret = peripheral_i2c_open(bus, address, &i2c_h);
if (g_feature == false) {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_i2c_close(i2c_h);
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_open(bus, address, NULL);
if (g_feature == false) {
ret = peripheral_i2c_open(bus, address, NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, NULL);
} else {
ret = peripheral_i2c_open(bus, address, NULL);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_open(I2C_BUS_INVALID, address, &i2c_h);
if (g_feature == false) {
ret = peripheral_i2c_open(I2C_BUS_INVALID, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(I2C_BUS_INVALID, address, &i2c_h);
} else {
ret = peripheral_i2c_open(I2C_BUS_INVALID, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_open(bus, I2C_ADDRESS_INVALID, &i2c_h);
if (g_feature == false) {
ret = peripheral_i2c_open(bus, I2C_ADDRESS_INVALID, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, I2C_ADDRESS_INVALID, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, I2C_ADDRESS_INVALID, &i2c_h);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_close(i2c_h);
if (g_feature == false) {
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_i2c_close(i2c_h);
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_close(NULL);
if (g_feature == false) {
ret = peripheral_i2c_close(NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_close(NULL);
} else {
ret = peripheral_i2c_close(NULL);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_read(i2c_h, buf, I2C_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_i2c_read(i2c_h, buf, I2C_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_i2c_read(i2c_h, buf, I2C_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_i2c_close(i2c_h);
ret = peripheral_i2c_read(i2c_h, buf, I2C_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_i2c_close(i2c_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_i2c_close(i2c_h);
}
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_read(NULL, buf, I2C_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_i2c_read(NULL, buf, I2C_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_read(NULL, buf, I2C_BUFFER_LEN);
} else {
ret = peripheral_i2c_read(NULL, buf, I2C_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_read(i2c_h, NULL, I2C_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_i2c_read(i2c_h, NULL, I2C_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_i2c_read(i2c_h, NULL, I2C_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_i2c_close(i2c_h);
ret = peripheral_i2c_read(i2c_h, NULL, I2C_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_i2c_close(i2c_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_i2c_close(i2c_h);
}
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_write(i2c_h, buf, I2C_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_i2c_write(i2c_h, buf, I2C_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_i2c_write(i2c_h, buf, I2C_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_i2c_close(i2c_h);
ret = peripheral_i2c_write(i2c_h, buf, I2C_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_i2c_close(i2c_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_i2c_close(i2c_h);
}
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_write(NULL, buf, I2C_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_i2c_write(NULL, buf, I2C_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_write(NULL, buf, I2C_BUFFER_LEN);
} else {
ret = peripheral_i2c_write(NULL, buf, I2C_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_write(i2c_h, NULL, I2C_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_i2c_write(i2c_h, NULL, I2C_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_i2c_write(i2c_h, NULL, I2C_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_i2c_close(i2c_h);
ret = peripheral_i2c_write(i2c_h, NULL, I2C_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_i2c_close(i2c_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_i2c_close(i2c_h);
}
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_read_register_byte(i2c_h, I2C_REGISTER, &data);
if (g_feature == false) {
ret = peripheral_i2c_read_register_byte(i2c_h, I2C_REGISTER, &data);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_i2c_read_register_byte(i2c_h, I2C_REGISTER, &data);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_i2c_close(i2c_h);
ret = peripheral_i2c_read_register_byte(i2c_h, I2C_REGISTER, &data);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_i2c_close(i2c_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_i2c_close(i2c_h);
}
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_read_register_byte(NULL, I2C_REGISTER, &data);
if (g_feature == false) {
ret = peripheral_i2c_read_register_byte(NULL, I2C_REGISTER, &data);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_read_register_byte(NULL, I2C_REGISTER, &data);
} else {
ret = peripheral_i2c_read_register_byte(NULL, I2C_REGISTER, &data);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_read_register_byte(i2c_h, I2C_REGISTER, NULL);
if (g_feature == false) {
ret = peripheral_i2c_read_register_byte(i2c_h, I2C_REGISTER, NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_i2c_read_register_byte(i2c_h, I2C_REGISTER, NULL);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_i2c_close(i2c_h);
ret = peripheral_i2c_read_register_byte(i2c_h, I2C_REGISTER, NULL);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_i2c_close(i2c_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_i2c_close(i2c_h);
}
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_write_register_byte(i2c_h, I2C_REGISTER, I2C_BUFFER_VALUE);
if (g_feature == false) {
ret = peripheral_i2c_write_register_byte(i2c_h, I2C_REGISTER, I2C_BUFFER_VALUE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_i2c_write_register_byte(i2c_h, I2C_REGISTER, I2C_BUFFER_VALUE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_i2c_close(i2c_h);
ret = peripheral_i2c_write_register_byte(i2c_h, I2C_REGISTER, I2C_BUFFER_VALUE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_i2c_close(i2c_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_i2c_close(i2c_h);
}
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_write_register_byte(NULL, I2C_REGISTER, I2C_BUFFER_VALUE);
if (g_feature == false) {
ret = peripheral_i2c_write_register_byte(NULL, I2C_REGISTER, I2C_BUFFER_VALUE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_write_register_byte(NULL, I2C_REGISTER, I2C_BUFFER_VALUE);
} else {
ret = peripheral_i2c_write_register_byte(NULL, I2C_REGISTER, I2C_BUFFER_VALUE);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_read_register_word(i2c_h, I2C_REGISTER, &data);
if (g_feature == false) {
ret = peripheral_i2c_read_register_word(i2c_h, I2C_REGISTER, &data);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_i2c_read_register_word(i2c_h, I2C_REGISTER, &data);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_i2c_close(i2c_h);
ret = peripheral_i2c_read_register_word(i2c_h, I2C_REGISTER, &data);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_i2c_close(i2c_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_i2c_close(i2c_h);
}
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_read_register_word(NULL, I2C_REGISTER, &data);
if (g_feature == false) {
ret = peripheral_i2c_read_register_word(NULL, I2C_REGISTER, &data);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_read_register_word(NULL, I2C_REGISTER, &data);
} else {
ret = peripheral_i2c_read_register_word(NULL, I2C_REGISTER, &data);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_read_register_word(i2c_h, I2C_REGISTER, NULL);
if (g_feature == false) {
ret = peripheral_i2c_read_register_word(i2c_h, I2C_REGISTER, NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_i2c_read_register_word(i2c_h, I2C_REGISTER, NULL);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_i2c_close(i2c_h);
ret = peripheral_i2c_read_register_word(i2c_h, I2C_REGISTER, NULL);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_i2c_close(i2c_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_i2c_close(i2c_h);
}
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_write_register_word(i2c_h, I2C_REGISTER, I2C_BUFFER_VALUE);
if (g_feature == false) {
ret = peripheral_i2c_write_register_word(i2c_h, I2C_REGISTER, I2C_BUFFER_VALUE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
} else {
ret = peripheral_i2c_open(bus, address, &i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_i2c_write_register_word(i2c_h, I2C_REGISTER, I2C_BUFFER_VALUE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_i2c_close(i2c_h);
ret = peripheral_i2c_write_register_word(i2c_h, I2C_REGISTER, I2C_BUFFER_VALUE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_i2c_close(i2c_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_i2c_close(i2c_h);
}
ret = peripheral_i2c_close(i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_i2c_write_register_word(NULL, I2C_REGISTER, I2C_BUFFER_VALUE);
if (g_feature == false) {
ret = peripheral_i2c_write_register_word(NULL, I2C_REGISTER, I2C_BUFFER_VALUE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_i2c_write_register_word(NULL, I2C_REGISTER, I2C_BUFFER_VALUE);
} else {
ret = peripheral_i2c_write_register_word(NULL, I2C_REGISTER, I2C_BUFFER_VALUE);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
chip = PWM_CHIP;
pin = PWM_PIN;
} else {
chip = PWM_CHIP;
pin = PWM_PIN;
} else {
+ return PERIPHERAL_ERROR_NO_DEVICE;
+ return PERIPHERAL_ERROR_NONE;
}
int test_peripheral_io_pwm_peripheral_pwm_open_p(void)
}
int test_peripheral_io_pwm_peripheral_pwm_open_p(void)
if (g_feature == false) {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
if (g_feature == false) {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_pwm_close(pwm_h);
ret = peripheral_pwm_close(pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_open(PWM_CHIP_INVALID, pin, &pwm_h);
if (g_feature == false) {
ret = peripheral_pwm_open(PWM_CHIP_INVALID, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(PWM_CHIP_INVALID, pin, &pwm_h);
} else {
ret = peripheral_pwm_open(PWM_CHIP_INVALID, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_open(chip, PWM_PIN_INVALID, &pwm_h);
if (g_feature == false) {
ret = peripheral_pwm_open(chip, PWM_PIN_INVALID, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(chip, PWM_PIN_INVALID, &pwm_h);
} else {
ret = peripheral_pwm_open(chip, PWM_PIN_INVALID, &pwm_h);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_open(chip, pin, NULL);
if (g_feature == false) {
ret = peripheral_pwm_open(chip, pin, NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(chip, pin, NULL);
} else {
ret = peripheral_pwm_open(chip, pin, NULL);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_close(pwm_h);
if (g_feature == false) {
ret = peripheral_pwm_close(pwm_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_pwm_close(pwm_h);
ret = peripheral_pwm_close(pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_close(NULL);
if (g_feature == false) {
ret = peripheral_pwm_close(NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_close(NULL);
} else {
ret = peripheral_pwm_close(NULL);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_set_period(pwm_h, PWM_PERIOD);
if (g_feature == false) {
ret = peripheral_pwm_set_period(pwm_h, PWM_PERIOD);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_pwm_set_period(pwm_h, PWM_PERIOD);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_pwm_close(pwm_h);
ret = peripheral_pwm_set_period(pwm_h, PWM_PERIOD);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_pwm_close(pwm_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_pwm_close(pwm_h);
}
ret = peripheral_pwm_close(pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_set_period(NULL, PWM_PERIOD);
if (g_feature == false) {
ret = peripheral_pwm_set_period(NULL, PWM_PERIOD);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_set_period(NULL, PWM_PERIOD);
} else {
ret = peripheral_pwm_set_period(NULL, PWM_PERIOD);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_set_duty_cycle(pwm_h, PWM_DUTY_CYCLE);
if (g_feature == false) {
ret = peripheral_pwm_set_duty_cycle(pwm_h, PWM_DUTY_CYCLE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_pwm_set_duty_cycle(pwm_h, PWM_DUTY_CYCLE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_pwm_close(pwm_h);
ret = peripheral_pwm_set_duty_cycle(pwm_h, PWM_DUTY_CYCLE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_pwm_close(pwm_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_pwm_close(pwm_h);
}
ret = peripheral_pwm_close(pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_set_duty_cycle(NULL, PWM_DUTY_CYCLE);
if (g_feature == false) {
ret = peripheral_pwm_set_duty_cycle(NULL, PWM_DUTY_CYCLE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_set_duty_cycle(NULL, PWM_DUTY_CYCLE);
} else {
ret = peripheral_pwm_set_duty_cycle(NULL, PWM_DUTY_CYCLE);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH);
if (g_feature == false) {
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_pwm_close(pwm_h);
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_pwm_close(pwm_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_pwm_close(pwm_h);
}
ret = peripheral_pwm_close(pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_LOW);
if (g_feature == false) {
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_LOW);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_LOW);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_pwm_close(pwm_h);
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_LOW);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_pwm_close(pwm_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_pwm_close(pwm_h);
}
ret = peripheral_pwm_close(pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_set_polarity(NULL, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH);
if (g_feature == false) {
ret = peripheral_pwm_set_polarity(NULL, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_set_polarity(NULL, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH);
} else {
ret = peripheral_pwm_set_polarity(NULL, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH - 1);
if (g_feature == false) {
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH - 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_pwm_close(pwm_h);
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_pwm_close(pwm_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_pwm_close(pwm_h);
}
ret = peripheral_pwm_close(pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_LOW + 1);
if (g_feature == false) {
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_LOW + 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_LOW + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_pwm_close(pwm_h);
ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_LOW + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_pwm_close(pwm_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_pwm_close(pwm_h);
}
ret = peripheral_pwm_close(pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_set_enabled(pwm_h, enable);
if (g_feature == false) {
ret = peripheral_pwm_set_enabled(pwm_h, enable);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_pwm_set_enabled(pwm_h, enable);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_pwm_close(pwm_h);
ret = peripheral_pwm_set_enabled(pwm_h, enable);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_pwm_close(pwm_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_pwm_close(pwm_h);
}
ret = peripheral_pwm_close(pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_set_enabled(pwm_h, enable);
if (g_feature == false) {
ret = peripheral_pwm_set_enabled(pwm_h, enable);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
} else {
ret = peripheral_pwm_open(chip, pin, &pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_pwm_set_enabled(pwm_h, enable);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_pwm_close(pwm_h);
ret = peripheral_pwm_set_enabled(pwm_h, enable);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_pwm_close(pwm_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_pwm_close(pwm_h);
}
ret = peripheral_pwm_close(pwm_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_pwm_set_enabled(NULL, enable);
if (g_feature == false) {
ret = peripheral_pwm_set_enabled(NULL, enable);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_pwm_set_enabled(NULL, enable);
} else {
ret = peripheral_pwm_set_enabled(NULL, enable);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
else if (!strcmp(model, "artik"))
bus = SPI_BUS_ARTIK530;
else
else if (!strcmp(model, "artik"))
bus = SPI_BUS_ARTIK530;
else
+ return PERIPHERAL_ERROR_NO_DEVICE;
+ return PERIPHERAL_ERROR_NONE;
}
int test_peripheral_io_spi_peripheral_spi_open_p(void)
}
int test_peripheral_io_spi_peripheral_spi_open_p(void)
if (g_feature == false) {
ret = peripheral_spi_open(bus, cs, &spi_h);
if (g_feature == false) {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_close(spi_h);
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_open(SPI_BUS_INVALID, cs, &spi_h);
if (g_feature == false) {
ret = peripheral_spi_open(SPI_BUS_INVALID, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(SPI_BUS_INVALID, cs, &spi_h);
} else {
ret = peripheral_spi_open(SPI_BUS_INVALID, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_open(bus, SPI_CS_INVALID, &spi_h);
if (g_feature == false) {
ret = peripheral_spi_open(bus, SPI_CS_INVALID, &spi_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, SPI_CS_INVALID, &spi_h);
} else {
ret = peripheral_spi_open(bus, SPI_CS_INVALID, &spi_h);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_open(bus, cs, NULL);
if (g_feature == false) {
ret = peripheral_spi_open(bus, cs, NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, NULL);
} else {
ret = peripheral_spi_open(bus, cs, NULL);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_close(spi_h);
if (g_feature == false) {
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_close(spi_h);
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_close(NULL);
if (g_feature == false) {
ret = peripheral_spi_close(NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_close(NULL);
} else {
ret = peripheral_spi_close(NULL);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0);
if (g_feature == false) {
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_1);
if (g_feature == false) {
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_1);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_1);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_2);
if (g_feature == false) {
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_2);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_2);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_2);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_3);
if (g_feature == false) {
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_3);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_3);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_3);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_mode(NULL, PERIPHERAL_SPI_MODE_0);
if (g_feature == false) {
ret = peripheral_spi_set_mode(NULL, PERIPHERAL_SPI_MODE_0);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_mode(NULL, PERIPHERAL_SPI_MODE_0);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_mode(NULL, PERIPHERAL_SPI_MODE_0);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0 - 1);
if (g_feature == false) {
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0 - 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0 - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0 - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_3 + 1);
if (g_feature == false) {
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_3 + 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_3 + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_3 + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_MSB);
if (g_feature == false) {
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_MSB);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_MSB);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_MSB);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_LSB);
if (g_feature == false) {
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_LSB);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_LSB);
if (ret != PERIPHERAL_ERROR_IO_ERROR) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_LSB);
if (ret != PERIPHERAL_ERROR_IO_ERROR) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_bit_order(NULL, PERIPHERAL_SPI_BIT_ORDER_MSB);
if (g_feature == false) {
ret = peripheral_spi_set_bit_order(NULL, PERIPHERAL_SPI_BIT_ORDER_MSB);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_set_bit_order(NULL, PERIPHERAL_SPI_BIT_ORDER_MSB);
} else {
ret = peripheral_spi_set_bit_order(NULL, PERIPHERAL_SPI_BIT_ORDER_MSB);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_MSB - 1);
if (g_feature == false) {
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_MSB - 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_MSB - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_MSB - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_LSB + 1);
if (g_feature == false) {
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_LSB + 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_LSB + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_LSB + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD);
if (g_feature == false) {
ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_bits_per_word(NULL, SPI_BITS_PER_WORD);
if (g_feature == false) {
ret = peripheral_spi_set_bits_per_word(NULL, SPI_BITS_PER_WORD);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_set_bits_per_word(NULL, SPI_BITS_PER_WORD);
} else {
ret = peripheral_spi_set_bits_per_word(NULL, SPI_BITS_PER_WORD);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD_INVALID);
if (g_feature == false) {
ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD_INVALID);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD_INVALID);
if (ret != PERIPHERAL_ERROR_IO_ERROR) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD_INVALID);
if (ret != PERIPHERAL_ERROR_IO_ERROR) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_frequency(spi_h, SPI_FREQUENCY);
if (g_feature == false) {
ret = peripheral_spi_set_frequency(spi_h, SPI_FREQUENCY);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
}
ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_set_frequency(spi_h, SPI_FREQUENCY);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
}
ret = peripheral_spi_set_frequency(spi_h, SPI_FREQUENCY);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_set_frequency(NULL, SPI_FREQUENCY);
if (g_feature == false) {
ret = peripheral_spi_set_frequency(NULL, SPI_FREQUENCY);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_set_frequency(NULL, SPI_FREQUENCY);
} else {
ret = peripheral_spi_set_frequency(NULL, SPI_FREQUENCY);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_read(spi_h, &data, SPI_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_spi_read(spi_h, &data, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_read(spi_h, &data, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_read(spi_h, &data, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_read(NULL, &data, SPI_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_spi_read(NULL, &data, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_read(NULL, &data, SPI_BUFFER_LEN);
} else {
ret = peripheral_spi_read(NULL, &data, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_read(spi_h, NULL, SPI_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_spi_read(spi_h, NULL, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_read(spi_h, NULL, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_read(spi_h, NULL, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_write(spi_h, &data, SPI_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_spi_write(spi_h, &data, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_write(spi_h, &data, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_write(spi_h, &data, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_write(NULL, &data, SPI_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_spi_write(NULL, &data, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_write(NULL, &data, SPI_BUFFER_LEN);
} else {
ret = peripheral_spi_write(NULL, &data, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_write(spi_h, NULL, SPI_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_spi_write(spi_h, NULL, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_write(spi_h, NULL, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_write(spi_h, NULL, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_transfer(spi_h, &tx_data, &rx_data, SPI_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_spi_transfer(spi_h, &tx_data, &rx_data, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_transfer(spi_h, &tx_data, &rx_data, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_transfer(spi_h, &tx_data, &rx_data, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_transfer(NULL, &tx_data, &rx_data, SPI_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_spi_transfer(NULL, &tx_data, &rx_data, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_transfer(NULL, &tx_data, &rx_data, SPI_BUFFER_LEN);
} else {
ret = peripheral_spi_transfer(NULL, &tx_data, &rx_data, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_transfer(spi_h, NULL, &rx_data, SPI_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_spi_transfer(spi_h, NULL, &rx_data, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_transfer(spi_h, NULL, &rx_data, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_transfer(spi_h, NULL, &rx_data, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_spi_transfer(spi_h, &tx_data, NULL, SPI_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_spi_transfer(spi_h, &tx_data, NULL, SPI_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
} else {
ret = peripheral_spi_open(bus, cs, &spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_spi_transfer(spi_h, &tx_data, NULL, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
ret = peripheral_spi_transfer(spi_h, &tx_data, NULL, SPI_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_spi_close(spi_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_spi_close(spi_h);
}
ret = peripheral_spi_close(spi_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
else if (!strcmp(model, "artik"))
port = UART_PORT_ARTIK530;
else
else if (!strcmp(model, "artik"))
port = UART_PORT_ARTIK530;
else
+ return PERIPHERAL_ERROR_NO_DEVICE;
+ return PERIPHERAL_ERROR_NONE;
}
int test_peripheral_io_uart_peripheral_uart_open_p(void)
}
int test_peripheral_io_uart_peripheral_uart_open_p(void)
if (g_feature == false) {
ret = peripheral_uart_open(port, &uart_h);
if (g_feature == false) {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_close(uart_h);
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_open(UART_PORT_INVALID, &uart_h);
if (g_feature == false) {
ret = peripheral_uart_open(UART_PORT_INVALID, &uart_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(UART_PORT_INVALID, &uart_h);
} else {
ret = peripheral_uart_open(UART_PORT_INVALID, &uart_h);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_open(port, NULL);
if (g_feature == false) {
ret = peripheral_uart_open(port, NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, NULL);
} else {
ret = peripheral_uart_open(port, NULL);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_close(uart_h);
if (g_feature == false) {
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_close(uart_h);
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_close(NULL);
if (g_feature == false) {
ret = peripheral_uart_close(NULL);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_close(NULL);
} else {
ret = peripheral_uart_close(NULL);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_0);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_0);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_0);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_0);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_50);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_50);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_50);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_50);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_110);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_110);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_110);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_110);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_134);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_134);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_134);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_134);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_150);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_150);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_150);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_150);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_200);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_200);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_200);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_200);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_300);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_300);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_300);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_300);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_600);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_600);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_600);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_600);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_1200);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_1200);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_1200);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_1200);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_1800);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_1800);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_1800);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_1800);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_2400);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_2400);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_2400);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_2400);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_4800);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_4800);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_4800);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_4800);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_9600);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_9600);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_9600);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_9600);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_19200);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_19200);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_19200);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_19200);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_38400);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_38400);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_38400);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_38400);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_57600);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_57600);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_57600);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_57600);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_115200);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_115200);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_115200);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_115200);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_230400);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_230400);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_230400);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_230400);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(NULL, PERIPHERAL_UART_BAUD_RATE_1200);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(NULL, PERIPHERAL_UART_BAUD_RATE_1200);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_set_baud_rate(NULL, PERIPHERAL_UART_BAUD_RATE_1200);
} else {
ret = peripheral_uart_set_baud_rate(NULL, PERIPHERAL_UART_BAUD_RATE_1200);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_0 - 1);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_0 - 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_0 - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_0 - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_230400 + 1);
if (g_feature == false) {
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_230400 + 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_230400 + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_230400 + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_5BIT);
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_5BIT);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_5BIT);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_5BIT);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_6BIT);
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_6BIT);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_6BIT);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_6BIT);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_7BIT);
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_7BIT);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_7BIT);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_7BIT);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_8BIT);
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_8BIT);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_8BIT);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_8BIT);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(NULL, PERIPHERAL_UART_BYTE_SIZE_5BIT);
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(NULL, PERIPHERAL_UART_BYTE_SIZE_5BIT);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_set_byte_size(NULL, PERIPHERAL_UART_BYTE_SIZE_5BIT);
} else {
ret = peripheral_uart_set_byte_size(NULL, PERIPHERAL_UART_BYTE_SIZE_5BIT);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_5BIT - 1);
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_5BIT - 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_5BIT - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_5BIT - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_8BIT + 1);
if (g_feature == false) {
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_8BIT + 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_8BIT + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_8BIT + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_NONE);
if (g_feature == false) {
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_NONE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_NONE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_NONE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_EVEN);
if (g_feature == false) {
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_EVEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_EVEN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_EVEN);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_ODD);
if (g_feature == false) {
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_ODD);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_ODD);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_ODD);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_parity(NULL, PERIPHERAL_UART_PARITY_NONE);
if (g_feature == false) {
ret = peripheral_uart_set_parity(NULL, PERIPHERAL_UART_PARITY_NONE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_set_parity(NULL, PERIPHERAL_UART_PARITY_NONE);
} else {
ret = peripheral_uart_set_parity(NULL, PERIPHERAL_UART_PARITY_NONE);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_NONE - 1);
if (g_feature == false) {
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_NONE - 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_NONE - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_NONE - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_ODD + 1);
if (g_feature == false) {
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_ODD + 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_ODD + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_ODD + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_1BIT);
if (g_feature == false) {
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_1BIT);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_1BIT);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_1BIT);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_2BIT);
if (g_feature == false) {
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_2BIT);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_2BIT);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_2BIT);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_stop_bits(NULL, PERIPHERAL_UART_STOP_BITS_1BIT);
if (g_feature == false) {
ret = peripheral_uart_set_stop_bits(NULL, PERIPHERAL_UART_STOP_BITS_1BIT);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_set_stop_bits(NULL, PERIPHERAL_UART_STOP_BITS_1BIT);
} else {
ret = peripheral_uart_set_stop_bits(NULL, PERIPHERAL_UART_STOP_BITS_1BIT);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_1BIT - 1);
if (g_feature == false) {
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_1BIT - 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_1BIT - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_1BIT - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_2BIT + 1);
if (g_feature == false) {
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_2BIT + 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_2BIT + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_2BIT + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS);
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS);
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS);
if (ret != PERIPHERAL_ERROR_NONE) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(NULL, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(NULL, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_set_flow_control(NULL, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
} else {
ret = peripheral_uart_set_flow_control(NULL, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE - 1, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE - 1, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE - 1, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE - 1, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF + 1, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF + 1, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF + 1, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF + 1, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE - 1);
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE - 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE - 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF + 1);
if (g_feature == false) {
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF + 1);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF + 1);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_read(uart_h, data, UART_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_uart_read(uart_h, data, UART_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_read(uart_h, data, UART_BUFFER_LEN);
if (ret <= 0 && ret != PERIPHERAL_ERROR_TRY_AGAIN) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_read(uart_h, data, UART_BUFFER_LEN);
if (ret <= 0 && ret != PERIPHERAL_ERROR_TRY_AGAIN) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_read(NULL, data, UART_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_uart_read(NULL, data, UART_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_read(NULL, data, UART_BUFFER_LEN);
} else {
ret = peripheral_uart_read(NULL, data, UART_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_read(uart_h, NULL, UART_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_uart_read(uart_h, NULL, UART_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_read(uart_h, NULL, UART_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_read(uart_h, NULL, UART_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_write(uart_h, data, UART_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_uart_write(uart_h, data, UART_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_write(uart_h, data, UART_BUFFER_LEN);
if (ret <= 0 && ret != PERIPHERAL_ERROR_TRY_AGAIN) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_write(uart_h, data, UART_BUFFER_LEN);
if (ret <= 0 && ret != PERIPHERAL_ERROR_TRY_AGAIN) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_write(NULL, data, UART_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_uart_write(NULL, data, UART_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_write(NULL, data, UART_BUFFER_LEN);
} else {
ret = peripheral_uart_write(NULL, data, UART_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;
if (g_feature == false) {
ret = peripheral_uart_write(uart_h, NULL, UART_BUFFER_LEN);
if (g_feature == false) {
ret = peripheral_uart_write(uart_h, NULL, UART_BUFFER_LEN);
- if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED)
+ return ret;
} else {
ret = peripheral_uart_open(port, &uart_h);
} else {
ret = peripheral_uart_open(port, &uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
ret = peripheral_uart_write(uart_h, NULL, UART_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
ret = peripheral_uart_write(uart_h, NULL, UART_BUFFER_LEN);
if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
peripheral_uart_close(uart_h);
- return PERIPHERAL_ERROR_UNKNOWN;
}
ret = peripheral_uart_close(uart_h);
}
ret = peripheral_uart_close(uart_h);
- if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+ if (ret != PERIPHERAL_ERROR_NONE)
+ return ret;
}
return PERIPHERAL_ERROR_NONE;
}
return PERIPHERAL_ERROR_NONE;