atexit.register(camera.close) camera.resolution = sizeData[sizeMode][1] #camera.crop = sizeData[sizeMode][2] camera.crop = (0.0, 0.0, 1.0, 1.0) # Leave raw format at default YUV, don't touch, don't set to RGB! # Load all icons at startup. for file in os.listdir(iconPath): if fnmatch.fnmatch(file, '*.png'): icons.append(Icon(file.split('.')[0])) # Initialize I2C try: # print "Initialize I2C" AdaI2C = Adafruit_I2C(0x36) Adafruit_I2C.__init__(AdaI2C, 0x36) AdaI2C.address = 0x36 # SparkFun "Fuel Gauge" AdaI2C.bus = smbus.SMBus(Adafruit_I2C.getPiI2CBusNumber()) Adafruit_I2C.write16(AdaI2C, 0xFE, 0x0054) # POR register Adafruit_I2C.write16(AdaI2C, 0x0C, 0x00FE) # RCOMP register time.sleep(10) # Initialize GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.IN) # Monitor Charging Status LED on LiPo Charger GPIO.setup(18, GPIO.OUT) # Controls an Alarm LED during last 20% Battey Life GPIO.output(18, GPIO.HIGH) updFuelGauge() getFuelLevel() # print "Default I2C bus is accessible" except: # print "Error accessing default I2C bus"
def __init__(self, address, busnum=-1, debug=False, height = 4, width = 20): Adafruit_I2C.__init__(self, address, busnum, debug) self.height = height self.width = width
def __init__(self, address, busnum=-1, debug=False, height=4, width=20): Adafruit_I2C.__init__(self, address, busnum, debug) self.height = height self.width = width
def __init__(self, address): Adafruit_I2C.__init__(self, address)