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.

[参考译文] TM4C123GH6PGE:如何在运行时重新配置引脚?

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1035872/tm4c123gh6pge-how-to-reconfigure-a-pin-at-run-time

器件型号:TM4C123GH6PGE

您好!

我有两个 timer4 CCP0信号源。 因此、我喜欢在这两个通道之间切换。

在 TI HAL 中、该函数

GPIOPinConfigure

存在。 我看不到任何东西

GPIOPinConfigureReset 或类似函数。

这将引导我进入一般性问题:如何重置引脚配置?

例如、我打印我的配置

// WT4CCP0 PH6
fan2_tacho: fan2_tacho {
	port = <&gpio_H>;
	pin = <6>;
	map = <0x00071807>;
	dirmode = "HW";
	strength = "2MA";
	type = "STD";
};

// T4CCP0 PG0
fan6_tacho: fan6_tacho {
	port = <&gpio_G>;
	pin = <0>;
	map = <0x00060007>;
	dirmode = "HW";
	strength = "2MA";
	type = "STD";
};

它位于我的 Zephir RTOS 引脚控制器的 devicetree 配置

我想它足以调用 GPIOPadConfigSet 函数并将引脚方向模式从 HW 设置为 IN

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

    您好 Stefan、

    那么、基本上通过复位、您要删除所做的配置吗?

    通常、在 您的情况下、处理 DirMode、Strength 和 Type 的单个 API 调用是 GPIOPinTypeTimer (因为这适用于 T4CCP0)。

    我们在 TivaWare 中实际上没有'set'或'default'函数、因此您可以做的是创建自己的函数、如'GPIOPinReset'、然后针对这两个 API 轻松执行所需的任何操作

        //
        // Make the pin(s) be peripheral controlled.
        //
        GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_IN);
    
        //
        // Set the pad(s) for standard push-pull operation.
        //
        GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);

    此致、

    Ralph Jacobi