2 个版本
0.1.1 | 2022年6月14日 |
---|---|
0.1.0 | 2022年6月14日 |
#519 in Hardware support
17KB
326 lines
This crate provides a library to send data on DMX channels when using a Velleman vm116 (also known as K8062 DMX Controller).
It should also be compatible with Whadda WML116 (which seems to be the same product, just renamed).
Library inspired by the one found in Velleman SDK (which was in Pascal).
This library has been tested on Linux (Ubuntu 22.04
), Raspberry Pi (Raspbian GNU/Linux 11 (bullseye)
) and MacOS (High Sierra, 10.13.6
)
目标
Control various equipments (typically lighting, smoke emitters,...) connected with the DMX protocol (and DMX cables) to a USB controller VM116.
The device is reported (eg: by executing lsusb
) as having those IDs
- Vendor ID: 0x10cf
- Product ID: 0x8062
ID 10cf:8062 Velleman Components, Inc. K8062 DMX Controller Rev 3.0
Inspiration & sources
- https://www.velleman.eu/downloads/files/downloads/k8062_dll_source.zip and its translation in C
- https://www.velleman.eu/support/downloads/?code=WML116
- http://k8062forlinux.sourceforge.net/
Basic usage
See in the 'examples' folder
# fn main() -> Result<(), libvm116::Vm116Error> {
use libvm116::prelude::*;
let vm116 = Vm116::new()?;
let mut dmx_state = DmxState::new(512)?;
dmx_state.set(1, 255)?;
dmx_state.set(2, 0)?;
dmx_state.set(3, 255)?;
vm116.send(&dmx_state)?;
# Ok(())
# }
Cross-compilation for Raspberry Pi
Initial setup
The script install_raspberry.sh
can be used to cross-compile for the Raspberry Pi in a docker image.
- install
docker
- install
cross
(to help cross-compile)
./install_raspberry.sh setup:install-cross
- build the initial docker image
./install_raspberry.sh setup:build-docker-image
Updates
- Edit
install_raspberry.sh
to write the address of the Pi on the network - Rebuild
./install_raspberry.sh build
- Send to the Pi
./install_raspberry.sh scp
- Run on the Pi, eg
ssh [email protected]
./scenario scenario.txt
Since env_logger
is used, you might run
export RUST_LOG=debug
before running the scenario
program to get some debuggin logs.
Authorization & udev (Linux & Raspberry Pi)
With Linux (i86 and Raspberry Pi), in case of permission problems (reported as 'FailedToOpenDevice'), make a new file /etc/udev/rules.d/vm116.rules
with the following content
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="10cf", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="10cf", MODE="0666"
您需要拔掉并重新插上设备才能使此操作生效。
请注意,这将允许任何本地用户使用该设备。如果您的机器是共享的,您可能希望限制这些权限!有关详细信息,请参阅https://linuxkernel.org.cn/pub/linux/utils/kernel/hotplug/udev/udev.html。
依赖项
~320–590KB
~13K SLoC