##
-## This file is part of the sigrok project.
+## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
##
id = 'lm75'
name = 'LM75'
longname = 'National LM75'
- desc = 'National LM75 (and compatibles) temperature sensor protocol.'
+ desc = 'National LM75 (and compatibles) temperature sensor.'
license = 'gplv2+'
inputs = ['i2c']
outputs = ['lm75']
self.state = 'IDLE'
self.reg = 0x00 # Currently selected register
self.databytes = []
- self.mintemp = 0
- self.maxtemp = 0
- self.avgvalues = []
- def start(self, metadata):
- # self.out_proto = self.add(srd.OUTPUT_PROTO, 'lm75')
- self.out_ann = self.add(srd.OUTPUT_ANN, 'lm75')
-
- def report(self):
- # TODO: print() or self.put() or return xyz, or... ?
- avg = sum(self.avgvalues) / len(self.avgvalues)
- temperatures = (self.mintemp, self.maxtemp, avg)
- # TODO: Configurable report() output, e.g. for Kelvin.
- return 'Min/max/avg temperature: %f/%f/%f °C' % temperatures
+ def start(self):
+ # self.out_proto = self.register(srd.OUTPUT_PYTHON)
+ self.out_ann = self.register(srd.OUTPUT_ANN)
def putx(self, data):
# Helper for annotations which span exactly one I2C packet.
s = 'Warning: The temperature register is read-only!'
self.putb([4, [s]])
- # Keep some statistics. Can be output in report(), for example.
- if celsius < self.mintemp:
- self.mintemp = celsius
- if celsius > self.maxtemp:
- self.maxtemp = celsius
- self.avgvalues.append(celsius)
-
def handle_temperature_reg(self, b, s, rw):
# Common helper for the temperature/T_HYST/T_OS registers.
if len(self.databytes) == 0: