summaryrefslogtreecommitdiff
path: root/n/es-2007/src/timer_1.c
diff options
context:
space:
mode:
Diffstat (limited to 'n/es-2007/src/timer_1.c')
-rw-r--r--n/es-2007/src/timer_1.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/n/es-2007/src/timer_1.c b/n/es-2007/src/timer_1.c
new file mode 100644
index 0000000..97b29fd
--- /dev/null
+++ b/n/es-2007/src/timer_1.c
@@ -0,0 +1,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);
+}
+