#raspberry-pi #info #raspberry #pi #system

vcgencmd

Bindings for Raspberry Pi's vcgencmd utility

10 releases

0.3.1 Sep 11, 2019
0.3.0 Sep 8, 2019
0.2.3 Aug 9, 2019
0.1.4 Jul 26, 2019

#1674 in Embedded development

Download history 1/week @ 2024-03-12 5/week @ 2024-03-19 3/week @ 2024-03-26 24/week @ 2024-04-02 7/week @ 2024-04-09 8/week @ 2024-04-16 1/week @ 2024-04-23 1/week @ 2024-05-07 26/week @ 2024-05-14 35/week @ 2024-05-21 24/week @ 2024-05-28 1/week @ 2024-06-04 40/week @ 2024-06-11 54/week @ 2024-06-18 12/week @ 2024-06-25

107 downloads per month

MIT license

18KB
331 lines

Bindings for RaspberryPi's vcgencmd utility

Crates.io Documentation MIT license

The vcgencmd crate provides a way to interact with the vcgencmd utility included in Raspbian through a Rust program.

As of yet, not all vcgencmd commands have a binding. To see which commands are missing, take a look at PROGRESS.md in the projects repo. I will only actively add bindings for commands if I happen to need them personally. If you need a specific command that's unimplemented, feel free to open an issue asking for it or submit a pull request with the implementation yourself.

Installation

Install from Crates.io:

[dependencies]
vcgencmd = "0.3.*"

Features

  • serde: Serialization and de-serialization for the few data structures this crate contains are supported via the serde feature flag:
[dependencies]
vcgencmd = {version: "0.3.*", features = ["serde"]}

Quick Start

use vcgencmd::{measure_temp, get_throttle, ThrottledStatus};

// You'll want to import the `Src` enum, which holds all available sources
// for the different commands
use vcgendcmd::Src;

// Gives the current temperature as f64 in °C
let temp = measure_temp().unwrap();

// Measure the arm chips memory usage
let arm_mem = get_mem(Src::Mem(MemSrc::Arm)).unwrap();

// Measure the voltage at the video core
let volt_gpu = measure_volts(Src::Volt(VoltSrc::Core)).unwrap();

// Get a bit pattern which represents the throttled state of the system
let bit_pattern = get_throttle.unwrap();

// Get comprehensive, human readable info about the throttled state of the system
let throttle_status = ThrottledStatus::new(&bit_pattern);

// If you've enabled the `serde` feature, you can serialize/deserialize the crates datastructures
use serde_json::to_string;
let serialized = to_string(&throttle_status).unwrap();

Dependencies

~180–590KB