Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/lib/support/drivers/hotplug/vibra.lua
blob: 0c3d9850bb343561a207fab16291cfe697ca299e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
local device = _G

api={}
api.getVibra = {}
api.getVibra.parameters = {} -- -- no input parameters
api.getVibra.returns = {[1]={rname="par1", rtype="int"}} 
api.getVibra.call = function ()
	device:send(string.char(0x00)) -- codigo de operacion 0
	local sen_dig_response = device:read(3) 
	local raw_val	
	if not sen_dig_response or string.byte(sen_dig_response or "00000000", 2) == nil or string.byte(sen_dig_response or "00000000", 3) == nil
	then 
		raw_val = "nil value"
	else
		raw_val = string.byte(sen_dig_response, 3) % 2
	end	
	return raw_val 
	
end