Browse Source

enhance: doc 0x0c command; see-also #20

pull/28/head
Andelf 1 year ago
parent
commit
fab9cde672
  1. 19
      src/commands.rs
  2. 2
      src/operations.rs

19
src/commands.rs

@ -262,17 +262,32 @@ impl Command for Reset {
}
}
/// Speed settings
#[derive(Debug, Copy, Clone)]
pub enum Speed {
Low = 0x03,
Medium = 0x02,
High = 0x01,
VeryHigh = 0x00,
}
impl Default for Speed {
fn default() -> Self {
Speed::High
}
}
/// (0x0c, [riscvchip, 1/2/3])
pub struct SetTwoLineMode {
pub riscvchip: u8,
pub speed: u8, // 1, 2, 3
pub speed: Speed,
}
impl Command for SetTwoLineMode {
type Response = bool;
const COMMAND_ID: u8 = 0x0c;
fn payload(&self) -> Vec<u8> {
vec![self.riscvchip, self.speed]
vec![self.riscvchip, self.speed as u8]
}
}

2
src/operations.rs

@ -31,7 +31,7 @@ impl WchLink {
self.send_command(commands::SetTwoLineMode {
riscvchip: expected_chip.unwrap_or(RiscvChip::CH32V30X) as u8,
speed: 1, // 1 high, 2, medium, 3 low
speed: Default::default(), // 1 high, 2, medium, 3 low
})?;
if let Ok(resp) = self.send_command(commands::control::AttachChip) {

Loading…
Cancel
Save