From 6716fbc7a1ec5d14887d54b7d0286a149d15d46a Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sun, 13 Aug 2023 10:45:56 +0200 Subject: Added a sleep function in the keyboard --- src/ticks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ticks.py') diff --git a/src/ticks.py b/src/ticks.py index ba6831a..1f7e943 100644 --- a/src/ticks.py +++ b/src/ticks.py @@ -10,7 +10,7 @@ def add(ticks, delta): "Add a delta to a base number of ticks, performing wraparound at 2**29ms." return (ticks + delta) % _TICKS_PERIOD -def ticks_diff(ticks1, ticks2): +def diff(ticks1, ticks2): "Compute the signed difference between two ticks values, assuming that they are within 2**28 ticks" diff = (ticks1 - ticks2) & _TICKS_MAX diff = ((diff + _TICKS_HALFPERIOD) & _TICKS_MAX) - _TICKS_HALFPERIOD @@ -18,4 +18,4 @@ def ticks_diff(ticks1, ticks2): def less(ticks): "Return true iff ticks1 is less than ticks2, assuming that they are within 2**28 ticks" - return ticks_diff(ticks_ms(), ticks) < 0 + return diff(ticks_ms(), ticks) < 0 -- cgit v1.2.3