Coder Social home page Coder Social logo

vcgencmd-rs's Introduction

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();

vcgencmd-rs's People

Contributors

elementc avatar erdfern avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

elementc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.