diff --git a/pycardium/mphalport.c b/pycardium/mphalport.c index b17e9ca3245a120b69b16a319ce2896ffc5c391c..ede4bae73dce2b505cc8f00d8430a5d7b9df7d73 100644 --- a/pycardium/mphalport.c +++ b/pycardium/mphalport.c @@ -20,9 +20,13 @@ #include <stdio.h> #include <string.h> -// Smallest interval which can be reached exactly -// * 8 to allow up to 100 ms epic calls -#define SYSTICK_INTERVAL_US (15625ULL * 8ULL) +/* Smallest integer us interval which can be reached exactly due + * to the 32768 Hz systick frequency */ +#define SYSTICK_INTERVAL_US_MIN 15625 + +/* Target systick interval is 1 second */ +#define SYSTICK_INTERVAL_US \ + (SYSTICK_INTERVAL_US_MIN * (1000000 / SYSTICK_INTERVAL_US_MIN)) /* * Copied from core_cm4.h and modified to select the