Added simple i2c emulator. Cleaned up database insertion.
This commit is contained in:
22
start.py
22
start.py
@@ -1,3 +1,25 @@
|
||||
from pkgutil import iter_modules
|
||||
|
||||
if "smbus" not in (name for loader, name, ispkg in iter_modules()):
|
||||
print("smbus not found, installing replacement")
|
||||
|
||||
|
||||
class SMBus:
|
||||
def __init__(self, i2c_address):
|
||||
self.i2c_address = i2c_address
|
||||
self.channels = {}
|
||||
|
||||
def write_word_data(self, cmd, val):
|
||||
if (cmd - 6) % 4 == 0:
|
||||
self.channels[(cmd - 6) / 4] = val
|
||||
|
||||
def read_word_data(self, cmd):
|
||||
return self.channels[(cmd - 8) / 4]
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
sys.modules['smbus'] = SMBus
|
||||
import LedD.daemon
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Reference in New Issue
Block a user