打印
[研电赛技术支持]

关于adc_inserted_channel_offset_config函数bug修改

[复制链接]
672|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
阿尔法猫|  楼主 | 2020-5-21 18:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
gd32E系列的adc_inserted_channel_offset_config的函数设置有问题。应该改成
/*!
    \brief      configure ADC inserted channel offset
    \param[in]  adc_periph: ADCx,x=0,1
    \param[in]  inserted_channel : insert channel select
                only one parameter can be selected which is shown as below:
      \arg        ADC_INSERTED_CHANNEL_0: inserted channel0
      \arg        ADC_INSERTED_CHANNEL_1: inserted channel1
      \arg        ADC_INSERTED_CHANNEL_2: inserted channel2
      \arg        ADC_INSERTED_CHANNEL_3: inserted channel3
    \param[in]  offset : the offset data
    \param[out] none
    \retval     none
*/
void adc_inserted_channel_offset_config(uint32_t adc_periph , uint8_t inserted_channel , uint16_t offset)
{
    uint32_t num = 0U;
   
    num = ((uint32_t)ADC_OFFSET_LENGTH - (uint32_t)inserted_channel);
   
    if(num <= ADC_OFFSET_LENGTH){
        /* calculate the offset of the register */
        num = num * ADC_OFFSET_SHIFT_LENGTH;
        /* config the offset of the selected channels */
        REG32((adc_periph) + 0x14U + num) = IOFFX_IOFF((uint32_t)offset);
    }  
}
希望能帮到遇到这个问题的人。

使用特权

评论回复
沙发
〽️〽️〽️| | 2020-8-28 21:05 | 只看该作者
虽然暂时用不到,但还是要给楼主顶个赞

使用特权

评论回复
板凳
lvben5d| | 2020-8-29 14:48 | 只看该作者
先查看下  库版本是否是最新的,然后要是发现有BUG,  请致电跟GD的技术支持沟通反馈。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

1

帖子

0

粉丝