summaryrefslogtreecommitdiff
path: root/2.3-1
diff options
context:
space:
mode:
Diffstat (limited to '2.3-1')
-rw-r--r--2.3-1/macros/CCodeGeneration/C_GenerateFunName.binbin5444 -> 6288 bytes
-rw-r--r--2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci36
-rw-r--r--2.3-1/macros/Hardware/AVR/AVRTimerSetup.binbin3552 -> 3480 bytes
-rw-r--r--2.3-1/macros/Hardware/AVR/AVRTimerSetup.sci2
-rw-r--r--2.3-1/macros/Hardware/AVR/AVRUARTSetup.sci31
-rw-r--r--2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.binbin1256 -> 1888 bytes
-rw-r--r--2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.sci11
-rw-r--r--2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci2
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.binbin950836 -> 951340 bytes
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci8
-rw-r--r--2.3-1/macros/ToolInitialization/UpdateSCI2CInfo.sci7
-rw-r--r--2.3-1/macros/findDeps/getAllInterfaces.sci2
-rw-r--r--2.3-1/src/c/hardware/avr/includes/AVRPeripheralPWM.h2
-rw-r--r--2.3-1/src/c/hardware/avr/includes/AVRPeripheralTimer.h27
-rw-r--r--2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h4
-rw-r--r--2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h11
-rw-r--r--2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h4
-rw-r--r--2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h25
-rw-r--r--2.3-1/src/c/hardware/avr/timer/u8AVRGetTimerValues.c37
-rw-r--r--2.3-1/src/c/hardware/avr/timer/u8AVRTimerSetups.c42
-rw-r--r--2.3-1/src/c/hardware/avr/uart/u8AVRUARTSetups.c84
-rw-r--r--2.3-1/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c1
22 files changed, 300 insertions, 36 deletions
diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin
index 6551c7f7..4f3c5917 100644
--- a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin
+++ b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin
Binary files differ
diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci
index 9d40d2b9..657258a9 100644
--- a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci
+++ b/2.3-1/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/2.3-1/macros/Hardware/AVR/AVRTimerSetup.bin b/2.3-1/macros/Hardware/AVR/AVRTimerSetup.bin
index 65e8f454..4a49b861 100644
--- a/2.3-1/macros/Hardware/AVR/AVRTimerSetup.bin
+++ b/2.3-1/macros/Hardware/AVR/AVRTimerSetup.bin
Binary files differ
diff --git a/2.3-1/macros/Hardware/AVR/AVRTimerSetup.sci b/2.3-1/macros/Hardware/AVR/AVRTimerSetup.sci
index 6316cdd7..1529c347 100644
--- a/2.3-1/macros/Hardware/AVR/AVRTimerSetup.sci
+++ b/2.3-1/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/2.3-1/macros/Hardware/AVR/AVRUARTSetup.sci b/2.3-1/macros/Hardware/AVR/AVRUARTSetup.sci
new file mode 100644
index 00000000..1529c347
--- /dev/null
+++ b/2.3-1/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/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.bin b/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.bin
index eed8be3b..0aa7587f 100644
--- a/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.bin
+++ b/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.bin
Binary files differ
diff --git a/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.sci b/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.sci
index 50a913fa..cce49f91 100644
--- a/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.sci
+++ b/2.3-1/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/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci b/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci
index db96e190..7322cead 100644
--- a/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci
+++ b/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci
@@ -4,7 +4,7 @@ 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/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
index be0c48fb..26530399 100644
--- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
+++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
Binary files differ
diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
index c3981a49..4aff7b74 100644
--- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
+++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
@@ -4175,8 +4175,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';
@@ -4200,8 +4200,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/2.3-1/macros/ToolInitialization/UpdateSCI2CInfo.sci b/2.3-1/macros/ToolInitialization/UpdateSCI2CInfo.sci
index 445507bb..253299a3 100644
--- a/2.3-1/macros/ToolInitialization/UpdateSCI2CInfo.sci
+++ b/2.3-1/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/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci
index 78138093..194a9ab5 100644
--- a/2.3-1/macros/findDeps/getAllInterfaces.sci
+++ b/2.3-1/macros/findDeps/getAllInterfaces.sci
@@ -134,7 +134,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/2.3-1/src/c/hardware/avr/includes/AVRPeripheralPWM.h b/2.3-1/src/c/hardware/avr/includes/AVRPeripheralPWM.h
index 80b29f3a..7371dd74 100644
--- a/2.3-1/src/c/hardware/avr/includes/AVRPeripheralPWM.h
+++ b/2.3-1/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/2.3-1/src/c/hardware/avr/includes/AVRPeripheralTimer.h b/2.3-1/src/c/hardware/avr/includes/AVRPeripheralTimer.h
new file mode 100644
index 00000000..78b04aae
--- /dev/null
+++ b/2.3-1/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/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h b/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h
index 0aafb8c0..425b03fc 100644
--- a/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h
+++ b/2.3-1/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/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h b/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h
index 439532db..c034718c 100644
--- a/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h
+++ b/2.3-1/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/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h b/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h
index 73686190..2d5e5cbd 100644
--- a/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h
+++ b/2.3-1/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/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h b/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h
new file mode 100644
index 00000000..b4b66bae
--- /dev/null
+++ b/2.3-1/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/2.3-1/src/c/hardware/avr/timer/u8AVRGetTimerValues.c b/2.3-1/src/c/hardware/avr/timer/u8AVRGetTimerValues.c
new file mode 100644
index 00000000..c542c182
--- /dev/null
+++ b/2.3-1/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/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;
+}
+
diff --git a/2.3-1/src/c/hardware/avr/uart/u8AVRUARTSetups.c b/2.3-1/src/c/hardware/avr/uart/u8AVRUARTSetups.c
new file mode 100644
index 00000000..f311500a
--- /dev/null
+++ b/2.3-1/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/2.3-1/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c b/2.3-1/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c
index 09dffd62..621afc80 100644
--- a/2.3-1/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c
+++ b/2.3-1/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c
@@ -12,6 +12,7 @@
#include "cmd_digital_out.h"
+
uint8 u8cmd_digital_outs(uint8 board_no, uint8 pin, uint8 value)
{
digitalWrite(pin,value);