Skip to content

Commit

Permalink
Merge pull request #164 from ManoDaSilva/master
Browse files Browse the repository at this point in the history
Adding Raspberry Pi 3 A+ support
  • Loading branch information
dj7lc authored Jan 12, 2024
2 parents 91e6b3f + 9f64c4b commit c5c579e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/raspi/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub enum Model {
V1Bplus,
V2B,
V3B,
V3Aplus,
V3Bplus,
V4B,
Pi400,
Expand Down Expand Up @@ -45,7 +46,7 @@ impl Model {
.and_then(|line| line.split(':').nth(1))
.map(str::trim);

// See https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
// See https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-pi-revision-codes
match revision {
0x2..=0x3 => Model::V1B { rev: 1 },
0x4..=0x6 | 0xd..=0x0f => Model::V1B { rev: 2 },
Expand All @@ -58,7 +59,8 @@ impl Model {
0x900092 | 0x900093 | 0x920093 => Model::Zero,
0x9000C1 => Model::ZeroW,
0xA02082 | 0xA22082 | 0xA32082 => Model::V3B,
0xA020D3 => Model::V3Bplus,
0x9020E0 => Model::V3Aplus,
0xA020D3 => Model::V3Bplus,
0xA03111 | 0xB03111..=0xB03115 | 0xC03111..=0xC03115 | 0xD03114..=0xD03115 => Model::V4B,
0xC03130 => Model::Pi400,
_ => match hardware {
Expand All @@ -75,7 +77,7 @@ impl Model {
&Model::V1Aplus | &Model::V1Bplus
=> Some(0x20200000),
&Model::V2B => Some(0x3F200000),
&Model::V3B | &Model::V3Bplus => Some(0x3F200000),
&Model::V3B | &Model::V3Aplus | &Model::V3Bplus => Some(0x3F200000),
&Model::V4B | &Model::Pi400 => Some(0xFE200000),
&Model::Zero | &Model::ZeroW => Some(0x20200000),
&Model::OrangePi => None,
Expand All @@ -93,7 +95,7 @@ impl Model {
&Model::Zero | &Model::ZeroW =>
Some(vec![17, 18, 27, 22, 23, 24, 25, 4,
2, 3, 8, 7, 10, 9, 11, 14, 15]),
&Model::V3B | &Model::V3Bplus | &Model::V4B | &Model::Pi400 =>
&Model::V3B | &Model::V3Aplus | &Model::V3Bplus | &Model::V4B | &Model::Pi400 =>
Some(vec![17, 18, 27, 22, 23, 24, 25, 4,
2, 3, 8, 7, 10, 9, 11, 14, 15,
0, 0, 0, 0, 5, 6, 13, 19, 26,
Expand All @@ -117,6 +119,7 @@ impl fmt::Display for Model {
&Model::V1Bplus => write!(f, "Raspberry Pi 1 Model B+"),
&Model::V2B => write!(f, "Raspberry Pi 2 Model B"),
&Model::V3B => write!(f, "Raspberry Pi 3 Model B"),
&Model::V3Aplus => write!(f, "Raspberry Pi 3 Model A+"),
&Model::V3Bplus => write!(f, "Raspberry Pi 3 Model B+"),
&Model::V4B => write!(f, "Raspberry Pi 4 Model B"),
&Model::Pi400 => write!(f, "Raspberry Pi 400"),
Expand Down

0 comments on commit c5c579e

Please sign in to comment.