def read_deckstatus(): mp.init_i2c() mp.i2c_write(0x55, [0x05]) deckstatus = mp.i2c_read(0x55) if not(deckstatus): deckstatus = struct.pack('1B', 0x00) mp.close_i2c() return deckstatus.encode('hex')
def read_serialnumber(): mp.init_i2c() mp.i2c_write(0x55, [0x82]) serialnumber = mp.i2c_read8bytes(0x55) serialNum = Entry(frame2) serialNum.insert(1, serialnumber) serialNum.grid(row=11, column=2) mp.close_i2c() return(serialnumber)
def read_partnumber1(): mp.init_i2c() mp.i2c_write(0x55, [0x80]) partnumber = mp.i2c_read8bytes(0x55) # print mp.i2c_read8bytes(0x55) part_Num = Entry(frame1) part_Num.insert(1, partnumber) part_Num.grid(row=6, column=1) mp.close_i2c() return(partnumber)
def read_partnumber(): mp.init_i2c() mp.i2c_write(0x55, [0x80]) partnumber = mp.i2c_read8bytes(0x55) print partnumber print mp.i2c_read8bytes(0x55) partNum = Entry(frame2) partNum.insert(1, partnumber) partNum.grid(row=10, column=2) mp.close_i2c() return(partnumber)
def read_statusheater(): mp.init_i2c() mp.i2c_write(0x55, [0x07]) heaterstatus = mp.i2c_read(0x55, 1) input_Heater = Listbox(frame1, height=1) input_Heater.insert(1, heaterstatus) input_Heater.grid(row=4, column=1) print heaterstatus mp.close_i2c() return (heaterstatus)
def read_heater_status(): # need to check with designer what are in reg 8? cause 97% reg7 showed 248 mp.i2c_write(0x55, [0x06]) reg6 = mp.i2c_read(0x55) if reg6: heater_status = 'ON' else: heater_status = 'OFF' mp.i2c_write(0x55, [0x07]) reg7 = mp.i2c_read(0x55) if not(reg7): reg7 = struct.pack('1B', 0x00) print struct.unpack('1B', reg7)[0] # +0.5 for rounding process only. pwm_percent = int(((struct.unpack('1B', reg7)[0]/256.0)*100.0)+0.5) # print 'Heater Status:[',heater_status ,'] heaterPWM = ',pwm_percent,'%' return heater_status, pwm_percent
def write_partnumber(partnumber="00000000"): pn = partNum.get() print("########################") print pn print("########################") ord_partnumber = list(map(ord, pn.strip())) print("########################") print ord_partnumber print("########################") reg = [0x80] writeout_to_reg = reg+ord_partnumber print writeout_to_reg ret = mp.i2c_write(0x55, ord_partnumber) print ret return(ret)
def read_temp(): mp.init_i2c() m = mp.i2c_write(0x48, [0x55]) print m temp = mp.i2c_read8bytes(0x55) print('############################') print temp print('############################') # print mp.i2c_read8bytes(0x55) temp1 = Entry(frame1) temp1.insert(1, temp) temp1.grid(row=8, column=1) temp2 = Entry(frame1) temp2.insert(1, temp) temp2.grid(row=9, column=1) mp.close_i2c() # temerature = int(((struct.unpack('1B', temp1)[0]/256.0)*100.0)+0.5) return(temp)
def write_deckstatus(status=0x00): mp.init_i2c() mp.i2c_write(0x55, [0x05, status]) deckstatus = mp.i2c_read(0x55) mp.close_i2c() return deckstatus.encode('hex')