1.优化错误码,默认为负。
This commit is contained in:
@@ -41,7 +41,7 @@ static mr_err_t drv_dac_configure(mr_dac_t dac, mr_state_t state)
|
||||
break;
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
DAC_InitStructure.DAC_Trigger = DAC_Trigger_None;
|
||||
@@ -71,7 +71,7 @@ static mr_err_t drv_dac_channel_configure(mr_dac_t dac, mr_dac_config_t config)
|
||||
break;
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
if (config->channel._mask != 0)
|
||||
|
||||
@@ -65,7 +65,7 @@ static mr_err_t drv_pin_configure(mr_pin_t pin, mr_pin_config_t config)
|
||||
|
||||
if (config->number < 0)
|
||||
{
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
RCC_APB2PeriphClockCmd(PIN_RCC(config->number), ENABLE);
|
||||
@@ -134,7 +134,7 @@ static mr_err_t drv_pin_configure(mr_pin_t pin, mr_pin_config_t config)
|
||||
{
|
||||
if ((irq_mask[exti_line] != -1 && irq_mask[exti_line] != config->number))
|
||||
{
|
||||
return -MR_ERR_BUSY;
|
||||
return MR_ERR_BUSY;
|
||||
}
|
||||
|
||||
irq_mask[exti_line] = config->number;
|
||||
|
||||
@@ -115,4 +115,4 @@ mr_err_t drv_pwm_init(void)
|
||||
}
|
||||
MR_INIT_DRIVER_EXPORT(drv_pwm_init);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -141,7 +141,7 @@ static mr_err_t drv_spi_configure(mr_spi_bus_t spi_bus, mr_spi_config_t config)
|
||||
}
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
switch (config->mode)
|
||||
@@ -175,7 +175,7 @@ static mr_err_t drv_spi_configure(mr_spi_bus_t spi_bus, mr_spi_config_t config)
|
||||
}
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
switch (config->data_bits)
|
||||
@@ -193,7 +193,7 @@ static mr_err_t drv_spi_configure(mr_spi_bus_t spi_bus, mr_spi_config_t config)
|
||||
}
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
switch (config->bit_order)
|
||||
@@ -211,7 +211,7 @@ static mr_err_t drv_spi_configure(mr_spi_bus_t spi_bus, mr_spi_config_t config)
|
||||
}
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
switch (config->cs_active)
|
||||
@@ -230,7 +230,7 @@ static mr_err_t drv_spi_configure(mr_spi_bus_t spi_bus, mr_spi_config_t config)
|
||||
}
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
NVIC_InitStructure.NVIC_IRQChannel = spi_bus_data->irqno;
|
||||
|
||||
@@ -147,7 +147,7 @@ static mr_err_t drv_timer_configure(mr_timer_t timer, mr_state_t state)
|
||||
}
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
NVIC_InitStructure.NVIC_IRQChannel = timer_data->irqno;
|
||||
|
||||
@@ -118,7 +118,7 @@ static mr_err_t drv_serial_configure(mr_serial_t serial, struct mr_serial_config
|
||||
}
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
switch (config->stop_bits)
|
||||
@@ -136,7 +136,7 @@ static mr_err_t drv_serial_configure(mr_serial_t serial, struct mr_serial_config
|
||||
}
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
switch (config->parity)
|
||||
@@ -160,7 +160,7 @@ static mr_err_t drv_serial_configure(mr_serial_t serial, struct mr_serial_config
|
||||
}
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
switch (config->bit_order)
|
||||
@@ -171,7 +171,7 @@ static mr_err_t drv_serial_configure(mr_serial_t serial, struct mr_serial_config
|
||||
}
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
switch (config->invert)
|
||||
@@ -182,7 +182,7 @@ static mr_err_t drv_serial_configure(mr_serial_t serial, struct mr_serial_config
|
||||
}
|
||||
|
||||
default:
|
||||
return -MR_ERR_INVALID;
|
||||
return MR_ERR_INVALID;
|
||||
}
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = uart_data->tx_gpio_pin;
|
||||
|
||||
Reference in New Issue
Block a user