summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/hardware/avr/timer/u8AVRTimerSetups.c
diff options
context:
space:
mode:
authorMushirahmed2016-01-15 16:47:41 +0530
committerMushirahmed2016-01-15 16:47:41 +0530
commit41bd783b705f1de28308896ecdb4e7ba0cc842f8 (patch)
treef04d43098d9bc44c58c886b98f8fc43c26aac4d2 /2.3-1/src/c/hardware/avr/timer/u8AVRTimerSetups.c
parent3b6025f3708421279a7df1df2e7990ebff833324 (diff)
parentef666a6b9ac74d5effe8b34179cc3ad0c247e7c3 (diff)
downloadScilab2C-41bd783b705f1de28308896ecdb4e7ba0cc842f8.tar.gz
Scilab2C-41bd783b705f1de28308896ecdb4e7ba0cc842f8.tar.bz2
Scilab2C-41bd783b705f1de28308896ecdb4e7ba0cc842f8.zip
merge before windows testing lapack and Makefile.mak file
Diffstat (limited to '2.3-1/src/c/hardware/avr/timer/u8AVRTimerSetups.c')
-rw-r--r--2.3-1/src/c/hardware/avr/timer/u8AVRTimerSetups.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/2.3-1/src/c/hardware/avr/timer/u8AVRTimerSetups.c b/2.3-1/src/c/hardware/avr/timer/u8AVRTimerSetups.c
new file mode 100644
index 00000000..1d93429b
--- /dev/null
+++ b/2.3-1/src/c/hardware/avr/timer/u8AVRTimerSetups.c
@@ -0,0 +1,42 @@
+// Function to setup timer on AVR
+//
+// Calling Sequence
+// u8AVRTimerSetups(timer, prescalar)
+//
+// Parameters
+// timer: timer to be set up (0,1,2)
+// prescalar: prescalar to be used for timer (0-7)
+// ***Refer datasheet for more description about timer
+//
+// Description
+// This function sets prescalr for timers. 'timer' decides which of the
+// three (0,1,2) timers available to be used. The 'prescalar' is needed for
+// deciding timer clock. Select appropriate prescalar depending on MCU clock
+// and requirement.
+//
+//
+// Authors
+// Siddhesh Wani
+//
+
+
+#include "AVRPeripheralTimer.h"
+
+
+uint8 u8AVRTimerSetups(uint8 timer,uint8 prescalar)
+{
+ switch(timer)
+ {
+ case 0:
+ TCCR0|= (prescalar & 0x07); //Select clock source
+ break;
+ case 1:
+ break;
+ case 2:
+ TCCR2|= (prescalar & 0x07); //Select clock source
+ break;
+ }
+
+ return 0;
+}
+