博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux 内核设备驱动之GPIO驱动之GPIO 获取GPIO方向
阅读量:4153 次
发布时间:2019-05-25

本文共 727 字,大约阅读时间需要 2 分钟。

 
 
/** * gpiod_get_direction - return the current direction of a GPIO * @desc: GPIO to get the direction of * * Return GPIOF_DIR_IN or GPIOF_DIR_OUT, or an error code in case of error. * * This function may sleep if gpiod_cansleep() is true. */int gpiod_get_direction(struct gpio_desc *desc){ struct gpio_chip *chip; unsigned  offset; int   status = -EINVAL;  chip = gpiod_to_chip(desc); offset = gpio_chip_hwgpio(desc);  if (!chip->get_direction)  return status;  status = chip->get_direction(chip, offset); if (status > 0) {  /* GPIOF_DIR_IN, or other positive */  status = 1;  clear_bit(FLAG_IS_OUT, &desc->flags); } if (status == 0) {  /* GPIOF_DIR_OUT */  set_bit(FLAG_IS_OUT, &desc->flags); } return status;}
 
 
 
 
 
 

转载地址:http://sgqti.baihongyu.com/

你可能感兴趣的文章
Canny边缘检测算法原理及其OpenCV实现
查看>>
JupyterLab on JupyterHub(JupyterLab+JupyterHub)(JupyterLab JupyterHub)
查看>>
Ubuntu查找文件或文件夹
查看>>
DIGITS安装及服务部署
查看>>
利用Python脚本开发Hadoop的MapReduce大数据分析应用
查看>>
python连接SQL数据库
查看>>
python创建mysql数据库中的表
查看>>
python操作mysql表格-插入数据
查看>>
python更新mysql表
查看>>
python删除mysql表中数据
查看>>
python查询mysql表
查看>>
Win10安装MongoDB及基本配置
查看>>
MongoDB常用命令
查看>>
Win安装Redis2.4.11
查看>>
Ubuntu常用进程相关命令(转载)
查看>>
jupyterhub解决error: Uncaught Exception: listen EADDRINUSE: address already in use 127.0.0.1:8001相关问题
查看>>
neo4j web界面执行CQL报Error18 SecurityError解决方法
查看>>
win10安装neo4j及其基本使用
查看>>
Ubuntu安装neo4j
查看>>
Ubuntu部署Neo4j远程服务
查看>>