Skip to content

Commit

Permalink
Add clippy changes to example
Browse files Browse the repository at this point in the history
  • Loading branch information
nahla-nee committed Nov 19, 2024
1 parent f54c46e commit 3818c56
Showing 1 changed file with 59 additions and 53 deletions.
112 changes: 59 additions & 53 deletions rp235x-hal-examples/src/bin/rom_funcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,11 @@ where
{
let result = hal::rom_data::sys_info_api::chip_info();
let result = match result {
Ok(result) => {
match result {
Some(result) => result,
None => {
_ = writeln!(uart, "chip_info() not supported");
return;
}
Ok(result) => match result {
Some(result) => result,
None => {
_ = writeln!(uart, "chip_info() not supported");
return;
}
},
Err(e) => {
Expand All @@ -265,13 +263,11 @@ where
{
let result = hal::rom_data::sys_info_api::cpu_info();
let result = match result {
Ok(result) => {
match result {
Some(result) => result,
None => {
_ = writeln!(uart, "cpu_info() not supported");
return;
}
Ok(result) => match result {
Some(result) => result,
None => {
_ = writeln!(uart, "cpu_info() not supported");
return;
}
},
Err(e) => {
Expand All @@ -298,13 +294,11 @@ where
{
let result = hal::rom_data::sys_info_api::flash_dev_info();
let result = match result {
Ok(result) => {
match result {
Some(result) => result,
None => {
_ = writeln!(uart, "flash_dev_info() not supported");
return;
}
Ok(result) => match result {
Some(result) => result,
None => {
_ = writeln!(uart, "flash_dev_info() not supported");
return;
}
},
Err(e) => {
Expand All @@ -331,7 +325,11 @@ where
FlashDevInfoSize::Unknown => "Unknown",
};
_ = writeln!(uart, "\tCS1 GPIO: {}", result.cs1_gpio());
_ = writeln!(uart, "\tD8H Erase Supported: {}", result.d8h_erase_supported());
_ = writeln!(
uart,
"\tD8H Erase Supported: {}",
result.d8h_erase_supported()
);
_ = writeln!(uart, "\tCS0 Size: {}", size_lookup(result.cs0_size()));
_ = writeln!(uart, "\tCS1 Size: {}", size_lookup(result.cs1_size()));
}
Expand All @@ -343,13 +341,11 @@ where
{
let result = hal::rom_data::sys_info_api::boot_random();
let result = match result {
Ok(result) => {
match result {
Some(result) => result,
None => {
_ = writeln!(uart, "boot_random() not supported");
return;
}
Ok(result) => match result {
Some(result) => result,
None => {
_ = writeln!(uart, "boot_random() not supported");
return;
}
},
Err(e) => {
Expand All @@ -369,13 +365,11 @@ where
{
let result = hal::rom_data::sys_info_api::boot_info();
let result = match result {
Ok(result) => {
match result {
Some(result) => result,
None => {
_ = writeln!(uart, "boot_info() not supported");
return;
}
Ok(result) => match result {
Some(result) => result,
None => {
_ = writeln!(uart, "boot_info() not supported");
return;
}
},
Err(e) => {
Expand All @@ -385,27 +379,39 @@ where
};

_ = writeln!(uart, "get_sys_info(start_block/0x0040)");
_ = writeln!(uart, "\tDiagnostic Partition: {}", match result.diagnostic_partition {
PartitionIndex::Partition(_) => "Numbered partition",
PartitionIndex::None => "None",
PartitionIndex::Slot0 => "Slot 0",
PartitionIndex::Slot1 => "Slot 1",
PartitionIndex::Image => "Image",
PartitionIndex::Unknown => "Unknown",
});
_ = writeln!(uart, "\tBoot Type: {}", match result.boot_type {
BootType::Normal => "Normal",
BootType::BootSel => "bootsel",
BootType::RamImage => "RAM image",
BootType::FlashUpdate => "Flash update",
BootType::PcSp => "pc_sp",
BootType::Unknown => "Unknown",
});
_ = writeln!(
uart,
"\tDiagnostic Partition: {}",
match result.diagnostic_partition {
PartitionIndex::Partition(_) => "Numbered partition",
PartitionIndex::None => "None",
PartitionIndex::Slot0 => "Slot 0",
PartitionIndex::Slot1 => "Slot 1",
PartitionIndex::Image => "Image",
PartitionIndex::Unknown => "Unknown",
}
);
_ = writeln!(
uart,
"\tBoot Type: {}",
match result.boot_type {
BootType::Normal => "Normal",
BootType::BootSel => "bootsel",
BootType::RamImage => "RAM image",
BootType::FlashUpdate => "Flash update",
BootType::PcSp => "pc_sp",
BootType::Unknown => "Unknown",
}
);
_ = writeln!(uart, "\tChained: {}", result.chained);
_ = writeln!(uart, "\tPartition: {}", result.partition);
_ = writeln!(uart, "\tTBYB Info: {:02x}", result.tbyb_update_info);
_ = writeln!(uart, "\tBoot Diagnostic: {:04x}", result.boot_diagnostic);
_ = writeln!(uart, "\tBoot Params: {:04x}, {:04x}", result.boot_params[0], result.boot_params[1]);
_ = writeln!(
uart,
"\tBoot Params: {:04x}, {:04x}",
result.boot_params[0], result.boot_params[1]
);
}

/// Run get_partition_table_info
Expand Down

0 comments on commit 3818c56

Please sign in to comment.