已解决
驱动开发11-2 编写SPI驱动程序-点亮数码管
来自网友在路上 184884提问 提问时间:2023-11-03 00:39:00阅读次数: 84
最佳答案 问答题库848位专家为你答疑解惑
驱动程序
#include <linux/init.h>
#include <linux/module.h>
#include <linux/spi/spi.h>int m74hc595_probe(struct spi_device *spi)
{printk("%s:%d\n",__FILE__,__LINE__);char buf[]={0XF,0X6D};spi_write(spi,buf,sizeof(buf));return 0;
}
int m74hc595_remove(struct spi_device *spi)
{printk("%s:%d\n",__FILE__,__LINE__);return 0;
}
//设备树匹配表
struct of_device_id of_table[] = {{.compatible="hqyj,m74hc595"},{},
};
//定义SPI对象并初始化
struct spi_driver m74hc575 = {.probe = m74hc595_probe,.remove = m74hc595_remove,.driver = {.name = "m74hc595",.of_match_table = of_table,},
};
module_spi_driver(m74hc575);
MODULE_LICENSE("GPL");
效果演示
查看全文
99%的人还看了
相似问题
猜你感兴趣
版权申明
本文"驱动开发11-2 编写SPI驱动程序-点亮数码管":http://eshow365.cn/6-30647-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!