diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-05-16 08:14:41 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-05-16 08:14:41 +0200 |
commit | 3ba2b742d9b8a1e4f89225439174bdc32e2bcd16 (patch) | |
tree | 5df840764acf276752619c83a6374cf182f6b6ef | |
parent | 29094b709088d5c997425580dc15e22b555dbf59 (diff) |
cycles_to_energy: Use ATMega328P datasheet values; fix voltage limits
-rw-r--r-- | lib/cycles_to_energy.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/cycles_to_energy.py b/lib/cycles_to_energy.py index ec449ca..18b0629 100644 --- a/lib/cycles_to_energy.py +++ b/lib/cycles_to_energy.py @@ -109,15 +109,19 @@ class ATMega328: 'voltage': 3 } + # Source: ATMega328P Datasheet p.316 / table 28.2.4 def get_current(params): if type(params) != dict: return ATMega328.get_current(_param_list_to_dict(ATMega328, params)) - if params['cpu_freq'] == 1e6 and params['voltage'] <= 2: - return 0.5e-3 - if params['cpu_freq'] == 4e6 and params['voltage'] <= 3: - return 3.5e-3 - if params['cpu_freq'] == 8e6 and params['voltage'] <= 5: - return 12e-3 + # specified for 2V + if params['cpu_freq'] == 1e6 and params['voltage'] >= 1.8: + return 0.3e-3 + # specified for 3V + if params['cpu_freq'] == 4e6 and params['voltage'] >= 1.8: + return 1.7e-3 + # specified for 5V + if params['cpu_freq'] == 8e6 and params['voltage'] >= 2.5: + return 5.2e-3 return None def get_power(params): |