Skip to content

Commit

Permalink
examples: vfd: Add a few more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahix committed May 6, 2024
1 parent fa0493c commit 0bef4c4
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion examples/vfd-micromaster-4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,30 @@ use profirust::dp;
use profirust::fdl;
use profirust::phy;

// Encoder Parameters
// VFD Parameters
const VFD_ADDRESS: u8 = 17;

// Bus Parameters
const MASTER_ADDRESS: u8 = 4;
const BUS_DEVICE: &'static str = "/dev/ttyUSB0";
const BAUDRATE: profirust::Baudrate = profirust::Baudrate::B500000;

// PROFIdrive Telegram 1
// +--------+------+---------+
// | | 0 | 1 |
// +--------+------+---------+
// | Output | STW1 | NSOLL_A |
// +--------+------+---------+
// | Input | ZSW1 | NIST_A |
// +--------+------+---------+
//
// - STW1: Control Word 1
// - ZSW1: Status Word 1
// - NSOLL_A: Speed Setpoint
// - NIST_A: Speed Actual Value
process_image::process_image! {
pub struct PiDriveControl, mut PiDriveControlMut: 4 {
// STW1 (Control Word 1) Bits
pub on: (X, 1, 0),
pub not_off2: (X, 1, 1),
pub not_off3: (X, 1, 2),
Expand All @@ -34,6 +48,7 @@ process_image::process_image! {

process_image::process_image! {
pub struct PiDriveStatus: 4 {
// ZSW1 (Status Word 1) Bits
pub ready_for_on: (X, 1, 0),
pub ready_to_run: (X, 1, 1),
pub op_enabled: (X, 1, 2),
Expand Down

0 comments on commit 0bef4c4

Please sign in to comment.