Module: RaspberryPi
- Defined in:
- lib/thermal_sensor.rb,
lib/raspberry_pi.rb
Overview
ThermalSensor - Raspberry Pi internal SoC temperature sensor
Defined Under Namespace
Classes: ThermalSensor
Class Method Summary collapse
-
.hardware_info ⇒ Object
Revision : a22082 SoC : BCM2837 RAM : 1024Mb Storage : MicroSD USB ports : 4 (excluding power) Ethernet ports : 1 Wi-fi : True Bluetooth : True Camera ports (CSI) : 1 Display ports (DSI): 1.
- .pi_model ⇒ Object
-
.pi_model_old ⇒ Object
Pi Model 3B V1.2.
Class Method Details
.hardware_info ⇒ Object
Revision : a22082 SoC : BCM2837 RAM : 1024Mb Storage : MicroSD USB ports : 4 (excluding power) Ethernet ports : 1 Wi-fi : True Bluetooth : True Camera ports (CSI) : 1 Display ports (DSI): 1
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/raspberry_pi.rb', line 25 def self.hardware_info info = {} lines = ` pinout | grep ': '` lines << `cat /proc/cpuinfo | grep ': '` lines.split("\n").each do |line| key, value = line.split(':') key.strip! if key == 'processor' value = (value.to_i+1).to_s key = 'Cores' end key = 'CPU name' if key == 'model name' info[key] = value.strip end info end |
.pi_model ⇒ Object
10 11 12 13 |
# File 'lib/raspberry_pi.rb', line 10 def self.pi_model info = `cat /proc/device-tree/model` info.strip end |
.pi_model_old ⇒ Object
Pi Model 3B V1.2
5 6 7 8 |
# File 'lib/raspberry_pi.rb', line 5 def self.pi_model_old info = `pinout | grep -Eo "Pi Model[^|]+"` info.strip end |