diff options
Diffstat (limited to '2.3-1')
23 files changed, 149 insertions, 20 deletions
diff --git a/2.3-1/includes/sci2clib.h b/2.3-1/includes/sci2clib.h index b9820bcd..c1c82a35 100644 --- a/2.3-1/includes/sci2clib.h +++ b/2.3-1/includes/sci2clib.h @@ -330,7 +330,7 @@ #include "types.h" /*Scilab-arduino toolbox*/ -#ifdef ARDUINO +#ifdef Arduino1 #include "int_cmd_digital_out.h" #include "cmd_digital_out.h" #include "int_cmd_digital_in.h" @@ -344,12 +344,13 @@ #endif /*AVR*/ -#ifdef AVR +#ifdef AVR1 #include "int_AVRPeripheralGPIO.h" #include "AVRPeripheralGPIO.h" #include "int_AVRPeripheralADC.h" #include "AVRPeripheralADC.h" - +#include "int_AVRUtil.h" +#include "AVRUtil.h" #endif #endif /* !__SCI2CLIB_H__ */ diff --git a/2.3-1/macros/CCodeGeneration/C_InitHeader.bin b/2.3-1/macros/CCodeGeneration/C_InitHeader.bin Binary files differindex 4513310c..642e75c3 100644 --- a/2.3-1/macros/CCodeGeneration/C_InitHeader.bin +++ b/2.3-1/macros/CCodeGeneration/C_InitHeader.bin diff --git a/2.3-1/macros/CCodeGeneration/C_InitHeader.sci b/2.3-1/macros/CCodeGeneration/C_InitHeader.sci index 1d67b601..dffb9726 100644 --- a/2.3-1/macros/CCodeGeneration/C_InitHeader.sci +++ b/2.3-1/macros/CCodeGeneration/C_InitHeader.sci @@ -34,6 +34,12 @@ C_SCI2CHeader(HeaderFileName); PrintStringInfo('#ifndef '+tmpfname+'_h',HeaderFileName,'file','y'); PrintStringInfo('#define '+tmpfname+'_h',HeaderFileName,'file','y'); PrintStringInfo('/*',HeaderFileName,'file','y'); +PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('** ----- Target ------ ',HeaderFileName,'file','y'); +PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('*/',HeaderFileName,'file','y'); +PrintStringInfo('# define ' + OutFormat + '1 1' ,HeaderFileName,'file','y'); +PrintStringInfo('/*',HeaderFileName,'file','y'); PrintStringInfo('** ----------------------- ',HeaderFileName,'file','y'); PrintStringInfo('** --- SCI2C Includes. --- ',HeaderFileName,'file','y'); PrintStringInfo('** ----------------------- ',HeaderFileName,'file','y'); @@ -51,12 +57,6 @@ PrintStringInfo('extern ""C"" {',HeaderFileName,'file','y'); PrintStringInfo('#endif',HeaderFileName,'file','y'); PrintStringInfo('/*',HeaderFileName,'file','y'); PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); -PrintStringInfo('** ----- Target ------ ',HeaderFileName,'file','y'); -PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); -PrintStringInfo('*/',HeaderFileName,'file','y'); -PrintStringInfo('# define ' + OutFormat + '1' ,HeaderFileName,'file','y'); -PrintStringInfo('/*',HeaderFileName,'file','y'); -PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); PrintStringInfo('** --- Prototypes. --- ',HeaderFileName,'file','y'); PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); PrintStringInfo('*/',HeaderFileName,'file','y'); diff --git a/2.3-1/macros/Hardware/AVR/AVRADCSetup.bin b/2.3-1/macros/Hardware/AVR/AVRADCSetup.bin Binary files differindex 6cf45dc9..44e3d790 100644 --- a/2.3-1/macros/Hardware/AVR/AVRADCSetup.bin +++ b/2.3-1/macros/Hardware/AVR/AVRADCSetup.bin diff --git a/2.3-1/macros/Hardware/AVR/AVRADCSetup.sci b/2.3-1/macros/Hardware/AVR/AVRADCSetup.sci index d9897fc3..ce9117d0 100644 --- a/2.3-1/macros/Hardware/AVR/AVRADCSetup.sci +++ b/2.3-1/macros/Hardware/AVR/AVRADCSetup.sci @@ -2,7 +2,7 @@ function AVRADCSetup(prescalar,adc_ref) // Function to initialise ADC of AVR // // Calling Sequence -// AVRSetupADC(uint8 prescalar, uint8 adc_ref) +// AVRADCSetup(uint8 prescalar, uint8 adc_ref) // // Parameters // prescalar: prescalar to be used for generating ADC clock (0-7) diff --git a/2.3-1/macros/Hardware/AVR/AVRPWMSetup.bin b/2.3-1/macros/Hardware/AVR/AVRPWMSetup.bin Binary files differnew file mode 100644 index 00000000..6ae56fda --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/AVRPWMSetup.bin diff --git a/2.3-1/macros/Hardware/AVR/AVRPWMSetup.sci b/2.3-1/macros/Hardware/AVR/AVRPWMSetup.sci new file mode 100644 index 00000000..7e1c234f --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/AVRPWMSetup.sci @@ -0,0 +1,39 @@ +function AVRPWMSetup(timer, prescalar, waveform_mode, output_mode) +// Function to initialise PWM of AVR +// +// Calling Sequence +// AVRSetupADC(timer, prescalar, waveform_mode, output_mode) +// +// Parameters +// timer: timer to be used for PWM generation (0,1,2) +// prescalar: prescalar to be used for generating PWM waveform (0-7) +// waveform_mode: decides type of waveform generation +// 0 -> Normal mode +// 1 -> Phase correct mode +// 2 -> CTC mode +// 3 -> Fase PWM mode +// output_mode: decides the compare output mode. (0-3) +// behaviour of the output is different for different inputs +// depending upon 'waveform_mode' chosen. +// ***Refer datasheet for more description about above modes +// +// Description +// This function initialises PWM of AVR with given parameters. 'timer' +// decides which of the three (0,1,2) timers available to be used. The +// 'prescalar' is needed for deciding PWM clock. Select appropriate prescalar +// depending on MCU clock. Choose required pwmmode using 'waveform_generation' +// and 'output_mode'. Please refer datasheet for more description of 'wafefom_mode' +// and 'output mode'. +// Examples +// AVRPWMSetup(0,1,2,2) +// +// See also +// AVRPMWSetDuty +// +// 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/lib b/2.3-1/macros/Hardware/AVR/lib Binary files differindex d08afbd3..aa4d6113 100644 --- a/2.3-1/macros/Hardware/AVR/lib +++ b/2.3-1/macros/Hardware/AVR/lib diff --git a/2.3-1/macros/Hardware/AVR/names b/2.3-1/macros/Hardware/AVR/names index 6e5b61bd..afd171ec 100644 --- a/2.3-1/macros/Hardware/AVR/names +++ b/2.3-1/macros/Hardware/AVR/names @@ -2,6 +2,7 @@ AVRADCSetup AVRDigitalIn AVRDigitalOut AVRDigitalSetup +AVRPWMSetup AVRReadADC GetAVRSupportFunctions GetPeripheral diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin Binary files differindex b2642d44..f790c5e8 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 6d829ceb..c6423531 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -982,7 +982,6 @@ ClassName = 'Max'; // --- Class Annotation. ---
-disp("Inside Max Function");
PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
PrintStringInfo('NIN= 1',ClassFileName,'file','y');
@@ -4033,6 +4032,33 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
//------------------------------------
+//---- Class AVRDigitalOut -----------
+//------------------------------------
+ClassName = 'AVRDigitalIn';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+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('d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRDigitalIn';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+//------------------------------------
//---- Class AVRADCSetup -----------
//------------------------------------
ClassName = 'AVRADCSetup';
diff --git a/2.3-1/macros/findDeps/getAllHeaders.bin b/2.3-1/macros/findDeps/getAllHeaders.bin Binary files differindex 4314c53a..50ce832f 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.bin +++ b/2.3-1/macros/findDeps/getAllHeaders.bin diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index f5c74bd0..697a0fa6 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -139,6 +139,7 @@ function allHeaders = getAllHeaders(OutFormat) AVR_headers = [ "src/c/hardware/avr/includes/AVRPeripheralGPIO.h" "src/c/hardware/avr/includes/AVRPeripheralADC.h" + "src/c/hardware/avr/includes/AVRUtil.h" ]; if OutFormat == "StandAlone" diff --git a/2.3-1/macros/findDeps/getAllInterfaces.bin b/2.3-1/macros/findDeps/getAllInterfaces.bin Binary files differindex b49fdbf0..c28ac331 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.bin +++ b/2.3-1/macros/findDeps/getAllInterfaces.bin diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci index 5b52c71a..14249d08 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -133,6 +133,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_AVRUtil.h" ]; if OutFormat == "StandAlone" diff --git a/2.3-1/macros/findDeps/getAllSources.bin b/2.3-1/macros/findDeps/getAllSources.bin Binary files differindex 49439778..b1591ac4 100644 --- a/2.3-1/macros/findDeps/getAllSources.bin +++ b/2.3-1/macros/findDeps/getAllSources.bin diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci index 956f7be1..325d4b23 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -831,7 +831,7 @@ function allSources = getAllSources(OutFormat) "src/c/hardware/avr/gpio/u8AVRDigitalIns.c" "src/c/hardware/avr/adc/u8AVRADCSetups.c" "src/c/hardware/avr/adc/u8AVRReadADCs.c" - "src/c/scilab-arduino/sleep/u16sleeps.c" + "src/c/hardware/avr/util/u16AVRSleeps.c" ]; diff --git a/2.3-1/src/c/hardware/avr/includes/AVRUtil.h b/2.3-1/src/c/hardware/avr/includes/AVRUtil.h index 2e6d9ae4..0aa1923f 100644 --- a/2.3-1/src/c/hardware/avr/includes/AVRUtil.h +++ b/2.3-1/src/c/hardware/avr/includes/AVRUtil.h @@ -13,10 +13,10 @@ extern "C" { #endif -#include "Types.h" -#include "avr/util.h" +#include "types.h" +#include "util/delay.h" -uint8 U16AVRSleeps (uint16 delay); +uint8 u16AVRSleeps (uint16 delay); #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 a4f9b91d..439532db 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 @@ -23,6 +23,10 @@ extern "C" { #define d0d0d0AVRDigitalOutu80(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_AVRUtil.h b/2.3-1/src/c/hardware/avr/interfaces/int_AVRUtil.h index ce96951b..2d6bbef7 100644 --- a/2.3-1/src/c/hardware/avr/interfaces/int_AVRUtil.h +++ b/2.3-1/src/c/hardware/avr/interfaces/int_AVRUtil.h @@ -14,7 +14,7 @@ extern "C" { #endif -#define d0sleepu80(in1) U16AVRSleeps ((uint16) in1); +#define d0sleepu80(in1) u16AVRSleeps ((uint16) in1); #ifdef __cplusplus } /* extern "C" */ diff --git a/2.3-1/src/c/hardware/avr/pwm/u8AVRADCSetups.c b/2.3-1/src/c/hardware/avr/pwm/u8AVRADCSetups.c new file mode 100644 index 00000000..cd1d12bb --- /dev/null +++ b/2.3-1/src/c/hardware/avr/pwm/u8AVRADCSetups.c @@ -0,0 +1,56 @@ +// Function to initialise PWM of AVR +// +// Calling Sequence +// u8AVRPWMSetups(uint8 timer, uint8 prescalar, uint8 waveform_mode, uint8 output_mode) +// +// Parameters +// timer: timer to be used for PWM generation (0,1,2) +// prescalar: prescalar to be used for generating PWM waveform (0-7) +// waveform_mode: decides type of waveform generation +// 0 -> Normal mode +// 1 -> Phase correct mode +// 2 -> CTC mode +// 3 -> Fase PWM mode +// output_mode: decides the compare output mode. (0-3) +// behaviour of the output is different for different inputs +// depending upon 'waveform_mode' chosen. +// ***Refer datasheet for more description about above modes +// +// Description +// This function initialises PWM of AVR with given parameters. 'timer' +// decides which of the three (0,1,2) timers available to be used. The +// 'prescalar' is needed for deciding PWM clock. Select appropriate prescalar +// depending on MCU clock. Choose required pwmmode using 'waveform_generation' +// and 'output_mode'. Please refer datasheet for more description of 'wafefom_mode' +// and 'output mode'. +// Examples +// AVRPWMSetup(0,1,2,2) +// +// Authors +// Siddhesh Wani +// + +#include "AVRPeripheralPWM.h" + + +uint8 u8AVRPWMSetups(uint8 timer, uint8 prescalar, uint8 waveform_mode, uint8 output_mode) +{ + switch(timer) + { + case 0: + TCCR0|= (prescalar & 0x07); //Select clock source + //Select waveform generation mode + TCCR0|= ((waveform_mode & 0x04) << 4); + //Select compare output mode + TCCR0 |= ((output_mode & 0x01) << 3); //WGM0 + TCCR0 |= ((output_mode & 0x02) << 6); //WGM1 + break; + case 1: + break; + case 2: + break; + } + + return 0; +} + diff --git a/2.3-1/src/c/hardware/avr/util/U16AVRSleeps.c b/2.3-1/src/c/hardware/avr/util/u16AVRSleeps.c index f2144717..4d81c964 100644 --- a/2.3-1/src/c/hardware/avr/util/U16AVRSleeps.c +++ b/2.3-1/src/c/hardware/avr/util/u16AVRSleeps.c @@ -6,9 +6,9 @@ #include "AVRUtil.h" -uint8 U16AVRSleeps (uint16 delay) +uint8 u16AVRSleeps (uint16 delay) { _delay_ms(delay); - retrun 0; + return 0; } diff --git a/2.3-1/src/c/scilab-arduino/default_files/Makefile b/2.3-1/src/c/scilab-arduino/default_files/Makefile index 2b888f05..5432fcfd 100644 --- a/2.3-1/src/c/scilab-arduino/default_files/Makefile +++ b/2.3-1/src/c/scilab-arduino/default_files/Makefile @@ -4,7 +4,7 @@ ARDUINO_DIR = /usr/share/arduino ARDMK_DIR = /usr/share/arduino AVR_TOOLS_DIR = /usr BOARD_TAG = uno -USER_LIB_PATH = ../../ -ARDUINO_LIBS = src/c includes interfaces ../Temp +USER_LIB_PATH = ../ +ARDUINO_LIBS = ../src/c ../includes ../interfaces ../ ARDUINO_PORT = /dev/ttyACM0 include /usr/share/arduino/Arduino.mk |