RT-Thread / RT-Thread/rt-thread

文档中心设备驱动DAC的示例函数输入有错误

Open
#6,568 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

示例中

    /* 设置输出值 */
    value = atoi(argv[1]);
    rt_dac_write(dac_dev, DAC_DEV_NAME, DAC_DEV_CHANNEL, &value);
    rt_kprintf("the value is :%d \n", value);

函数原型为

rt_uint32_t rt_dac_write(rt_dac_device_t dev, rt_uint32_t channel, rt_uint32_t value)
{
    RT_ASSERT(dev);

    dev->ops->convert(dev, channel, &value);

    return RT_EOK;
}

第三个参数应去掉&符号,应改为:

    /* 设置输出值 */
    value = atoi(argv[1]);
    rt_dac_write(dac_dev, DAC_DEV_NAME, DAC_DEV_CHANNEL, value);
    rt_kprintf("the value is :%d \n", value);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the documentation-center DAC device-driver example containing the rt_dac_write call, then compare it with the rt_dac_write prototype shown in the issue. Correct the example's argument usage and confirm the documented call matches the referenced function signature.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
documentation, embedded-iot
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.