Compare commits

4 Commits

Author SHA1 Message Date
MacRsh
d1af97b42d fix(bsp/st/driver): Fix bugs in STM32 PIN and PWM device drivers.
1.Fixed the bug where PIN was missing an if judgment condition(thanks to 'Zuosir').
2.Fix the PWM parameter detection error (Thanks to '决浮云').
2025-08-13 22:51:54 +08:00
MacRsh
c945804480 fix(serial,drv_pin): 修复serial方法检查错误,修复PIN驱动中断关闭错误
感谢Lucas反馈问题
2025-04-07 19:50:46 +08:00
MacRsh
8cfcbfedf8 fix(msh): Fixed command identification errors.
1.Originally, "strncmp" was used, and the length was command length, and when the input was the same as the length of the command, the condition was passed incorrectly, causing a problem (feedback from "下一站 还是站").
2024-12-19 23:34:29 +08:00
MacRsh
1c37dceb14 fix(spi): 修复SPI同步传输错误
1. 修复SPI-IOCTL中同步传输spi_dev_transfer参数错误("dev->parent"应为"spi_dev"),感谢“我姓朱i”的反馈。
2024-08-12 21:21:05 +08:00
6 changed files with 18 additions and 8 deletions

View File

@@ -192,7 +192,7 @@ static int drv_pin_configure(struct mr_pin *pin, int number, int mode)
{
HAL_NVIC_DisableIRQ(pin_irq_map[exti_line]);
}
} else
} else if ((exti_line >= 10) && (exti_line <= 15))
{
if ((pin_irq_mask[10] == -1) &&
(pin_irq_mask[11] == -1) &&
@@ -203,6 +203,9 @@ static int drv_pin_configure(struct mr_pin *pin, int number, int mode)
{
HAL_NVIC_DisableIRQ(pin_irq_map[exti_line]);
}
} else
{
HAL_NVIC_DisableIRQ(pin_irq_map[exti_line]);
}
pin_irq_mask[exti_line] = -1;
}

View File

@@ -303,7 +303,7 @@ static int drv_pwm_read(struct mr_pwm *pwm, int channel, uint32_t *compare_value
uint32_t Channel = (channel - 1) << 2;
#ifdef MR_USING_PWM_CHANNEL_CHECK
if ((Channel & TIM_CHANNEL_ALL) || (Channel == 0))
if (Channel & TIM_CHANNEL_ALL)
{
return MR_EINVAL;
}
@@ -319,7 +319,7 @@ static int drv_pwm_write(struct mr_pwm *pwm, int channel, uint32_t compare_value
uint32_t Channel = (channel - 1) << 2;
#ifdef MR_USING_PWM_CHANNEL_CHECK
if ((Channel & TIM_CHANNEL_ALL) || (Channel == 0))
if (Channel & TIM_CHANNEL_ALL)
{
return MR_EINVAL;
}

View File

@@ -220,7 +220,7 @@ static int drv_pin_configure(struct mr_pin *pin, int number, int mode)
{
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
}
} else
} else if ((exti_line >= 10) && (exti_line <= 15))
{
if ((pin_irq_mask[10] == -1) &&
(pin_irq_mask[11] == -1) &&
@@ -234,6 +234,9 @@ static int drv_pin_configure(struct mr_pin *pin, int number, int mode)
{
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
}
} else
{
EXTI_InitStructure.EXTI_LineCmd = DISABLE;
}
#endif /* MR_USING_CH32V00X */
pin_irq_mask[exti_line] = -1;

View File

@@ -235,7 +235,7 @@ MR_INLINE void msh_parse_cmd(void)
for (const struct mr_msh_cmd *msh_cmd = ((&_mr_msh_cmd_start) + 1);
msh_cmd < &_mr_msh_cmd_end;
msh_cmd++) {
if (strncmp(msh_cmd->name, msh.buf, strlen(msh_cmd->name)) != 0) {
if (strcmp(msh_cmd->name, msh.buf) != 0) {
continue;
}

View File

@@ -276,7 +276,7 @@ static int mr_serial_ioctl(struct mr_dev *dev, int cmd, void *args)
if (args != MR_NULL) {
size_t bufsz = *(size_t *)args;
if (ops->stop_dma_rx) {
if (ops->stop_dma_rx == MR_NULL) {
return MR_EIO;
}
ops->stop_dma_rx(serial);
@@ -299,6 +299,10 @@ static int mr_serial_ioctl(struct mr_dev *dev, int cmd, void *args)
if (args != MR_NULL) {
size_t bufsz = *(size_t *)args;
if (serial->nonblock_state != MR_DISABLE) {
return MR_EBUSY;
}
uint8_t *pool = mr_realloc(serial->dma_wr_buf, bufsz);
if ((pool == MR_NULL) && (bufsz != 0)) {
return MR_ENOMEM;

View File

@@ -425,14 +425,14 @@ static int mr_spi_dev_ioctl(struct mr_dev *dev, int cmd, void *args)
if (spi_dev->config.host_slave == MR_SPI_HOST) {
spi_dev_cs_set(spi_dev, MR_ENABLE);
ret = (int)spi_dev_transfer(dev->parent,
ret = (int)spi_dev_transfer(spi_dev,
transfer.rd_buf,
transfer.wr_buf,
transfer.size,
MR_SPI_RDWR);
spi_dev_cs_set(spi_dev, MR_DISABLE);
} else {
ret = (int)spi_dev_transfer(dev->parent,
ret = (int)spi_dev_transfer(spi_dev,
transfer.rd_buf,
transfer.wr_buf,
transfer.size,