sftool_lib/sf32lb58/
ram_command.rs

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