summaryrefslogtreecommitdiffstats
path: root/calibration.h
blob: 3001cc004ee76e10e475aa862a99d8821724c161 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef FUNCGEN_CALIBRATION_H_
#define FUNCGEN_CALIBRATION_H_

/****************************************************************************
 * Microcontroller CPU speed calibration                                    *
 ****************************************************************************/

/* 1ms timer calibration */
#define DELAY_1MS_TIMERFREQ	(1 << CS01) /* == F_CPU/8 */
#define DELAY_1MS_LOOP		80
#define DELAY_1MS_LOOP_TIMES	25
/* 1us delayloop calibration */
#define DELAY_1US_LOOP		4

/* The hardware jiffies counter runs at F_CPU/1024.
 * The software jiffies counter is incremented on every 8-bit overflow
 * of the hardware counter. So the JIFFIES_PER_SECOND is calculated by:
 * 1000000 / (((1 / (F_CPU / 1024)) * 1000000) * 256)
 */
#define JIFFIES_PER_SECOND	61 /* 61.03515625 */


#endif /* FUNCGEN_CALIBRATION_H_ */
bues.ch cgit interface