Macros

Defined constants.

//serial
#define debugSerial   Serial    //serial port for debug messages

//task modes
#define PT_MODE_ONESHOT   1
#define PT_MODE_SPANNING  2

//sleep modes
#define PT_SLEEP_DISABLE     1    //self-disable mode
#define PT_SLEEP_SUSPEND     2    //self-suspend mode

#define MS_MULTIPLIER  1000   //multiplier to convert ms to us

//commonly used time periods
#define PT_TIME_1MS     1000
#define PT_TIME_2MS     2000
#define PT_TIME_5MS     5000
#define PT_TIME_10MS    10000
#define PT_TIME_20MS    20000
#define PT_TIME_50MS    50000
#define PT_TIME_100MS   100000
#define PT_TIME_200MS   200000
#define PT_TIME_500MS   500000
#define PT_TIME_1S      1000000
#define PT_TIME_2S      2000000
#define PT_TIME_3S      3000000
#define PT_TIME_4S      4000000
#define PT_TIME_5S      5000000
#define PT_TIME_6S      6000000
#define PT_TIME_7S      7000000
#define PT_TIME_8S      8000000
#define PT_TIME_9S      9000000
#define PT_TIME_10S     10000000

//equivalent frequenceis
#define PT_FREQ_1HZ       PT_TIME_1S
#define PT_FREQ_2HZ       PT_TIME_500MS
#define PT_FREQ_5HZ       PT_TIME_200MS
#define PT_FREQ_10HZ      PT_TIME_100MS
#define PT_FREQ_20HZ      PT_TIME_50MS
#define PT_FREQ_50HZ      PT_TIME_20MS
#define PT_FREQ_100HZ     PT_TIME_10MS
#define PT_FREQ_200HZ     PT_TIME_5MS
#define PT_FREQ_500HZ     PT_TIME_2MS
#define PT_FREQ_1KHZ      PT_TIME_1MS

#define PT_TIME_DEFAULT   PT_TIME_1S

If you want to add more time periods and frequencies, follow the same convention that I have used.

  1. PT_FREQ_0_5HZ - 0.5 Hz

  2. PT_TIME_100US - 100 microseconds

Last updated