驱动开发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");

效果演示

相关推荐
世微 如初13 天前
AP5125大功率LED恒流驱动实战:地摊灯项目从原理图到调试笔记
驱动开发·芯片·led电源驱动·降压恒流ic
ScilogyHunter13 天前
Zephyr串口驱动开发及构建完全指南
驱动开发·uart·zephyr
_Emma_13 天前
【DRM&Graphic】Linux图形与显示框架
linux·驱动开发·图形渲染·显示器
董厂长13 天前
Loop Engineering:停止手动提示,开始设计自动提示的系统
大数据·人工智能·驱动开发·llm
Saniffer_SH14 天前
【高清视频】Gen6 服务器还没到,Gen6 SSD 怎么测?Emily 现场演示三种测试环境
人工智能·驱动开发·测试工具·缓存·fpga开发·计算机外设·压力测试
暮云星影14 天前
全志linux开发屏幕适配(二)`HDMI`驱动适配说明
linux·arm开发·驱动开发
charlie11451419114 天前
嵌入式Linux驱动开发——从轮询到中断
linux·开发语言·驱动开发·嵌入式
暮云星影14 天前
瑞芯微rk3566开发FIT Secure Boot
linux·arm开发·驱动开发·安全
暮云星影14 天前
全志linux开发 USB接口设置
linux·arm开发·驱动开发
sukalot14 天前
windows显示驱动开发-CCD DDI的其它技术
windows·驱动开发