diff --git a/README.md b/README.md index ed0e941..ad34df9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +Modified for embedded testing + ## Description The new Nordic Semiconductor's [Power Profiler Kit II (PPK 2)](https://www.nordicsemi.com/Software-and-tools/Development-Tools/Power-Profiler-Kit-2) is very useful for real time measurement of device power consumption. The official [nRF Connect Power Profiler tool](https://github.com/NordicSemiconductor/pc-nrfconnect-ppk) provides a friendly GUI with real-time data display. However there is no support for automated power monitoring. The puropose of this Python API is to enable automated power monitoring and data logging in Python applications. diff --git a/src/ppk2_api/ppk2_api.py b/src/ppk2_api/ppk2_api.py index 4b39a69..54b8ef5 100644 --- a/src/ppk2_api/ppk2_api.py +++ b/src/ppk2_api/ppk2_api.py @@ -99,7 +99,7 @@ def __del__(self): """Destructor""" try: # reset device - self._write_serial((PPK2_Command.RESET,)) + #self._write_serial((PPK2_Command.RESET,)) if self.ser: self.ser.close() @@ -134,18 +134,8 @@ def _convert_source_voltage(self, mV): if mV > self.vdd_high: mV = self.vdd_high - offset = 32 - # get difference to baseline (the baseline is 800mV but the initial offset is 32) - diff_to_baseline = mV - self.vdd_low + offset - base_b_1 = 3 - base_b_2 = 0 # is actually 32 - compensated with above offset - - # get the number of times we have to increase the first byte of the command - ratio = int(diff_to_baseline / 256) - remainder = diff_to_baseline % 256 # get the remainder for byte 2 - - set_b_1 = base_b_1 + ratio - set_b_2 = base_b_2 + remainder + set_b_1 = mV >> 8 + set_b_2 = mV & 0xFF return set_b_1, set_b_2