Crate rppal version 0.15.0

use std::error::Error;
use std::thread;
use std::time::Duration;
use rppal::gpio::Gpio;
use rppal::system::DeviceInfo;

// Gpio uses BCM pin numbering. BCM GPIO 21 is tied to physical pin 40.
const GPIO_LED: u8 = 21;

fn main() -> Result<(), Box<dyn Error>> {
    println!("Blinking an LED on a {}", DeviceInfo::new()?.SoC());

    let mut pin = Gpio::new()?.get(GPIO_LED)?.into_output();
    
        loop {
            pin.toggle();
            thread::sleep(Duration::from_millis(2500));
        }
    }

Question regarding DeviceInfo;
.Model is working fine but .SoC will result in:

cargo test (in directory: /home/ratwolf/Projects/Rust/rppal/src)
Compiling rppal v0.1.0 (/home/ratwolf/Projects/Rust/rppal)
error[E0599]: no method named SoC found for struct DeviceInfo in the current scope
--> src/main.rs:11:60
|
11 | println!("Blinking an LED on a {}", DeviceInfo::new()?.SoC());
| ^^^ method not found in DeviceInfo
For more information about this error, try rustc --explain E0599.
error: could not compile rppal (bin "rppal" test) due to previous error
Compilation failed.
According to the documentaion SoC should be implemented?
Info: Compiled on a Raspberry Pi 4B

Checking the doc page, there is a function soc() (that is all lower case) that returns the SoC type.

[DeviceInfo in rppal::system - Rust]

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.