Skip to content

Commit

Permalink
Add support for Raspberry Pi 500
Browse files Browse the repository at this point in the history
  • Loading branch information
golemparts committed Dec 9, 2024
1 parent 21aec81 commit 5297dbf
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ pub enum Model {
RaspberryPi4B,
RaspberryPi400,
RaspberryPi5,
RaspberryPi500,
RaspberryPiComputeModule,
RaspberryPiComputeModule3,
RaspberryPiComputeModule3Plus,
Expand All @@ -106,6 +107,7 @@ impl fmt::Display for Model {
Model::RaspberryPi4B => write!(f, "Raspberry Pi 4 B"),
Model::RaspberryPi400 => write!(f, "Raspberry Pi 400"),
Model::RaspberryPi5 => write!(f, "Raspberry Pi 5"),
Model::RaspberryPi500 => write!(f, "Raspberry Pi 500"),
Model::RaspberryPiComputeModule => write!(f, "Raspberry Pi Compute Module"),
Model::RaspberryPiComputeModule3 => write!(f, "Raspberry Pi Compute Module 3"),
Model::RaspberryPiComputeModule3Plus => write!(f, "Raspberry Pi Compute Module 3+"),
Expand Down Expand Up @@ -210,7 +212,7 @@ fn parse_proc_cpuinfo() -> Result<Model> {
0x14 => Model::RaspberryPiComputeModule4,
0x15 => Model::RaspberryPiComputeModule4S,
0x17 => Model::RaspberryPi5,
0x18 => Model::RaspberryPiComputeModule5,
0x19 => Model::RaspberryPi500,
_ => return Err(Error::UnknownModel),
}
} else {
Expand Down Expand Up @@ -253,6 +255,7 @@ fn parse_base_compatible() -> Result<Model> {
"raspberrypi,4-compute-module-s" => Model::RaspberryPiComputeModule4S,
"raspberrypi,5-model-b" => Model::RaspberryPi5,
"raspberrypi,5-compute-module" => Model::RaspberryPiComputeModule5,
"raspberrypi,500" => Model::RaspberryPi500,
_ => continue,
};

Expand Down Expand Up @@ -317,6 +320,7 @@ fn parse_base_model() -> Result<Model> {
"Raspberry Pi Compute Module 4S" => Model::RaspberryPiComputeModule4S,
"Raspberry Pi 5 Model B" => Model::RaspberryPi5,
"Raspberry Pi Compute Module 5" => Model::RaspberryPiComputeModule5,
"Raspberry Pi 500" => Model::RaspberryPi500,
_ => return Err(Error::UnknownModel),
};

Expand Down Expand Up @@ -419,16 +423,18 @@ impl DeviceInfo {
pwm_chip: 0,
pwm_channels: [0, 1],
}),
Model::RaspberryPi5 | Model::RaspberryPiComputeModule5 => Ok(DeviceInfo {
model,
soc: SoC::Bcm2712,
peripheral_base: PERIPHERAL_BASE_RP1,
gpio_offset: GPIO_OFFSET_RP1,
gpio_lines: GPIO_LINES_RP1,
gpio_interface: GpioInterface::Rp1,
pwm_chip: 2,
pwm_channels: [2, 3],
}),
Model::RaspberryPi5 | Model::RaspberryPi500 | Model::RaspberryPiComputeModule5 => {
Ok(DeviceInfo {
model,
soc: SoC::Bcm2712,
peripheral_base: PERIPHERAL_BASE_RP1,
gpio_offset: GPIO_OFFSET_RP1,
gpio_lines: GPIO_LINES_RP1,
gpio_interface: GpioInterface::Rp1,
pwm_chip: 2,
pwm_channels: [2, 3],
})
}
}
}

Expand Down

0 comments on commit 5297dbf

Please sign in to comment.