蚂蚁S9矿板PS 配个iic屏显示ip

蚂蚁S9矿板PS 配个iic屏显示ip 参考蚂蚁S9矿板PS 用IIC总线框架自定义at24c02驱动.csdn蚂蚁S9矿板PS 自带的at24c02驱动测试.csdnESP32 波特律动oled.csdn香橙派zero3 交叉编译和cmake配置.csdn香橙派zero3配个iic屏显示ip.csdnBDPL参考 简易寄存器接口SMMR.csdnant_iic_uart_system.tclPIN.xdcset_property-dict{PACKAGE_PIN M17 IOSTANDARD LVCMOS33}[get_ports O_LED[0]]set_property-dict{PACKAGE_PIN M19 IOSTANDARD LVCMOS33}[get_ports O_LED[1]]set_property-dict{PACKAGE_PIN L19 IOSTANDARD LVCMOS33}[get_ports O_LED[2]]set_property-dict{PACKAGE_PIN F16 IOSTANDARD LVCMOS33}[get_ports O_LED[3]]set_property-dict{PACKAGE_PIN N17 IOSTANDARD LVCMOS33}[get_ports IIC_0_0_scl_io]set_property-dict{PACKAGE_PIN P18 IOSTANDARD LVCMOS33}[get_ports IIC_0_0_sda_io]set_property-dict{PACKAGE_PIN R18 IOSTANDARD LVCMOS33}[get_ports UART_0_0_rxd]set_property-dict{PACKAGE_PIN T17 IOSTANDARD LVCMOS33}[get_ports UART_0_0_txd]set_property-dict{PACKAGE_PIN F19 IOSTANDARD LVCMOS33}[get_ports i_key]设备树#include dt-bindings/gpio/gpio.h#include dt-bindings/input/input.h#include dt-bindings/media/xilinx-vip.h#include dt-bindings/phy/phy.h#include dt-bindings/interrupt-controller/irq.h/{modelz7 Board ant 789;compatiblexlnx,zynq-zc702,xlnx,zynq-7000;chosen{bootargsconsolettyPS0,115200 earlyconcdns,mmio,0xe0000000,115200n8 keep_bootcon earlyprintk root/dev/mmcblk0p2 rw rootwait;stdout-pathserial0:115200n8;};led{compatibleming,led;statusokay;default-stateon;led-gpiogpio037GPIO_ACTIVE_HIGH;};beeper{compatibleming,beeper;statusokay;default-stateoff;beeper-gpiogpio038GPIO_ACTIVE_HIGH;};keys{compatiblegpio-keys;autorepeat;gpio-key1{labelps_key1;gpiosgpio047GPIO_ACTIVE_LOW;linux,codeKEY_UP;gpio-key,wakeup;autorepeat;};gpio-key2{labelps_key2;gpiosgpio051GPIO_ACTIVE_LOW;linux,codeKEY_DOWN;gpio-key,wakeup;autorepeat;};};};i2c0{statusokay;};源码目录~$lsbuild font.cpp font.h main.cpp Makefile oled.cpp oled.h源码参考香橙派zero3配个iic屏显示ip.csdn注意 oled.cpp 里的设备文件 /dev/i2c-3 要更改voidOLED_Init(){printf(OLED_Init\n);g_fdopen(/dev/i2c-3, O_RDWR);if(g_fd0){perror(open);return;}...}Makefile 改为TARGETbuild/oled_demo SRCSmain.cpp\oled.cpp\font.cpp OBJS$(patsubst %.cpp,build/%.o,$(SRCS))all:$(TARGET)# 创建 build 目录build:mkdir-pbuild# 链接$(TARGET):build$(OBJS)$(CXX)-o$$(OBJS)# 编译build/%.o: %.cpp|build$(CXX)$(CXXFLAGS)-c$-o$# 清理clean:rm-rfbuild .PHONY: all clean build测试rootant:~# ls /dev/i2c-0/dev/i2c-0# 先探测一下oled# i2cdetect -y 0 不行,但 i2cdetect -y -r 0 可以rootant:~# i2cdetect -y -r 00123456789a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- --10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --# 前台启动rootant:~# ./oled_demoOLED_Initopenok ioctl ok IP Changed:192.168.1.104 -1.104# 后台启动rootant:~# nohup ./oled_demo oled.log 21 # 开机启动配置# 查看 /etc/init.d/rcSrootant:~# cat /etc/init.d/rcS#!/bin/sh## rcS Call all S??* scripts in /etc/rcS.d in# numerical/alphabetical order.## Version: (#)/etc/init.d/rcS 2.76 19-Apr-1999 miquelscistron.nl#PATH/sbin:/bin:/usr/sbin:/usr/binrunlevelSprevlevelNumask022exportPATHrunlevel prevlevel# Make sure proc is mounted#[-d/proc/1]||mount/proc## Source defaults.#./etc/default/rcS## Trap CTRL-C c only in this shell so we can interrupt subprocesses.#trap:INT QUIT TSTP## Call all parts in order.#exec/etc/init.d/rc Sexec/etc/init.d/rc S 表示进入S 运行级别single/user initialization 会去找 /etc/rcS.d/ 里的 S00xxx S01xxx S02xxx 顺序执行配置开机启动rootant:~# vi /etc/init.d/S99oled#!/bin/shcase$1instart)echoStarting oled_demo...cd/home/root ./oled_demo/tmp/oled.log21;;stop)echoStopping oled_demo...killalloled_demo;;esacexit0查看软连接rootant:~# ls -l /etc/rcS.d/total0lrwxrwxrwx1petalinu petalinu20May292025S00psplash.sh -../init.d/psplash.sh lrwxrwxrwx1petalinu petalinu19May292025S02banner.sh -../init.d/banner.sh lrwxrwxrwx1petalinu petalinu18May292025S02sysfs.sh -../init.d/sysfs.sh lrwxrwxrwx1petalinu petalinu21May292025S03mountall.sh -../init.d/mountall.sh lrwxrwxrwx1petalinu petalinu14May292025S04udev -../init.d/udev lrwxrwxrwx1petalinu petalinu21May292025S05modutils.sh -../init.d/modutils.sh lrwxrwxrwx1petalinu petalinu22May292025S06alignment.sh -../init.d/alignment.sh lrwxrwxrwx1petalinu petalinu22May292025S06checkroot.sh -../init.d/checkroot.sh lrwxrwxrwx1petalinu petalinu19May292025S06devpts.sh -../init.d/devpts.sh lrwxrwxrwx1petalinu petalinu18May292025S07bootlogd -../init.d/bootlogd lrwxrwxrwx1petalinu petalinu34May292025S29read-only-rootfs-hook.sh -../init.d/read-only-rootfs-hook.sh lrwxrwxrwx1petalinu petalinu21May292025S36bootmisc.sh -../init.d/bootmisc.sh lrwxrwxrwx1petalinu petalinu30May292025S37populate-volatile.sh -../init.d/populate-volatile.sh lrwxrwxrwx1petalinu petalinu18May292025S38dmesg.sh -../init.d/dmesg.sh lrwxrwxrwx1petalinu petalinu17May292025S38urandom -../init.d/urandom lrwxrwxrwx1petalinu petalinu21May292025S39hostname.sh -../init.d/hostname.sh创建软连接rootant:~# ln -s /etc/init.d/S99oled /etc/rcS.d/S99oled# 查看rootant:~# ls -l /etc/rcS.d/ | taillrwxrwxrwx1petalinu petalinu22May292025S06checkroot.sh -../init.d/checkroot.sh lrwxrwxrwx1petalinu petalinu19May292025S06devpts.sh -../init.d/devpts.sh lrwxrwxrwx1petalinu petalinu18May292025S07bootlogd -../init.d/bootlogd lrwxrwxrwx1petalinu petalinu34May292025S29read-only-rootfs-hook.sh -../init.d/read-only-rootfs-hook.sh lrwxrwxrwx1petalinu petalinu21May292025S36bootmisc.sh -../init.d/bootmisc.sh lrwxrwxrwx1petalinu petalinu30May292025S37populate-volatile.sh -../init.d/populate-volatile.sh lrwxrwxrwx1petalinu petalinu18May292025S38dmesg.sh -../init.d/dmesg.sh lrwxrwxrwx1petalinu petalinu17May292025S38urandom -../init.d/urandom lrwxrwxrwx1petalinu petalinu21May292025S39hostname.sh -../init.d/hostname.sh lrwxrwxrwx1root root19Aug22026S99oled -/etc/init.d/S99oledrootant:~# chmod x /etc/init.d/S99oled# 启动rootant:~# /etc/init.d/S99oled startStarting oled_demo...# 停止rootant:~# /etc/init.d/S99oled stopStopping oled_demo...