[][src]Function vcgencmd::interpret_bit_pattern

pub fn interpret_bit_pattern(pattern: isize) -> ThrottledStatus

Interprets a bit pattern obtained from get_throttled in the following way:

111100000000000001010
||||             ||||_ under-voltage
||||             |||_ currently throttled
||||             ||_ arm frequency capped
||||             |_ soft temperature reached
||||_ under-voltage has occurred since last reboot
|||_ throttling has occurred since last reboot
||_ arm frequency capped has occurred since last reboot
|_ soft temperature reached since last reboot

Note: This interpretation might be false/outdated for different versions of vcgencmd...

Examples

Basic usage:

use vcgencmd::{interpret_bit_pattern, ThrottledStatus};
let throttle_status = interpret_bit_pattern(0b111100000000000001010_isize);
// or bit_pattern = get_throttle().unwrap();
// let throttle status = interpret_bit_pattern(bit_pattern);
assert_eq!(throttle_status,
           ThrottledStatus {
              arm_frequency_cap_occurred: true,
              arm_frequency_capped: false,
              currently_throttled: true,
              soft_temp_limit_active: true,
              soft_temp_limit_occurred: true,
              throttling_occurred: true,
              under_voltage: false,
              under_voltage_occurred: true,
})