fork download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3.  
  4. #define MIN_RPM_HALO (2000)
  5. #define MAX_RPM_HALO (6600)
  6. #define TAB_TIMER_FREQUENCY ((int)500e6)
  7. // #define TAB_TIMER_FREQUENCY (500000000)
  8. #define NUM_TABS (24)
  9. #define RPM_TO_TAB_PERIOD(rpm) ((uint32_t)((double)TAB_TIMER_FREQUENCY * 60 / NUM_TABS / (rpm)))
  10. #define MIN_GOOD_PERIOD_IN_TAB_TIMER_CLOCKS_HALO RPM_TO_TAB_PERIOD(MAX_RPM_HALO)
  11. #define MAX_GOOD_PERIOD_IN_TAB_TIMER_CLOCKS_HALO RPM_TO_TAB_PERIOD(MIN_RPM_HALO)
  12. #define TIMEOUT_LOW_RPM_IN_TAB_TIMER_CLOCKS_HALO ((MAX_GOOD_PERIOD_IN_TAB_TIMER_CLOCKS_HALO * 5) / 4)
  13. int main(void) {
  14. // your code goes here
  15. printf("MAX_GOOD_PERIOD_IN_TAB_TIMER_CLOCKS_HALO=%u\n", MAX_GOOD_PERIOD_IN_TAB_TIMER_CLOCKS_HALO);
  16. printf("TIMEOUT_LOW_RPM_IN_TAB_TIMER_CLOCKS_HALO=%u\n", TIMEOUT_LOW_RPM_IN_TAB_TIMER_CLOCKS_HALO);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
MAX_GOOD_PERIOD_IN_TAB_TIMER_CLOCKS_HALO=625000
TIMEOUT_LOW_RPM_IN_TAB_TIMER_CLOCKS_HALO=781250