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

效果演示

相关推荐
雾削木21 小时前
树莓派 ESPHome 固件编译与烧录全攻略(解决超时与串口识别问题)
驱动开发
春日见2 天前
win11 分屏设置
java·开发语言·驱动开发·docker·单例模式·计算机外设
DarkAthena2 天前
【GaussDB】手动编译不同python版本的psycopg2驱动以适配airflow
驱动开发·python·gaussdb
松涛和鸣2 天前
DAY66 SPI Driver for ADXL345 Accelerometer
linux·网络·arm开发·数据库·驱动开发
嵌入式郑工3 天前
# RK3576 平台 RTC 时钟调试全过程
linux·驱动开发·ubuntu
GS8FG3 天前
针对Linux,RK3568平台下,I2C驱动的一点小小的领悟
linux·驱动开发
一路往蓝-Anbo3 天前
第 4 篇:策略模式 (Strategy) —— 算法的热插拔艺术
网络·驱动开发·stm32·嵌入式硬件·算法·系统架构·策略模式
A-花开堪折3 天前
RK3568 Android 11 驱动开发(五):串口驱动适配
驱动开发
bandaoyu4 天前
【RDMA】rdma指令
驱动开发
2301_772204284 天前
LCD驱动开发:行场扫描与时序
驱动开发