00001
00050 #include <stdint.h>
00051
00052
00053 #define ZERO_C_IN_KELVIN 273
00054 #define ROOM_TEMPERATURE 25
00055 #define HOT_TEMPERATURE 85
00056
00057 #define TEMP_DIFF_LIMIT 5
00058
00059
00060
00061
00062 #define T0_PRESCALER_0 0
00063 #define T0_PRESCALER_1 (1 << CS00)
00064 #define T0_PRESCALER_8 (1 << CS01)
00065 #define T0_PRESCALER_64 (1 << CS01) | (1 << CS00)
00066 #define T0_PRESCALER_256 (1 << CS02)
00067 #define T0_PRESCALER_1024 (1 << CS02) | (1 << CS00)
00068 #define T0_PRESCALER T0_PRESCALER_1
00069
00071 #define SYSTEM_CLK_MHz 1
00072 #define FAST_RC_TARGET_MHZ SYSTEM_CLK_MHz
00073
00074
00075 #define FAST_RC_SEGMENT_BIT 5
00076 #define FAST_RC_NO_SEGMENTS 256 / (1 << FAST_RC_SEGMENT_BIT)
00077 #define MAX_FAST_RC_ERROR 10
00078
00079 #define RC_CALIB_CYCLES 8
00080
00081 #define SLOW_RC (1 << OSISEL0)// For selecting Fast RC calibration source
00082 #define ULP_RC (0 << OSISEL0)// For selecting Fast RC calibration source
00083
00084
00085
00086 uint16_t CalculateSlowRCperiod(int16_t temperature);
00087 uint16_t MeasureULPRCperiod(uint16_t cal_RC_period);
00088 int8_t CalibrateFastRCruntime(uint16_t cal_RC_period);
00089
00090