summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorimushir2016-01-18 14:10:56 +0530
committerimushir2016-01-18 14:10:56 +0530
commit9fdbe6b47b95468bce7c0ae162aff138ec0b9b94 (patch)
tree16a96221aba82ce30ff8d2daeca19112e55800c3
parentc3cc6d1d15d8cf60a27f253205424adb9e498e6e (diff)
parent304ad0ee30ad83db53a76a76d7bb4f3392779eb4 (diff)
downloadScilab2C_fossee_old-9fdbe6b47b95468bce7c0ae162aff138ec0b9b94.tar.gz
Scilab2C_fossee_old-9fdbe6b47b95468bce7c0ae162aff138ec0b9b94.tar.bz2
Scilab2C_fossee_old-9fdbe6b47b95468bce7c0ae162aff138ec0b9b94.zip
merged pulled
-rw-r--r--macros/CCodeGeneration/C_GenerateFunName.binbin5444 -> 6288 bytes
-rw-r--r--macros/CCodeGeneration/C_GenerateFunName.sci36
-rw-r--r--macros/CCodeGeneration/C_GenerateMakefile.sci22
-rw-r--r--macros/Hardware/AVR/AVRTimerSetup.binbin3552 -> 3480 bytes
-rw-r--r--macros/Hardware/AVR/AVRTimerSetup.sci2
-rw-r--r--macros/Hardware/AVR/AVRUARTSetup.sci31
-rw-r--r--macros/Hardware/AVR/GetAVRSupportFunctions.binbin1256 -> 1888 bytes
-rw-r--r--macros/Hardware/AVR/GetAVRSupportFunctions.sci11
-rw-r--r--macros/Scilab-Arduino/GenerateSetupFunction.sci3
-rw-r--r--macros/ToolInitialization/INIT_FillSCI2LibCDirs.binbin1000968 -> 0 bytes
-rw-r--r--macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci8
-rw-r--r--macros/ToolInitialization/UpdateSCI2CInfo.sci7
-rw-r--r--macros/findDeps/getAllInterfaces.sci2
-rw-r--r--macros/runsci2c.sci1
-rw-r--r--src/c/hardware/avr/includes/AVRPeripheralPWM.h2
-rw-r--r--src/c/hardware/avr/includes/AVRPeripheralTimer.h27
-rw-r--r--src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h4
-rw-r--r--src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h11
-rw-r--r--src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h4
-rw-r--r--src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h25
-rw-r--r--src/c/hardware/avr/timer/u8AVRGetTimerValues.c37
-rw-r--r--src/c/hardware/avr/timer/u8AVRTimerSetups.c42
-rw-r--r--src/c/hardware/avr/uart/u8AVRUARTSetups.c84
-rw-r--r--src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c1
24 files changed, 318 insertions, 42 deletions
diff --git a/macros/CCodeGeneration/C_GenerateFunName.bin b/macros/CCodeGeneration/C_GenerateFunName.bin
index 6551c7f..4f3c591 100644
--- a/macros/CCodeGeneration/C_GenerateFunName.bin
+++ b/macros/CCodeGeneration/C_GenerateFunName.bin
Binary files differ
diff --git a/macros/CCodeGeneration/C_GenerateFunName.sci b/macros/CCodeGeneration/C_GenerateFunName.sci
index 9d40d2b..657258a 100644
--- a/macros/CCodeGeneration/C_GenerateFunName.sci
+++ b/macros/CCodeGeneration/C_GenerateFunName.sci
@@ -23,22 +23,30 @@ function CFunName = C_GenerateFunName(FunctionName,InArg,NInArg,OutArg,NOutArg)
// ------------------------------
SCI2CNInArgCheck(argn(2),5,5);
CFunName = '';
+if(IsAVRSupportFunction(FunctionName))
+//If current function is an AVR function, then function name can be just plain
+//function name without any input/output arguments types
-for tmpcnt = 1:NInArg
- if (InArg(tmpcnt).Dimension == 1)
- CFunName = CFunName+InArg(tmpcnt).Type+'2';
- else
- CFunName = CFunName+InArg(tmpcnt).Type+SCI2Cstring(InArg(tmpcnt).Dimension);
- end
-end
+ CFunName = CFunName+FunctionName;
+
+else
+
+ for tmpcnt = 1:NInArg
+ if (InArg(tmpcnt).Dimension == 1)
+ CFunName = CFunName+InArg(tmpcnt).Type+'2';
+ else
+ CFunName = CFunName+InArg(tmpcnt).Type+SCI2Cstring(InArg(tmpcnt).Dimension);
+ end
+ end
-CFunName = CFunName+FunctionName;
+ CFunName = CFunName+FunctionName;
-for tmpcnt = 1:NOutArg
- if (OutArg(tmpcnt).Dimension == 1)
- CFunName = CFunName+OutArg(tmpcnt).Type+'2';
- else
- CFunName = CFunName+OutArg(tmpcnt).Type+SCI2Cstring(OutArg(tmpcnt).Dimension);
- end
+ for tmpcnt = 1:NOutArg
+ if (OutArg(tmpcnt).Dimension == 1)
+ CFunName = CFunName+OutArg(tmpcnt).Type+'2';
+ else
+ CFunName = CFunName+OutArg(tmpcnt).Type+SCI2Cstring(OutArg(tmpcnt).Dimension);
+ end
+ end
end
endfunction
diff --git a/macros/CCodeGeneration/C_GenerateMakefile.sci b/macros/CCodeGeneration/C_GenerateMakefile.sci
index 320d803..b998257 100644
--- a/macros/CCodeGeneration/C_GenerateMakefile.sci
+++ b/macros/CCodeGeneration/C_GenerateMakefile.sci
@@ -1,3 +1,5 @@
+//Removed 4 lines code from end that causes ot generate the Makefile.mak file that is not needed with cygwin
+//Changed at line 52
function C_GenerateMakefile(FileInfo,SharedInfo)
// function C_GenerateMakefile(FileInfo,SharedInfo)
// -----------------------------------------------------------------
@@ -49,11 +51,19 @@ PrintStringInfo('HSRCDIR = '+makehsrcdir,FileInfo.MakefileFilename,'file','y
PrintStringInfo('ISRCDIR = '+makeisrcdir,FileInfo.MakefileFilename,'file','y','y');
PrintStringInfo('SCI2CDIR = .',FileInfo.MakefileFilename,'file','y','y');
-// Compiler definition
-PrintStringInfo('CC = gcc',FileInfo.MakefileFilename,'file','y','y');
-PrintStringInfo('CFLAGS = -Wall -pedantic -g -I $(HSRCDIR) -I $(ISRCDIR)',FileInfo.MakefileFilename,'file','y','y');
-PrintStringInfo('LDFLAGS = -lblas -llapack -lm',FileInfo.MakefileFilename,'file','y','y');
+if getos() == 'Windows' then
+ // Compiler definition
+ PrintStringInfo('CC = gcc',FileInfo.MakefileFilename,'file','y','y');
+ PrintStringInfo('CFLAGS = -Wall -pedantic -g -I $(HSRCDIR) -I $(ISRCDIR)',FileInfo.MakefileFilename,'file','y','y');
+ PrintStringInfo('LDFLAGS = -L./ -lblasplus -llapack -lm',FileInfo.MakefileFilename,'file','y','y'); //Added -L./ and -lblasplus(previously it was -lblas)
+
+else
+ // Compiler definition
+ PrintStringInfo('CC = gcc',FileInfo.MakefileFilename,'file','y','y');
+ PrintStringInfo('CFLAGS = -Wall -pedantic -g -I $(HSRCDIR) -I $(ISRCDIR)',FileInfo.MakefileFilename,'file','y','y');
+ PrintStringInfo('LDFLAGS = -lblas -llapack -lm',FileInfo.MakefileFilename,'file','y','y');
+end
// Binary definition
PrintStringInfo('EXEFILENAME = mytest.exe',FileInfo.MakefileFilename,'file','y','y');
PrintStringInfo('EXEFILE = $(SCI2CDIR)/$(EXEFILENAME)', FileInfo.MakefileFilename,'file','y','y');
@@ -107,8 +117,6 @@ PrintStringInfo('\t@echo ""==========================""',FileInfo.MakefileFilena
PrintStringInfo('\trm -rf $(EXEFILE)',FileInfo.MakefileFilename,'file','y','y');
PrintStringInfo('\t@echo "" ""',FileInfo.MakefileFilename,'file','y','y');
-if getos() == 'Windows' then
- C_GenerateMakefile_msvc(FileInfo,SharedInfo);
-end
+
endfunction
diff --git a/macros/Hardware/AVR/AVRTimerSetup.bin b/macros/Hardware/AVR/AVRTimerSetup.bin
index 65e8f45..4a49b86 100644
--- a/macros/Hardware/AVR/AVRTimerSetup.bin
+++ b/macros/Hardware/AVR/AVRTimerSetup.bin
Binary files differ
diff --git a/macros/Hardware/AVR/AVRTimerSetup.sci b/macros/Hardware/AVR/AVRTimerSetup.sci
index 6316cdd..1529c34 100644
--- a/macros/Hardware/AVR/AVRTimerSetup.sci
+++ b/macros/Hardware/AVR/AVRTimerSetup.sci
@@ -6,7 +6,7 @@ function AVRTimerSetup(timer, prescalar)
//
// Parameters
// timer: timer to be set up (0,1,2)
-// prescalar: prescalar to be used for generating PWM waveform (0-7)
+// prescalar: prescalar to be used for timer (0-7)
// ***Refer datasheet for more description about timer
//
// Description
diff --git a/macros/Hardware/AVR/AVRUARTSetup.sci b/macros/Hardware/AVR/AVRUARTSetup.sci
new file mode 100644
index 0000000..1529c34
--- /dev/null
+++ b/macros/Hardware/AVR/AVRUARTSetup.sci
@@ -0,0 +1,31 @@
+function AVRTimerSetup(timer, prescalar)
+// Function to set the prescalar for timer.
+//
+// Calling Sequence
+// AVRTimerSetup(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.
+//
+//
+// Examples
+// AVRTimerSetup(0,1) //Timer 0 with no scaling
+//
+// See also
+// AVRGetTimerValue
+//
+// Authors
+// Siddhesh Wani
+//
+
+// This is curretly dummy function. It provides no functionality but is required
+// for providing support for generating C code for AVR.
+endfunction
diff --git a/macros/Hardware/AVR/GetAVRSupportFunctions.bin b/macros/Hardware/AVR/GetAVRSupportFunctions.bin
index eed8be3..0aa7587 100644
--- a/macros/Hardware/AVR/GetAVRSupportFunctions.bin
+++ b/macros/Hardware/AVR/GetAVRSupportFunctions.bin
Binary files differ
diff --git a/macros/Hardware/AVR/GetAVRSupportFunctions.sci b/macros/Hardware/AVR/GetAVRSupportFunctions.sci
index 50a913f..cce49f9 100644
--- a/macros/Hardware/AVR/GetAVRSupportFunctions.sci
+++ b/macros/Hardware/AVR/GetAVRSupportFunctions.sci
@@ -11,6 +11,15 @@ function AVRSupportFunctions = GetAVRSupportFunctions()
// Author: Siddhesh Wani
// -----------------------------------------------------------------
-AVRSupportFunctions = ["AVRDigitalOut"];
+AVRSupportFunctions = [
+ "AVRADCSetup"
+ "AVRDigitalIn"
+ "AVRDigitalOut"
+ "AVRDigitalSetup"
+ "AVRGetTimerValue"
+ "AVRPWMSetDuty"
+ "AVRPWMSetup"
+ "AVRReadADC"
+ "AVRTimerSetup"];
endfunction
diff --git a/macros/Scilab-Arduino/GenerateSetupFunction.sci b/macros/Scilab-Arduino/GenerateSetupFunction.sci
index 416509c..33a515d 100644
--- a/macros/Scilab-Arduino/GenerateSetupFunction.sci
+++ b/macros/Scilab-Arduino/GenerateSetupFunction.sci
@@ -1,8 +1,11 @@
+//Scilab2C IITB FOSSEE
function GenerateSetupFunction(FileInfo)
SetupListFile = FileInfo.SetupListFile;
load(SetupListFile,'SetupList');
+
SetupArduinoFile = fullfile(FileInfo.CStyleOutCCCodeDir,'setup_arduino.c');
+SetupArduinoFile = fullfile(FileInfo.CStyleOutCCCodeDir,'setup_arduino.cpp');
C_SCI2CHeader(SetupArduinoFile);
PrintStringInfo('#include ""setup_arduino.h""',SetupArduinoFile,'file','y');
diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
deleted file mode 100644
index a92ebcf..0000000
--- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
+++ /dev/null
Binary files differ
diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
index 1f9b2c9..55c43ad 100644
--- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
+++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
@@ -4418,8 +4418,8 @@ PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
// --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-PrintStringInfo('d0d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
-
+//PrintStringInfo('d0d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
FunctionName = 'AVRPWMSetup';
@@ -4443,8 +4443,8 @@ PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
// --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-PrintStringInfo('d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
-
+//PrintStringInfo('d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
FunctionName = 'AVRPWMSetDuty';
diff --git a/macros/ToolInitialization/UpdateSCI2CInfo.sci b/macros/ToolInitialization/UpdateSCI2CInfo.sci
index 445507b..253299a 100644
--- a/macros/ToolInitialization/UpdateSCI2CInfo.sci
+++ b/macros/ToolInitialization/UpdateSCI2CInfo.sci
@@ -61,7 +61,12 @@ FileInfo.Funct(funnumber).PfxP1WhileEpilFileName = fullfile(FileInfo.WorkingDir,
FileInfo.Funct(funnumber).CPass1FreeFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_pass1free.c');
FileInfo.Funct(funnumber).CPass2FileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_pass2.c');
FileInfo.Funct(funnumber).Pass1HeaderFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'.h');
-FileInfo.Funct(funnumber).FinalCFileName = fullfile(FileInfo.OutCCCodeDir,SharedInfo.NextCFunName+'.c');
+if (SharedInfo.OutFormat == 'Arduino')
+//In case of "Arduino" target, *.cpp files should be generated, not *.c files.
+ FileInfo.Funct(funnumber).FinalCFileName = fullfile(FileInfo.OutCCCodeDir,SharedInfo.NextCFunName+'.cpp');
+else
+ FileInfo.Funct(funnumber).FinalCFileName = fullfile(FileInfo.OutCCCodeDir,SharedInfo.NextCFunName+'.c');
+end
FileInfo.Funct(funnumber).FinalHeaderFileName = fullfile(FileInfo.OutCCCodeDir,SharedInfo.NextCFunName+'.h');
FileInfo.Funct(funnumber).CInitVarsFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_initvars.c');
FileInfo.Funct(funnumber).CDeclarationFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_declarations.c');
diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci
index 02e741c..aa6776c 100644
--- a/macros/findDeps/getAllInterfaces.sci
+++ b/macros/findDeps/getAllInterfaces.sci
@@ -136,7 +136,7 @@ function allInterfaces = getAllInterfaces(OutFormat)
AVR_interfaces = [
"src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h"
"src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h"
- "src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h"
+ "src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h"
"src/c/hardware/avr/interfaces/int_AVRUtil.h"
];
diff --git a/macros/runsci2c.sci b/macros/runsci2c.sci
index 4620705..9d86589 100644
--- a/macros/runsci2c.sci
+++ b/macros/runsci2c.sci
@@ -151,6 +151,7 @@ else
if BuildTool == "make"
C_GenerateMakefile(FileInfo,SharedInfo);
+ copyBlasLapackLibs(FileInfo,SharedInfo); //Previously .dll files and blas,lapack library not creating for cygwin by additing this works fine
end
if BuildTool == "nmake"
copyBlasLapackLibs(FileInfo,SharedInfo);
diff --git a/src/c/hardware/avr/includes/AVRPeripheralPWM.h b/src/c/hardware/avr/includes/AVRPeripheralPWM.h
index 80b29f3..7371dd7 100644
--- a/src/c/hardware/avr/includes/AVRPeripheralPWM.h
+++ b/src/c/hardware/avr/includes/AVRPeripheralPWM.h
@@ -17,7 +17,7 @@ extern "C" {
//Function prototypes
uint8 u8AVRPWMSetups(uint8 timer, uint8 prescalar, uint8 waveform_mode, uint8 output_mode);
-uint8 u8AVRPWMSetDuty(uint8 timer, uint8 duty);
+uint8 u8AVRPWMSetDutys(uint8 timer, uint8 duty);
#ifdef __cplusplus
diff --git a/src/c/hardware/avr/includes/AVRPeripheralTimer.h b/src/c/hardware/avr/includes/AVRPeripheralTimer.h
new file mode 100644
index 0000000..78b04aa
--- /dev/null
+++ b/src/c/hardware/avr/includes/AVRPeripheralTimer.h
@@ -0,0 +1,27 @@
+//This file defines functions prototypes related to Timer.
+//
+// Authors
+// Siddhesh Wani
+//
+
+#ifndef __AVRPERIPHERALTIMER_H__
+#define __AVRPERIPHERALTIMER_H__
+
+#include <avr/io.h>
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//Function prototypes
+uint8 u8AVRTimerSetups(uint8 timer, uint8 prescalar);
+
+uint8 u8AVRGetTimerValue(uint8 timer);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* !__AVRPERIPHERALTIMER_H__ */
diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h
index 0aafb8c..425b03f 100644
--- a/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h
+++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h
@@ -14,10 +14,10 @@
extern "C" {
#endif
-#define d0d0AVRADCSetupu80(in1,in2) u8AVRADCSetups((uint8) in1,\
+#define AVRADCSetup(in1,in2) u8AVRADCSetups((uint8) in1,\
(uint8) in2);
-#define d0AVRReadADCu160(in1) u8AVRReadADCs((uint8) in1);
+#define AVRReadADC(in1) u8AVRReadADCs((uint8) in1);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h
index 439532d..c034718 100644
--- a/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h
+++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h
@@ -14,19 +14,14 @@
extern "C" {
#endif
-#define d0d0d0AVRDigitalSetupu80(in1,in2,in3) u8AVRDigitalSetups((uint8) in1,\
+#define AVRDigitalSetup(in1,in2,in3) u8AVRDigitalSetups((uint8) in1,\
(uint8) in2, (uint8) in3);
-#define d0d0AVRDigitalInu80(in1,in2) u8AVRDigitalIns((uint8) in1,\
- (uint8) in2);
+#define AVRDigitalIn(in1,in2) u8AVRDigitalIns((uint8) in1, (uint8) in2);
-#define d0d0d0AVRDigitalOutu80(in1,in2,in3) u8AVRDigitalOuts((uint8) in1,\
+#define AVRDigitalOut(in1,in2,in3) u8AVRDigitalOuts((uint8) in1,\
(uint8) in2, (uint8) in3);
-#define d0d0u80AVRDigitalOutu80(in1,in2,in3) u8AVRDigitalOuts((uint8) in1,\
- (uint8) in2, (uint8) in3);
-
-
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h
index 7368619..2d5e5cb 100644
--- a/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h
+++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h
@@ -14,10 +14,10 @@
extern "C" {
#endif
-#define d0d0d0d0AVRPWMSetupu80(in1,in2) u8AVRPWMSetups((uint8) in1,\
+#define AVRPWMSetup(in1,in2,in3,in4) u8AVRPWMSetups((uint8) in1,\
(uint8) in2, (uint8) in3, (uint8) in4);
-#define d0d0AVRPWMSetDuty(in1,in2) u8AVRPWMSetDutys((uint8) in1, (uint8) in2);
+#define AVRPWMSetDuty(in1,in2) u8AVRPWMSetDutys((uint8) in1, (uint8) in2);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h
new file mode 100644
index 0000000..b4b66ba
--- /dev/null
+++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h
@@ -0,0 +1,25 @@
+//This file defines constants corresponding to gpios.
+//
+// Authors
+// Siddhesh Wani
+//
+
+#ifndef __INT_AVRPERIPHERALTIMER_H__
+#define __INT_AVRPERIPHERALTIMER_H__
+
+#include <avr/io.h>
+#include "AVRPeripheralTimer.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define AVRTimerSetup(in1,in2) u8AVRTimerSetups((uint8) in1, (uint8) in2);
+
+#define AVRGetTimerValue(in1) u8AVRGetTimerValues((uint8) in1);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* !__AVRPERIPHERALADC_H__ */
diff --git a/src/c/hardware/avr/timer/u8AVRGetTimerValues.c b/src/c/hardware/avr/timer/u8AVRGetTimerValues.c
new file mode 100644
index 0000000..c542c18
--- /dev/null
+++ b/src/c/hardware/avr/timer/u8AVRGetTimerValues.c
@@ -0,0 +1,37 @@
+// Function to get timer count
+//
+// Calling Sequence
+// u8AVRGetTimerValues(timer)
+//
+// Parameters
+// timer: timer whose current count is to be returned (0,1,2)
+// ***Refer datasheet for more description about timer
+//
+// Description
+// This function returns the count of timer specified
+//
+//
+// Authors
+// Siddhesh Wani
+//
+
+
+#include "AVRPeripheralTimer.h"
+
+
+uint8 u8AVRGetTimerValues(uint8 timer)
+{
+ switch(timer)
+ {
+ case 0:
+ return TCNT0;
+
+ case 1:
+ break;
+ case 2:
+ return TCNT2;
+ }
+
+ return 0;
+}
+
diff --git a/src/c/hardware/avr/timer/u8AVRTimerSetups.c b/src/c/hardware/avr/timer/u8AVRTimerSetups.c
new file mode 100644
index 0000000..1d93429
--- /dev/null
+++ b/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;
+}
+
diff --git a/src/c/hardware/avr/uart/u8AVRUARTSetups.c b/src/c/hardware/avr/uart/u8AVRUARTSetups.c
new file mode 100644
index 0000000..f311500
--- /dev/null
+++ b/src/c/hardware/avr/uart/u8AVRUARTSetups.c
@@ -0,0 +1,84 @@
+// Function to initialise uart interface of AVR
+//
+// Calling Sequence
+// u8AVRUARTSetups(uint8 mode, uint8 baudrate, uint8 stopbits, uint8 parity)
+//
+// Parameters
+// mode : Mode of usart interface (0-Normal mode, 1-Double speed mode,
+// 2-Synchronous master mode)
+// baudrate : Baudrate for communication. Refer AVRPeripheralUART.h
+// for available options)
+// stopbits : No. of stopbits (0-1) for stopbits 1 and 2 resp.
+// parity: set parity bit. (0-disabled, 1-Even parity, 2-Odd parity)
+//
+//
+// Description
+// This function initialises uart interface for AVR. Available modes are
+// Normal mode (0), Double speed mode (1), Synchronous master mode(2). 'baudrate'
+// decides baudrate for communication. For baudrate settings, variable
+// 'XTAL_FREQUENCY' is required. 'stopbits' sets no of stopbits for data
+// packet. 0 for 1 stopbit and 1 for 2 stopbits. 'parity' decides parity bit
+// for communication. 0 for disabling parity bit, 1 for even parity and 2
+// for odd parity.
+//
+// Authors
+// Siddhesh Wani
+//
+
+#include "AVRPeripheralUART.h"
+
+uint8 u8AVRUARTSetups(uint8 mode, uint8 baudrate, uint8 stopbits, uint8 parity)
+{
+ switch (mode) //According to mode set bits UMSEL and U2X
+ {
+ case 0: //Normal mode
+ UCSRC &= ~(1<<6); //Clear bit 6 UMSEL
+ break;
+
+ case 1: //Double speed mode
+ UCSRC &= ~(1<<6); //Clear bit 6 UMSEL
+ break;
+
+ case 2: //Synchronous master mode
+ UCSRC |= (1<<6); //Set bit 6 UMSEL
+ break;
+ }
+
+ if(stopbits == 0)
+ { // 1 stopbit
+ UCSRC &= ~(1<<3);
+ }
+ else
+ { // 2 stopbits
+ UCSRC |= (1<<3);
+ }
+
+ //Set parity bit settings
+ switch(parity)
+ {
+ case 0: // Parity disabled
+ UCSRC &= ~(3<<4); //UPM1:0=0
+ break;
+ case 1:// Even parity
+ UCSRC |= (1<<5); //UPM1:0 = 2
+ UCSRC &= ~(1<<4);
+ break;
+ case 2:// Odd parity
+ UCSRC |= (1<<5); //UPM1:1 = 3
+ UCSRC |= (1<<4);
+ break;
+ }
+
+ //Set baud rate
+ # define BAUD baudrate
+ #include "util/setbaud.h"
+ UBRRH = UBRRH_VALUE;
+ UBRRL = UBRRL_VALUE;
+ #if USE_2X
+ UCSRA |= (1 << U2X);
+ #else
+ UCSRA &= ~(1 << U2X);
+ #endif
+ return 0;
+}
+
diff --git a/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c
index 2d9de97..2e5c90d 100644
--- a/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c
+++ b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c
@@ -13,6 +13,7 @@
#include "cmd_digital_out.h"
#include "Arduino.h"
+
uint8 u8cmd_digital_outs(uint8 board_no, uint8 pin, uint8 value)
{
digitalWrite(pin,value);