コード例 #1
0
ファイル: tp.py プロジェクト: jolin90/python
	def OnReadRegisters(self, event):
		if not self.frame:
			return

		buf1 = "05410100"
		buf2 = self.GetTextCtrlByLabel("regread").GetValue()

		if not buf2:
			return

		if len(buf2) == 1:
			return

		buf2 = buf2[0:2]
		self.GetTextCtrlByLabel("regread").SetValue(buf2)

		readlen = int(self.readlenComboBox.GetValue())
		buf2 = buf2 + hex2(readlen)

		recvlist = self.frame.ProcessBuffData(buf1, buf2)

		if not recvlist:
			return

		if recvlist[6] == 1:
			read_from_tm = ""
			for i in range(0, readlen, 1):
				read_from_tm = read_from_tm + " " + hex2(recvlist[10 + i])

			self.GetTextCtrlByLabel("readdata").SetValue(read_from_tm)

		return
コード例 #2
0
ファイル: tp.py プロジェクト: jolin90/python
	def OnWriteRegisters(self, event):

		if not self.frame:
			return

		buf1 = "05410200"
		buf2 = self.GetTextCtrlByLabel("regwrite").GetValue()

		if not buf2 or len(buf2) == 1:
			return

		buf2 = buf2[0:2]
		self.GetTextCtrlByLabel("regwrite").SetValue(buf2)

		textCtrl = self.GetTextCtrlByLabel("writedata")

		buf_t = textCtrl.GetValue()
		buf_t = self.setTextValue(buf_t)
		if not buf_t:
			return

		buf_t = buf_t.strip(" ")
		textCtrl.SetValue(buf_t)
		buf_t = buf_t.replace(" ", "")

		buf2 = buf2 + hex2(len(buf_t)/2) + buf_t
		
		self.frame.ProcessBuffData(buf1, buf2)

		return
コード例 #3
0
ファイル: graphic.py プロジェクト: jolin90/python
	def OnSend(self, event):
		buf1 = "  "
		buf2 = "00"

		self.cmdlist[0] = 0x07

		cmd2buf = self.Cmd2ComboBox.GetValue()

		for x, y in self.Cmd2Data():
			if x == cmd2buf:

				self.cmdlist[1] = y

				if y == 0x01:
					self.VideoOutSetup()
				if y == 0x02:
					self.VideoOutIn()
				if y == 0x03:
					self.cmdlist[2] = 0x0
					self.cmdlist[3] = 0x0
				if y == 0x04:
					self.cmdlist[2] = 0x0
					self.cmdlist[3] = 0x0
				if y == 0x05:
					self.VideoInExt()
				if y == 0x06:
					self.VideoInStatus()

		for i in self.cmdlist:
			buf1 = buf1 + "%s " % hex2(i)

		if self.frame == None:
			return

		recvlist =  self.frame.ProcessBuffData(buf1, buf2)
		if not recvlist:
			return None