summaryrefslogtreecommitdiff
path: root/n/es-2006/src/timer_1.c
blob: 97b29fdd8ae412da2ec4c6df794ed7e728b3d123 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* timer_1.c */
/* es - Input/Output general purpose board. {{{
 *
 * Copyright (C) 2006 Dufour J�r�my
 *
 * Robot APB Team/Efrei 2004.
 *        Web: http://assos.efrei.fr/robot/
 *      Email: robot AT efrei DOT fr
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * }}} */
#include "timer_1.h"

/** Initialisation of the shared register for the timer/counter 1. */
inline void 
timer1_init (void)
{
    /* Initialisation of timer/counter 1 control register A :
     * - pwm : TODO Complete it please !
     */
    TCCR1A =
	regv (COM1A1, COM1A0, COM1B1, COM1B0, COM1C1, COM1C0, WGM11, WGM10,
	      1,      0,      1,      0,      1,      0,      1,     1     );
    /* Initialisation of timer/counter 1 control register B :
     *  - shared : 1 for prescaling ;
     *  - rvb : noise canceler, IC on falling edge ;
     *  - pwm : Fast PWM 10 bits.
     */
     TCCR1B = regv (ICNC1, ICES1, 5, WGM13, WGM12, CS12, CS11, CS10,
		    1,     0,     0, 0,     1,     0,    0,    1    );
    /* Initialisation of timer/counter 1 control register C :
     *  - pwm : TODO.
     */
//      TCCR1C = regv (F0C1A, FOC1B, FOC1C, 4, 3, 2, 1, 0,
// 		    0,     0,     0,     0, 0, 0, 0, 0);
}