I2C reset button

This commit is contained in:
James Bowman 2019-03-02 14:17:12 -08:00
parent 38ed5a2a1d
commit 3c5b894b7e
1 changed files with 8 additions and 5 deletions

View File

@ -114,14 +114,10 @@ class Frame(wx.Frame):
self.ckM = wx.ToggleButton(self, label = "Monitor mode")
self.ckM.Bind(wx.EVT_TOGGLEBUTTON, self.check_m)
ps = self.GetFont().GetPointSize()
self.txVal = HexTextCtrl(self, size=wx.DefaultSize, style=0)
self.rxVal = HexTextCtrl(self, size=wx.DefaultSize, style=wx.TE_READONLY)
# self.txVal.SetFont(wx.Font(14 * ps // 10, wx.MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
txButton = wx.Button(self, label = "write")
txButton.Bind(wx.EVT_BUTTON, partial(self.write, self.txVal))
@ -131,10 +127,12 @@ class Frame(wx.Frame):
self.dev_widgets = [txButton, rxButton]
self.reset_button = button("i2c reset", self.reset)
self.stop_button = button("stop", self.stop)
self.stop_button.Enable(False)
self.allw = [self.ckM]
self.allw = [self.ckM, self.reset_button]
[w.Enable(False) for w in self.allw]
self.devs = self.devices()
cb = wx.ComboBox(self, choices = sorted(self.devs.keys()), style = wx.CB_READONLY)
@ -156,6 +154,7 @@ class Frame(wx.Frame):
hcenter(cb),
label(""),
hcenter(self.ckM),
hcenter(self.reset_button),
label(""),
hcenter(pair(
vbox([
@ -204,6 +203,10 @@ class Frame(wx.Frame):
self.started = False
self.stop_button.Enable(False)
def reset(self, e = None):
self.sd.reset()
self.started = False
def write(self, htc, e):
if (self.addr is not None) and htc.GetValue():
vv = [int(c,16) for c in htc.GetValue().split()]