STM32MP157A驱动开发 | 01- 板载LED作为系统心跳指示灯

网友投稿 364 2022-09-04

STM32MP157A驱动开发 | 01- 板载LED作为系统心跳指示灯

一、板载LED

此用户LED连接到PA13。

二、pinctrl描述

绑定文档:Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml。

必要的属性:

- compatible - '#address-cells' - '#size-cells' - ranges - pins-are-numbered

可用值如下:

: enum: - st,stm32f429-pinctrl - st,stm32f469-pinctrl - st,stm32f746-pinctrl - st,stm32f769-pinctrl - st,stm32h743-pinctrl - st,stm32mp157-pinctrl - st,stm32mp157-z-pinctrl '#address-cells': const: 1 '#size-cells': const: 1 ranges: true pins-are-numbered:

文档里给出了一个描述串口引脚的示例:

{ usart1_pins_a: usart1-0 { pins1 { pinmux = ; bias-disable; drive-push-pull; slew-rate = <0>; }; pins2 { pinmux = ; bias-disable; }; }; }; usart1 { pinctrl-0 = <&usart1_pins_a>; pinctrl-names = "default"; };

二、作为用户LED

1. 设备树描述

添加pinctrl描述,将PA13作为普通gpio:

&pinctrl { led_pins_a: led-0 { pins { pinmux = ; /* USER_LED */ }; };};

添加led节点描述:

{ compatible = "gpio-leds"; pinctrl-0 = <&led_pins_a>; blue { label = "blue"; gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; default-state = "off"; }; };

2. 测试

重新编译设备树,启动。

三、作为系统心跳LED

{ compatible = "gpio-leds"; pinctrl-0 = <&led_pins_a>; heartled { label = "heartled"; gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; linux,default-trigger = "heartbeat"; default-state = "off"; }; };

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:centOS7.3 安装启用 iptables 记录
下一篇:曲柄滑块机构运动分析和参数优化
相关文章

 发表评论

暂时没有评论,来抢沙发吧~