Skip to main content

sftool_lib/sf32lb55/
ram_command.rs

1use crate::Result;
2use crate::common::ram_command::{CommandConfig, RamOps};
3use crate::sf32lb55::SF32LB55Tool;
4
5// 重新导出公共类型
6pub use crate::common::ram_command::{Command, DownloadStub, RamCommand, Response};
7
8impl RamCommand for SF32LB55Tool {
9    fn command(&mut self, cmd: Command) -> Result<Response> {
10        let cmd_string = self.format_command(&cmd);
11        RamOps::send_command_and_wait_response(
12            &mut self.port,
13            cmd,
14            &cmd_string,
15            self.base.memory_type.as_str(),
16        )
17    }
18
19    fn send_data(&mut self, data: &[u8]) -> Result<Response> {
20        let config = CommandConfig {
21            compat_mode: self.base.compat,
22            ..Default::default()
23        };
24        RamOps::send_data_and_wait_response(&mut self.port, data, &config)
25    }
26}
27
28impl DownloadStub for SF32LB55Tool {
29    fn download_stub(&mut self) -> Result<()> {
30        // Use SifliTool trait methods
31        self.download_stub_impl()
32    }
33}