(feature: &Feature, value: f32)
| 651 | } |
| 652 | |
| 653 | fn dsp_set(feature: &Feature, value: f32) { |
| 654 | let (family, feature_id) = feature |
| 655 | .id |
| 656 | .dsp_address() |
| 657 | .expect("dsp_set called on non-DSP feature"); |
| 658 | |
| 659 | debug!( |
| 660 | "Writing DSP feature: {} = {} (0x{:02x}:0x{:02x})", |
| 661 | feature.id, value, family, feature_id |
| 662 | ); |
| 663 | |
| 664 | let value_bytes = value.to_le_bytes(); |
| 665 | |
| 666 | let mut payload = [0u8; 65]; |
| 667 | payload[1] = 0x5a; |
| 668 | payload[2] = 0x12; |
| 669 | payload[3] = 0x07; |
| 670 | payload[4] = 0x01; |
| 671 | payload[5] = family; |
| 672 | payload[6] = feature_id; |
| 673 | payload[7..11].copy_from_slice(&value_bytes); |
| 674 | |
| 675 | DEVICE_CONNECTION |
| 676 | .get() |
| 677 | .expect("Device Connection must be initialized") |
| 678 | .lock() |
| 679 | .unwrap() |
| 680 | .write(&payload) |
| 681 | .expect("Failed to send Write to Device"); |
| 682 | |
| 683 | read_ack(); |
| 684 | } |
| 685 | |
| 686 | // ─── GlobalProfile Getter/Setter (0x26) ────────────────────────────────────── |
| 687 |
nothing calls this directly
no test coverage detected