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


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.
尊敬的先生/女士:
我使用基于定制板的 CC1312R1。 在 SysConfig 上配置 GPIO 后会立即生成 ti_drivers_config.h 文件并构建工程。 当我查看 ti_drivers_config.h 文件时、我看到 LED 处于 高电平有效状态。 如何更改它?
SysConfig 和生成文件 ti_drivers_config.h 中的 LED 配置如下所示。


您好 Arthur、
我已经尝试过、LED 开始在开启状态下工作。 但我希望它们从启动状态开始并使用 GPIO_WRITE 函数更改它们的状态。
在我想使用命令更改状态时顺便说一句 GPIO_WRITE (CONFIG_GPIO_LED_RED、CONFIG_GPIO_LED_ON); LED 熄灭。
此外、我在 SysConfig 中尝试了反转选项、但不适合我的使用。
此致、
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