初始提交:龙芯2K0300智能车卖家Demo完整代码

This commit is contained in:
spdis
2026-05-28 15:24:33 +08:00
commit b6b631cef3
80 changed files with 7153 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/bin/sh
# VL53L0X 激光测距初始化脚本
# GPIO 50=SCL, GPIO 51=SDA -> I2C2_SCL[1]/I2C2_SDA[1]
echo "[VL53L0X] === 检查/初始化激光测距 ==="
# 1. 检查设备节点是否已存在
if [ -c /dev/stmvl53l0x_ranging ]; then
echo "[VL53L0X] /dev/stmvl53l0x_ranging 已存在"
else
echo "[VL53L0X] /dev/stmvl53l0x_ranging 不存在,尝试加载驱动..."
modprobe stmvl53l0x 2>/dev/null || modprobe vl53l0x 2>/dev/null
if [ ! -c /dev/stmvl53l0x_ranging ]; then
echo "[VL53L0X] 驱动未加载,需要检查内核配置或设备树"
fi
fi
# 2. 设置 GPIO 50/51 为 I2C 功能(尝试通过 debugfs pinctrl
PINMUX=/sys/kernel/debug/pinctrl/zx296718-pinctrl
if [ -d "$PINMUX" ]; then
echo "[VL53L0X] pinctrl debugfs 可用: $PINMUX"
ls "$PINMUX"/
else
echo "[VL53L0X] pinctrl debugfs 不可用"
fi
# 3. 最终确认
if [ -c /dev/stmvl53l0x_ranging ]; then
echo "[VL53L0X] OK — 设备就绪,可以使用"
else
echo "[VL53L0X] FAIL — 需要先配置内核/设备树中的 I2C 引脚复用"
fi