class SimpleSerial_ChipWhispererLite(SimpleSerialTemplate): _name = 'NewAE USB (CWLite/CW1200)' def __init__(self): SimpleSerialTemplate.__init__(self) self._baud = 38400 self.cwlite_usart = None self.params.addChildren([{ 'name': 'baud', 'type': 'int', 'key': 'baud', 'limits': (500, 2000000), 'get': self.baud, 'set': self.setBaud, 'default': 38400 }]) def close(self): pass @setupSetParam("baud") def setBaud(self, baud): self._baud = baud if self.cwlite_usart: self.cwlite_usart.init(baud) else: logging.error('Baud rate not set, need to connect first') def baud(self): return self._baud def con(self, scope=None): if scope is None or not hasattr(scope, "qtadc"): Warning( "You need a scope with OpenADC connected to use this Target") scope.connectStatus.connect(self.dis) if hasattr(scope, 'qtadc'): ser = scope.qtadc.ser else: ser = scope._cwusb self.cwlite_usart = CWL_USART(ser) self.cwlite_usart.init(baud=self.findParam('baud').getValue()) self.params.refreshAllParameters() self.connectStatus.setValue(True) def hardware_inWaiting(self): bwait = self.cwlite_usart.inWaiting() if bwait == 127: logging.warning( 'SAM3U Serial buffers OVERRUN - data loss has occurred.') return bwait def hardware_write(self, string): self.cwlite_usart.write(string) def hardware_read(self, num, timeout=250): return self.cwlite_usart.read(num, timeout)
class SimpleSerial_ChipWhispererLite(SimpleSerialTemplate): _name = 'NewAE USB (CWLite/CW1200)' def __init__(self): SimpleSerialTemplate.__init__(self) self._baud = 38400 self.cwlite_usart = None def close(self): pass def setBaud(self, baud): self._baud = baud if self.cwlite_usart: self.cwlite_usart.init(baud) else: logging.error('Baud rate not set, need to connect first') def baud(self): return self._baud def con(self, scope=None): if scope is None or not hasattr(scope, "qtadc"): Warning( "You need a scope with OpenADC connected to use this Target") if hasattr(scope, 'qtadc'): ser = scope.qtadc.ser else: ser = scope._cwusb self.cwlite_usart = CWL_USART(ser) self.cwlite_usart.init(baud=self._baud) def hardware_inWaiting(self): bwait = self.cwlite_usart.inWaiting() if bwait == 127: logging.warning( 'SAM3U Serial buffers OVERRUN - data loss has occurred.') return bwait def hardware_write(self, string): self.cwlite_usart.write(string) def hardware_read(self, num, timeout=250): return self.cwlite_usart.read(num, timeout)