Crate mii

Crate mii 

Source
Expand description

A no-std, hardware-agnostic library for serializing Monome II protocol commands.

This crate provides type-safe structures for II-protocol commands for various Eurorack modules. Its sole purpose is to serialize these high-level commands into the correct byte sequences. It does not handle I2C communication itself.

§Usage

  1. Choose a module from the library, like er301.
  2. Instantiate a command enum, e.g., er301::Commands::SetCv { ... }.
  3. Create a buffer to hold the serialized message. The Command::MAX_LENGTH associated constant can help you size this appropriately.
  4. Call the .to_bytes() method on your command object.
  5. If successful, you get a byte slice ready to be sent over I2C.

§Example

use mii::{Command, devices::ansible};

let mut buffer = [0u8; ansible::Commands::MAX_LENGTH];

// Set CV output
let cv_cmd = ansible::Commands::SetCv { port: 0, value: 4096 };
let message = cv_cmd.to_bytes(&mut buffer).unwrap();
// Send message over I2C to ansible::ADDRESS (0x20)

// Trigger pulse
let pulse_cmd = ansible::Commands::SetTrPulse { port: 1 };
let message = pulse_cmd.to_bytes(&mut buffer).unwrap();
// Send message over I2C to ansible::ADDRESS (0x20)

Modules§

devices

Enums§

SerializationError
Represents errors that can occur during command serialization.

Traits§

Command
The core trait for any object that can be serialized into an II-compatible byte message.