Class: I2CDevice::D6T44L

Inherits:
I2CDevice show all
Defined in:
lib/i2c/device/d6t-44l.rb

Defined Under Namespace

Classes: InvalidParityException

Constant Summary

Constants inherited from I2CDevice

VERSION

Instance Attribute Summary

Attributes inherited from I2CDevice

#address

Instance Method Summary collapse

Methods inherited from I2CDevice

#i2cget, #i2cset

Constructor Details

#initialize(args = {}) ⇒ D6T44L

Returns a new instance of D6T44L.


7
8
9
10
# File 'lib/i2c/device/d6t-44l.rb', line 7

def initialize(args={})
	args[:address] = 0x0a
	super
end

Instance Method Details

#read_dataObject


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/i2c/device/d6t-44l.rb', line 12

def read_data
	data = i2cget(0x4c, 35)
	unless checkPEC(data, false)
		raise InvalidParityException
	end

	# PTAT はセンサ内部の参照温度データ
	ptat, *pixels = data[0..-2].unpack("v*")
	{
		:PTAT => ptat,
		:PIXELS => pixels.each_slice(4).to_a
	}
end