MCPcopy Create free account
hub / github.com/RizeCrime/linuxblaster_control / output_set

Function output_set

src/features.rs:852–876  ·  view source on GitHub ↗
(feature: &Feature, value: f32)

Source from the content-addressed store, hash-verified

850}
851
852fn output_set(feature: &Feature, value: f32) {
853 let mode = if value > 0.0 { 0x04u8 } else { 0x02u8 };
854
855 debug!("Setting output: mode 0x{:02x}", mode);
856
857 let mut payload = [0u8; 65];
858 payload[1] = 0x5a;
859 payload[2] = 0x2c;
860 payload[3] = 0x05;
861 payload[4] = 0x00;
862 payload[5] = mode;
863 payload[6] = 0x00;
864 payload[7] = 0x00;
865 payload[8] = 0x00;
866
867 DEVICE_CONNECTION
868 .get()
869 .expect("Device connection must be initialized")
870 .lock()
871 .unwrap()
872 .write(&payload)
873 .expect("Failed to send write to device");
874
875 read_ack();
876}

Callers

nothing calls this directly

Calls 1

read_ackFunction · 0.85

Tested by

no test coverage detected