简体   繁体   English

如何检查 GPIO 端口的属性

[英]how to check for properties of GPIO ports

in my blinking LED operation i am using the following functions shown in the code bellow.在我闪烁的 LED 操作中,我正在使用下面代码中显示的以下功能。

when i send a command by UART to turn on an LED i want to know if its turned on or turned off in order to switch its state.当我通过 UART 发送命令打开 LED 时,我想知道它是打开还是关闭,以便切换它的 state。

I tried to look in the reference manual for GPIO properties,but this periphery is tricky i cant have some thing like "LED_PORT_A->STATE"我试图查看 GPIO 属性的参考手册,但是这个外围很棘手,我不能有像“LED_PORT_A->STATE”这样的东西

to see if its turned on or off.看看它是打开还是关闭。

Is there some thing i could do?有什么我可以做的吗?

Thanks.谢谢。

https://www.silabs.com/documents/public/reference-manuals/EFM32LG-RM.pdf https://www.silabs.com/documents/public/reference-manuals/EFM32LG-RM.pdf

GPIO_PinModeSet(LED_PORT_A,15,gpioModePushPull,0);
GPIO_PinOutSet(LED_PORT_E,15);
GPIO_PinOutClear(LED_PORT_A,15);

To get the current output level you can use unsigned int GPIO_PinOutGet(GPIO_Port_TypeDef port, unsigned int pin);要获取当前 output 级别,您可以使用unsigned int GPIO_PinOutGet(GPIO_Port_TypeDef port, unsigned int pin);

To toggle the current output level you can use void GPIO_PinOutToggle(GPIO_Port_TypeDef port, unsigned int pin);要切换当前 output 级别,您可以使用void GPIO_PinOutToggle(GPIO_Port_TypeDef port, unsigned int pin); . .

ie GPIO_PinOutToggle(LED_PORT_A,15);GPIO_PinOutToggle(LED_PORT_A,15);

For more information, the GPIO API documentation for the EFM32-LG is here .有关更多信息,请参阅此处的 EFM32-LG 的 GPIO API 文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM