This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] 如何在 ti_drivers_config 中将 LED&#39状态更改为低电平有效?

Guru**** 2563960 points
Other Parts Discussed in Thread: SYSCONFIG, CC1312R

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1208611/how-to-change-led-s-status-as-active-low-in-ti_drivers_config

主题中讨论的其他器件:SysConfigCC1312R

尊敬的先生/女士:

我使用基于定制板的 CC1312R1。 在 SysConfig 上配置 GPIO 后会立即生成 ti_drivers_config.h 文件并构建工程。 当我查看 ti_drivers_config.h 文件时、我看到 LED 处于 高电平有效状态。 如何更改它?

SysConfig 和生成文件 ti_drivers_config.h 中的 LED 配置如下所示。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    您是否已尝试在 SysConfig 中将"Initial Output State"设置为低电平?

    此致、

    Arthur

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Arthur、

    我已经尝试过、LED 开始在开启状态下工作。 但我希望它们从启动状态开始并使用 GPIO_WRITE 函数更改它们的状态。

    在我想使用命令更改状态时顺便说一句  GPIO_WRITE (CONFIG_GPIO_LED_RED、CONFIG_GPIO_LED_ON);  LED 熄灭。

    此外、我在 SysConfig 中尝试了反转选项、但不适合我的使用。

    此致、

    Veli Can

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Veli:

    您能演示一下电路板上的 LED 是如何布线的吗?

    此致、

    Arthur

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Arthur、您好!

    就像这样。 RGB_R 为 DIO38、RGB_B 为 DIO39、RGB_G 为 DIO40。

    此致、

    Veli Can

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    我看到、根据 CC1312R 数据表的表7.1、引脚38、39和40实际上表示 DIO_25、DIO_26和 DIO_27。
    顺便说一下、我认为 LED 的电流吸收太高了。

    该器件的技术参考手册(表13-2)指出这些引脚可驱动的最大电流为4mA。

    如果要尝试将引脚初始化为高电平、此处是对空项目的修改。

    /*
     * Copyright (c) 2015-2019, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== empty.c ========
     */
    
    /* For usleep() */
    #include <unistd.h>
    #include <stdint.h>
    #include <stddef.h>
    
    /* Driver Header files */
    #include <ti/drivers/GPIO.h>
    // #include <ti/drivers/I2C.h>
    // #include <ti/drivers/SPI.h>
    // #include <ti/drivers/Watchdog.h>
    
    /* Driver configuration */
    #include "ti_drivers_config.h"
    
    /*
     *  ======== mainThread ========
     */
    void *mainThread(void *arg0)
    {
        /* 1 second delay */
        uint32_t time = 1;
    
        /* Call driver init functions */
        GPIO_init();
        // I2C_init();
        // SPI_init();
        // Watchdog_init();
    
        /* Configure the LED pin */
        //GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    
        /* Turn on user LED */
        //GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
    
        while (1)
        {
            sleep(time);
            //GPIO_toggle(CONFIG_GPIO_LED_0);
        }
    }
    

    包含以下 SysConfig:

    您会发现该引脚以高电平状态启动。

    此致、

    Arthur

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Arthur、您好!  

    感谢您的建议。 我通过使用 LED 驱动器而不是 GPIO 解决了问题。  

    初始状态为 低电平、启用值反转并解决问题。

    非常感谢。

    此致、

    Veli Can