gate: reorder - stage 2

Signed-off-by: Thomas Klaehn <thomas.klaehn@u-blox.com>
This commit is contained in:
Thomas Klaehn
2017-03-30 11:58:55 +02:00
parent c1012382f2
commit aa146b15e5
11 changed files with 236 additions and 262 deletions

View File

@@ -0,0 +1,11 @@
import smbus
class LightSensor(object):
def __init__(self, bus = 1, addr = 0x23):
self.__i2c_device = bus
self.__i2c_addr = addr
self.__i2c_device = smbus.SMBus(self.__i2c_device)
def read(self):
data = self.__i2c_device.read_i2c_block_data(self.__i2c_addr, 0x10)
return int(round((data[0] * 256 + data[1]) / 1.2, 0))

View File

@@ -1,11 +0,0 @@
import smbus
class light_sensor:
def __init__(self, bus = 1, addr = 0x23):
self.__i2c_device = bus
self.__i2c_addr = addr
self.__i2c_device = smbus.SMBus(self.__i2c_device)
def read(self):
data = self.__i2c_device.read_i2c_block_data(self.__i2c_addr, 0x10)
return int(round((data[0] * 256 + data[1]) / 1.2, 0))