diff options
Diffstat (limited to 'lib/support/drivers/hotplug')
-rw-r--r-- | lib/support/drivers/hotplug/button.lua | 32 | ||||
-rw-r--r-- | lib/support/drivers/hotplug/distanc.lua | 32 | ||||
-rw-r--r-- | lib/support/drivers/hotplug/gpio.lua | 19 | ||||
-rw-r--r-- | lib/support/drivers/hotplug/grey.lua | 32 | ||||
-rw-r--r-- | lib/support/drivers/hotplug/light.lua | 32 | ||||
-rw-r--r-- | lib/support/drivers/hotplug/port.lua | 19 | ||||
-rw-r--r-- | lib/support/drivers/hotplug/tilt.lua | 19 | ||||
-rw-r--r-- | lib/support/drivers/hotplug/vibra.lua | 19 |
8 files changed, 0 insertions, 204 deletions
diff --git a/lib/support/drivers/hotplug/button.lua b/lib/support/drivers/hotplug/button.lua deleted file mode 100644 index 9ddba48..0000000 --- a/lib/support/drivers/hotplug/button.lua +++ /dev/null @@ -1,32 +0,0 @@ -local device = _G - -local RD_VERSION=string.char(0x00) -local GET_VALUE=string.char(0x01) -local string_byte=string.byte - --- description: lets us know button module's version -api={} -api.getVersion = {} -api.getVersion.parameters = {} -- no input parameters -api.getVersion.returns = {[1]={rname="version", rtype="int"}} -api.getVersion.call = function () - device:send(RD_VERSION) -- operation code 0 = get version - local version_response = device:read(3) -- 3 bytes to read (opcode, data) - if not version_response or #version_response~=3 then return -1 end - local raw_val = (string_byte(version_response,2) or 0) + (string_byte(version_response,3) or 0)* 256 - return raw_val -end - --- description: lets us know button's current status --- input: empty --- output: button's current status. Possible status: 1 pressed - 0 not pressed -api.getValue = {} -api.getValue.parameters = {} -- no input parameters -api.getValue.returns = {[1]={rname="state", rtype="int"}} -api.getValue.call = function () - device:send(GET_VALUE) -- operation code 1 = get button's status - local sen_dig_response = device:read(2) -- 2 bytes to read (opcode, data) - if not sen_dig_response or #sen_dig_response~=2 then return -1 end - local raw_val = string_byte(sen_dig_response, 2) or 0 -- keep data - return raw_val -end diff --git a/lib/support/drivers/hotplug/distanc.lua b/lib/support/drivers/hotplug/distanc.lua deleted file mode 100644 index 2340796..0000000 --- a/lib/support/drivers/hotplug/distanc.lua +++ /dev/null @@ -1,32 +0,0 @@ -local device = _G - -local RD_VERSION=string.char(0x00) -local GET_VALUE=string.char(0x01) -local string_byte=string.byte - --- description: lets us know dist module's version -api={} -api.getVersion = {} -api.getVersion.parameters = {} -- no input parameters -api.getVersion.returns = {[1]={rname="version", rtype="int"}} -api.getVersion.call = function () - device:send(RD_VERSION) -- operation code 0 = get version - local version_response = device:read(3) -- 3 bytes to read (opcode, data) - if not version_response or #version_response~=3 then return -1 end - local raw_val = (string_byte(version_response,2) or 0) + (string_byte(version_response,3) or 0)* 256 - return raw_val -end - --- description: lets us know dist sensor's current value --- input: empty --- output: dist sensor's current value. -api.getValue = {} -api.getValue.parameters = {} -- no input parameters -api.getValue.returns = {[1]={rname="par1", rtype="int"}} -api.getValue.call = function () - device:send(GET_VALUE) -- operation code 1 = get distance of object - local sen_anl_response = device:read(3) -- operation code and data - if not sen_anl_response or #sen_anl_response~=3 then return -1 end - local raw_val = (string_byte(sen_anl_response, 2) or 0) + (string_byte(sen_anl_response, 3) or 0)* 256 - return raw_val -end diff --git a/lib/support/drivers/hotplug/gpio.lua b/lib/support/drivers/hotplug/gpio.lua deleted file mode 100644 index 331efb3..0000000 --- a/lib/support/drivers/hotplug/gpio.lua +++ /dev/null @@ -1,19 +0,0 @@ -local device = _G - -local RD_VERSION=string.char(0x00) -local string_byte=string.byte - --- description: lets us know button module's version -api={} -api.getVersion = {} -api.getVersion.parameters = {} -- no input parameters -api.getVersion.returns = {[1]={rname="version", rtype="int"}} -api.getVersion.call = function () - device:send(RD_VERSION) -- operation code 0 = get version - local version_response = device:read(3) -- 3 bytes to read (opcode, data) - if not version_response or #version_response~=3 then return -1 end - local raw_val = (string_byte(version_response,2) or 0) + (string_byte(version_response,3) or 0)* 256 - return raw_val -end - - diff --git a/lib/support/drivers/hotplug/grey.lua b/lib/support/drivers/hotplug/grey.lua deleted file mode 100644 index eb24f36..0000000 --- a/lib/support/drivers/hotplug/grey.lua +++ /dev/null @@ -1,32 +0,0 @@ -local device = _G - -local RD_VERSION=string.char(0x00) -local GET_VALUE=string.char(0x01) -local string_byte=string.byte - --- description: lets us know grey module's version -api={} -api.getVersion = {} -api.getVersion.parameters = {} -- no input parameters -api.getVersion.returns = {[1]={rname="version", rtype="int"}} -api.getVersion.call = function () - device:send(RD_VERSION) -- operation code 0 = get version - local version_response = device:read(3) -- 3 bytes to read (opcode, data) - if not version_response or #version_response~=3 then return -1 end - local raw_val = (string_byte(version_response,2) or 0) + (string_byte(version_response,3) or 0)* 256 - return raw_val -end - --- description: lets us know grey sensor's current value --- input: empty --- output: grey sensor's current value. -api.getValue = {} -api.getValue.parameters = {} -- no input parameters -api.getValue.returns = {[1]={rname="par1", rtype="int"}} -api.getValue.call = function () - device:send(GET_VALUE) -- operation code 1 = get grey level - local sen_anl_response = device:read(3) -- operation code and data - if not sen_anl_response or #sen_anl_response~=3 then return -1 end - local raw_val = (string_byte(sen_anl_response, 2) or 0) + (string_byte(sen_anl_response, 3) or 0)* 256 - return raw_val -end diff --git a/lib/support/drivers/hotplug/light.lua b/lib/support/drivers/hotplug/light.lua deleted file mode 100644 index ce953b2..0000000 --- a/lib/support/drivers/hotplug/light.lua +++ /dev/null @@ -1,32 +0,0 @@ -local device = _G - -local RD_VERSION=string.char(0x00) -local GET_VALUE=string.char(0x01) -local string_byte=string.byte - --- description: lets us know light module's version -api={} -api.getVersion = {} -api.getVersion.parameters = {} -- no input parameters -api.getVersion.returns = {[1]={rname="version", rtype="int"}} -api.getVersion.call = function () - device:send(RD_VERSION) -- operation code 0 = get version - local version_response = device:read(3) -- 3 bytes to read (opcode, data) - if not version_response or #version_response~=3 then return -1 end - local raw_val = (string_byte(version_response,2) or 0) + (string_byte(version_response,3) or 0)* 256 - return raw_val -end - --- description: lets us know light sensor's current value --- input: empty --- output: light sensor's current value. -api.getValue = {} -api.getValue.parameters = {} -- no input parameters -api.getValue.returns = {[1]={rname="par1", rtype="int"}} -api.getValue.call = function () - device:send(GET_VALUE) -- operation code 1 = get light level - local sen_anl_response = device:read(3) -- operation code and data - if not sen_anl_response or #sen_anl_response~=3 then return -1 end - local raw_val = (string_byte(sen_anl_response, 2) or 0) + (string_byte(sen_anl_response, 3) or 0)* 256 - return raw_val -end diff --git a/lib/support/drivers/hotplug/port.lua b/lib/support/drivers/hotplug/port.lua deleted file mode 100644 index 331efb3..0000000 --- a/lib/support/drivers/hotplug/port.lua +++ /dev/null @@ -1,19 +0,0 @@ -local device = _G - -local RD_VERSION=string.char(0x00) -local string_byte=string.byte - --- description: lets us know button module's version -api={} -api.getVersion = {} -api.getVersion.parameters = {} -- no input parameters -api.getVersion.returns = {[1]={rname="version", rtype="int"}} -api.getVersion.call = function () - device:send(RD_VERSION) -- operation code 0 = get version - local version_response = device:read(3) -- 3 bytes to read (opcode, data) - if not version_response or #version_response~=3 then return -1 end - local raw_val = (string_byte(version_response,2) or 0) + (string_byte(version_response,3) or 0)* 256 - return raw_val -end - - diff --git a/lib/support/drivers/hotplug/tilt.lua b/lib/support/drivers/hotplug/tilt.lua deleted file mode 100644 index 1076479..0000000 --- a/lib/support/drivers/hotplug/tilt.lua +++ /dev/null @@ -1,19 +0,0 @@ -local device = _G - -api={} -api.getTilt = {} -api.getTilt.parameters = {} -- -- no input parameters -api.getTilt.returns = {[1]={rname="par1", rtype="int"}} -api.getTilt.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 diff --git a/lib/support/drivers/hotplug/vibra.lua b/lib/support/drivers/hotplug/vibra.lua deleted file mode 100644 index 0c3d985..0000000 --- a/lib/support/drivers/hotplug/vibra.lua +++ /dev/null @@ -1,19 +0,0 @@ -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 |