驱动开发11-2 编写SPI驱动程序-点亮数码管

驱动程序

cs 复制代码
#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");

效果演示

相关推荐
cen难取名10 小时前
驱动开发WDK(1)-环境准备和初始程序。详细教程
驱动开发·microsoft
怪怪王13 小时前
【GPU驱动】OpenGLES图形管线渲染机制
驱动开发·gpu·opengl
我爱蛋蛋后17 小时前
Linux驱动开发之音频驱动与基础应用编程
linux·c语言·驱动开发·音视频
马剑威(威哥爱编程)20 小时前
Linux驱动开发13个实用案例
linux·运维·驱动开发
sukalot21 小时前
Windows 图形显示驱动开发-上下文监视
驱动开发
W说编程3 天前
嵌入式Linux系统UART驱动移植专题详解(3000+字图文实战指南)
linux·c语言·驱动开发·嵌入式硬件
silent_dusbin3 天前
LCD Drive-IC ST7789V SPI-4line 调试
驱动开发
sukalot4 天前
Windows 图形显示驱动开发-WDDM 2.0 -GPU虚拟寻址概述
驱动开发
挥剑决浮云 -5 天前
Linux驱动层学习:LED 驱动开发
linux·驱动开发·笔记·学习
7yewh8 天前
嵌入式知识点总结 网络编程 专题提升(一)-TCP/UDP
网络·arm开发·驱动开发·物联网·网络协议·tcp/ip·udp