diff options
author | siddhu8990 | 2017-04-19 14:28:34 +0530 |
---|---|---|
committer | siddhu8990 | 2017-04-19 14:28:34 +0530 |
commit | 9e506f48291533cba7b4c555b0d2e98f234bfbe3 (patch) | |
tree | 6ffe38eefea51cdb767493850b2ada0c098fe416 | |
parent | 453598b49cb3d4a62b1797dbc90f0e3dd4521329 (diff) | |
download | Scilab2C_fossee_old-9e506f48291533cba7b4c555b0d2e98f234bfbe3.tar.gz Scilab2C_fossee_old-9e506f48291533cba7b4c555b0d2e98f234bfbe3.tar.bz2 Scilab2C_fossee_old-9e506f48291533cba7b4c555b0d2e98f234bfbe3.zip |
Merged Ashish's work
208 files changed, 5626 insertions, 595 deletions
diff --git a/includes/sci2clib.h b/includes/sci2clib.h index d9de9a0..2028e08 100644 --- a/includes/sci2clib.h +++ b/includes/sci2clib.h @@ -67,9 +67,45 @@ extern "C" { /* ELEMENTARY FUNCTIONS */ +/* interfacing atand */ +#include "atand.h" +#include "int_atand.h" +/* interfacing asind */ +#include "asind.h" +#include "int_asind.h" +/* interfacing asech */ +#include "asech.h" +#include "int_asech.h" +/* interfacing asecd */ +#include "asecd.h" +#include "int_asecd.h" +/* interfacing asec */ +#include "asec.h" +#include "int_asec.h" +/* interfacing acsch */ +#include "acsch.h" +#include "int_acsch.h" +/* interfacing acscd */ +#include "acscd.h" +#include "int_acscd.h" +/* interfacing acsc */ +#include "acsc.h" +#include "int_acsc.h" +/* interfacing acoth */ +#include "acoth.h" +#include "int_acoth.h" +/* interfacing acotd */ +#include "acotd.h" +#include "int_acotd.h" +/* interfacing acot */ +#include "acot.h" +#include "int_acot.h" /* interfacing acos */ #include "acos.h" #include "int_acos.h" +/* interfacing acosd */ +#include "acosd.h" +#include "int_acosd.h" /* interfacing acosh */ #include "acosh.h" #include "int_acosh.h" @@ -435,6 +471,10 @@ extern "C" { #include "AVRPeripheralPWM.h" #include "int_AVRUtil.h" #include "AVRUtil.h" +#include "int_AVRPeripheralTimer.h" +#include "AVRPeripheralTimer.h" +#include "int_AVRPeripheralUART.h" +#include "AVRPeripheralUART.h" #endif /*RPi*/ diff --git a/macros/ASTManagement/lib b/macros/ASTManagement/lib Binary files differindex 36d91de..7f0e1d7 100644 --- a/macros/ASTManagement/lib +++ b/macros/ASTManagement/lib diff --git a/macros/CCodeGeneration/C_GenDeclarations.bin b/macros/CCodeGeneration/C_GenDeclarations.bin Binary files differindex c3b3600..62636dc 100644 --- a/macros/CCodeGeneration/C_GenDeclarations.bin +++ b/macros/CCodeGeneration/C_GenDeclarations.bin diff --git a/macros/CCodeGeneration/lib b/macros/CCodeGeneration/lib Binary files differindex 9007df7..2d0fc0f 100644 --- a/macros/CCodeGeneration/lib +++ b/macros/CCodeGeneration/lib diff --git a/macros/ErrorMessages/lib b/macros/ErrorMessages/lib Binary files differindex 2b3ee2f..e989c7f 100644 --- a/macros/ErrorMessages/lib +++ b/macros/ErrorMessages/lib diff --git a/macros/FunctionAnnotation/lib b/macros/FunctionAnnotation/lib Binary files differindex b36e12c..9f0b806 100644 --- a/macros/FunctionAnnotation/lib +++ b/macros/FunctionAnnotation/lib diff --git a/macros/FunctionList/lib b/macros/FunctionList/lib Binary files differindex 74542a2..006272f 100644 --- a/macros/FunctionList/lib +++ b/macros/FunctionList/lib diff --git a/macros/GeneralFunctions/lib b/macros/GeneralFunctions/lib Binary files differindex a3af87e..9d15387 100644 --- a/macros/GeneralFunctions/lib +++ b/macros/GeneralFunctions/lib diff --git a/macros/Hardware/AVR/AVRADCSetup.bin b/macros/Hardware/AVR/AVRADCSetup.bin Binary files differindex 44e3d79..25352e5 100644 --- a/macros/Hardware/AVR/AVRADCSetup.bin +++ b/macros/Hardware/AVR/AVRADCSetup.bin diff --git a/macros/Hardware/AVR/AVRADCSetup.sci b/macros/Hardware/AVR/AVRADCSetup.sci index ce9117d..264062b 100644 --- a/macros/Hardware/AVR/AVRADCSetup.sci +++ b/macros/Hardware/AVR/AVRADCSetup.sci @@ -1,32 +1,47 @@ -function AVRADCSetup(prescalar,adc_ref) +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function AVRADCSetup(prescaler,adc_ref) // Function to initialise ADC of AVR // // Calling Sequence -// AVRADCSetup(uint8 prescalar, uint8 adc_ref) +// AVRADCSetup(uint8 prescaler, uint8 adc_ref) // // Parameters -// prescalar: prescalar to be used for generating ADC clock (0-7) +// prescaler: prescaler to be used for generating ADC clock (0-7) // adc_ref : reference voltage to be used for ADC conversion // 0 -> Voltage on VREF pin // 1 -> Voltage on AVCC pin // 2 -> Internal 2.56 reference voltage // // Description -// This function initialises ADc of AVR with given parameters. 'prescalar' is +// This function initialises ADc of AVR with given parameters. 'prescaler' is // needed for deciding ADC clock. ADC clock should be between 50KHz and 200KHz -// and it given as (MCU clock/2^prescalar). Select appropriate prescalar depending +// and it given as (MCU clock/2^prescaler). Select appropriate prescaler depending // on MCU clock. 'adc_ref' selects one of the available reference voltage sources // available // Examples // AVRADCSetup(128,0) - // See also // AVRReadADC // // Authors -// Siddhesh Wani +// Siddhesh Wani Ashish Kamble // - // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. + +if(prescaler>=8) +disp("Error : Invalid input argument ''prescaler'' in AVRADCSetup function."); +end +if(adc_ref>=3) then +disp("Error : Invalid input argument ''adc_ref'' in AVRADCSetup function."); +end endfunction diff --git a/macros/Hardware/AVR/AVRDigitalIn.bin b/macros/Hardware/AVR/AVRDigitalIn.bin Binary files differindex 7ff2c98..e88f6a6 100644 --- a/macros/Hardware/AVR/AVRDigitalIn.bin +++ b/macros/Hardware/AVR/AVRDigitalIn.bin diff --git a/macros/Hardware/AVR/AVRDigitalIn.sci b/macros/Hardware/AVR/AVRDigitalIn.sci index ef57564..54eb327 100644 --- a/macros/Hardware/AVR/AVRDigitalIn.sci +++ b/macros/Hardware/AVR/AVRDigitalIn.sci @@ -1,3 +1,14 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + + function state = AVRDigitalIn(port,pin) // Function to get state (high\low) of a digital input pin on AVR // @@ -24,9 +35,16 @@ function state = AVRDigitalIn(port,pin) // // // Authors -// Siddhesh Wani +// Siddhesh Wani Ashish Kamble // - // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. + +if((port==0)|(port>=5)) then +disp("Error : Inavalid input argument ''port'' in AVRDigitalIn function."); +end +if(pin>=8) then +disp("Error : Inavalid input argument ''pin'' in AVRDigitalIn function."); +end +state = 0; endfunction diff --git a/macros/Hardware/AVR/AVRDigitalOut.bin b/macros/Hardware/AVR/AVRDigitalOut.bin Binary files differindex 7a09b0d..d0dcb55 100644 --- a/macros/Hardware/AVR/AVRDigitalOut.bin +++ b/macros/Hardware/AVR/AVRDigitalOut.bin diff --git a/macros/Hardware/AVR/AVRDigitalOut.sci b/macros/Hardware/AVR/AVRDigitalOut.sci index f17c8a0..a86a5aa 100644 --- a/macros/Hardware/AVR/AVRDigitalOut.sci +++ b/macros/Hardware/AVR/AVRDigitalOut.sci @@ -1,3 +1,13 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + function AVRDigitalOut(port,pin,state) // Function to change state (high\low) of a digital output pin on AVR // @@ -24,9 +34,18 @@ function AVRDigitalOut(port,pin,state) // // // Authors -// Siddhesh Wani +// Siddhesh Wani Ashish Kamble // - // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. + +if((port==0)|(port>=8)) then +disp("Error : Inavalid input argument ''port'' in AVRDigitalOut function."); +end +if(pin>=8) then +disp("Error : Invalid input argument ''pin'' in AVRDigitalOut function."); +end +if(state>=2) then +disp("Error : Invalid input argument ''state'' in AVRDigitalOut function."); +end endfunction diff --git a/macros/Hardware/AVR/AVRDigitalPortSetup.bin b/macros/Hardware/AVR/AVRDigitalPortSetup.bin Binary files differnew file mode 100644 index 0000000..dacf6a3 --- /dev/null +++ b/macros/Hardware/AVR/AVRDigitalPortSetup.bin diff --git a/macros/Hardware/AVR/AVRDigitalPortSetup.sci b/macros/Hardware/AVR/AVRDigitalPortSetup.sci new file mode 100644 index 0000000..5f0b967 --- /dev/null +++ b/macros/Hardware/AVR/AVRDigitalPortSetup.sci @@ -0,0 +1,47 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function AVRDigitalPortSetup(port,direction) +// Function to decide direction of port on AVR +// +// Calling Sequence +// AVRDigitalPortSetup(port,direction) +// +// Parameters +// port : port of microcontroller to be used(1 for PORTA, 2 for PORTB,...) +// direction : direction to be set for pin (0 for INPUT, 1 for OUTPUT) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs/inputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port to be +// used as digital output/input. Also, desired direction must be specified as +// 'INPUT' or 'OUTPUT'. +// +// Examples +// AVRDigitalPortSetup(1,0); //This function will make PortA as input port +// +// See also +// AVRDigitalIn AVRDigitalOut +// +// +// Authors +// Siddhesh Wani Ashish Kamble +// +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. + +if((port==0)|(port>=5)) then +disp("Error : Invalid input argument ''port'' in AVRDigitalPortSetup function."); +end +if(direction>=2) then +disp("Error : Invalid input argument ''direction'' in AVRDigitalPortSetup function."); +end +endfunction diff --git a/macros/Hardware/AVR/AVRDigitalSetup.bin b/macros/Hardware/AVR/AVRDigitalSetup.bin Binary files differindex 98a592e..60b0749 100644 --- a/macros/Hardware/AVR/AVRDigitalSetup.bin +++ b/macros/Hardware/AVR/AVRDigitalSetup.bin diff --git a/macros/Hardware/AVR/AVRDigitalSetup.sci b/macros/Hardware/AVR/AVRDigitalSetup.sci index 3de56c2..e707d4f 100644 --- a/macros/Hardware/AVR/AVRDigitalSetup.sci +++ b/macros/Hardware/AVR/AVRDigitalSetup.sci @@ -1,9 +1,19 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + function AVRDigitalSetup(port,pin,direction) // Function to decide direction of a digital pin on AVR // // Calling Sequence // AVRDigitalSetup(port,pin,direction) -// +// // Parameters // port : port of microcontroller to be used // pin : pin of port (mentioned above) to be used @@ -24,9 +34,18 @@ function AVRDigitalSetup(port,pin,direction) // // // Authors -// Siddhesh Wani +// Siddhesh Wani Ashish Kamble // - // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. + +if((port==0)|(port>=5)) then +disp("Error : Invalid input argument ''port'' in AVRDigitalSetup function."); +end +if(pin>=8) then +disp("Error : Invalid input argument ''pin'' in AVRDigitalSetup function."); +end +if(direction>=2) then +disp("Error : Invalid input argument ''direction'' in AVRDigitalSetup function."); +end endfunction diff --git a/macros/Hardware/AVR/AVRGetTimerValue.bin b/macros/Hardware/AVR/AVRGetTimerValue.bin Binary files differindex 26b4b47..82f8ed4 100644 --- a/macros/Hardware/AVR/AVRGetTimerValue.bin +++ b/macros/Hardware/AVR/AVRGetTimerValue.bin diff --git a/macros/Hardware/AVR/AVRGetTimerValue.sci b/macros/Hardware/AVR/AVRGetTimerValue.sci index ab0146a..afb47ac 100644 --- a/macros/Hardware/AVR/AVRGetTimerValue.sci +++ b/macros/Hardware/AVR/AVRGetTimerValue.sci @@ -1,31 +1,40 @@ -function counts = AVRGetTimerValue(timer) -// Function to set the prescalar for timer. +// Copyright (C) 2017 - IIT Bombay - FOSSEE // -// Calling Sequence -// AVRgetTimerValue(timer, prescalar) +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function count = AVRGetTimerValue(timer) +// Function to get timer count // // Parameters -// timer: timer to be set up (0,1,2) -// prescalar: prescalar to be used for generating PWM waveform (0-7) -// ***Refer datasheet for more description about timer +// timer : timer whose current count is to be returned +// 0 for timer0 +// 1 for timer1 +// 2 for timer2 // // 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. -// +// This function returns the count value of a desired timer.By knowing the count value +// certain interrupt action can be taken. // // Examples -// AVRTimerSetup(0,1) //Timer 0 with no scaling +// AVRGetTimerValue(0); //returns present count of the TCNT0 counter // // See also -// AVRGetTimerValue +// AVRTimerSetup // // Authors -// Siddhesh Wani +// Ashish Kamble // - // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. + +if(timer>=3) then +disp("Error : Invalid input argument ''timer'' in AVRGetTimerValue function."); +end +count = 0; endfunction diff --git a/macros/Hardware/AVR/AVRPWM0SetDuty.bin b/macros/Hardware/AVR/AVRPWM0SetDuty.bin Binary files differnew file mode 100644 index 0000000..bc15dd3 --- /dev/null +++ b/macros/Hardware/AVR/AVRPWM0SetDuty.bin diff --git a/macros/Hardware/AVR/AVRPWM0SetDuty.sci b/macros/Hardware/AVR/AVRPWM0SetDuty.sci new file mode 100644 index 0000000..604d2f4 --- /dev/null +++ b/macros/Hardware/AVR/AVRPWM0SetDuty.sci @@ -0,0 +1,35 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function AVRPWM0SetDuty(duty) +//Function to Set Duty cycle of PWM Output generated by Timer0 at OC0 pin. +//Parameters +// duty : It holds an integer value from 0 to 100 which sets the percentage +// of time for which signal is active. +//Description +// Each Micro controller has PWM output pins which can generate varying voltage +// from 0V-5V.In this function by varying the duty cycle, varying voltage can be +// produced. +//Example +// AVRPWM0SetDuty(50); //Produces 2.5V at OC0 pin +// AVRPWM0SetDuty(0); //Produces 0V at OC0 pin +//See also +// AVRPWM0Setup +// +//Authors +// Ashish Kamble +// +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. + +if(duty>100) then +disp("Error : Invalid input argument ''duty'' in AVRPWM0SetDuty function."); +end +endfunction diff --git a/macros/Hardware/AVR/AVRPWM0Setup.bin b/macros/Hardware/AVR/AVRPWM0Setup.bin Binary files differnew file mode 100644 index 0000000..0886704 --- /dev/null +++ b/macros/Hardware/AVR/AVRPWM0Setup.bin diff --git a/macros/Hardware/AVR/AVRPWM0Setup.sci b/macros/Hardware/AVR/AVRPWM0Setup.sci new file mode 100644 index 0000000..39861c8 --- /dev/null +++ b/macros/Hardware/AVR/AVRPWM0Setup.sci @@ -0,0 +1,68 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function AVRPWM0Setup(waveform_mode,output_mode) +//Function to Setup OC0 pin for required PWM mode +//Description +// Every Micro controller has PWM pins which can generate varying voltages +// from 0V-5V.This function helps to use OC0 pin to produce required +// output waveform by setting the waveform mode and otput mode. +// +//Parameters +// waveform_mode: +// 0 for Phase correct PWM Mode +// 1 for Fast PWM Mode +// 2 for CTC Mode +// output_mode: +// For Phase Correct PWM Mode: +// 0 for Clear OC0 on compare match when up-counting. Set OC0 on compare +// match when down-counting. +// 1 for Set OC0 on compare match when up-counting. Clear OC0 on compare +// match when down-counting. +// +// For Fast PWM Mode: +// 0 for non-inverted output i.e Clear OC0 on compare match, set OC0 at BOTTOM. +// 1 for inverted output i.e Set OC0 on compare match, clear OC0 at BOTTOM. +// +// For CTC Mode: +// 0 to Clear OC0 on compare match +// 1 to Set OC0 on compare match +// 2 to toggle OC0 on compare match +// +//Example +// AVRPWM0Setup(2,0); //This function will select CTC waveform mode and will clear OC0 on +// compare match +//See also +// AVRPWM0SetDuty +// +//Authors +// Ashish Kamble +// +//This is curretly dummy function. It provides no functionality but is required +//for providing support for generating C code for AVR. + +if(waveform_mode>=3) then +disp("Error : Invalid input argument ''waveform_mode'' in AVRPWM0Setup function."); +end + +if((waveform_mode==0)|(waveform_mode==1)) then + if(output_mode>=2) then + disp("Error : Invalid input argument ''output_mode'' in AVRPWM0Setup function."); + end +end + + +if(waveform_mode==2) then + if(output_mode>=3) then + disp("Error : Invalid input argument ''output_mode'' in AVRPWM0Setup function."); + end +end + +endfunction diff --git a/macros/Hardware/AVR/AVRPWM1SetDuty.bin b/macros/Hardware/AVR/AVRPWM1SetDuty.bin Binary files differnew file mode 100644 index 0000000..36567db --- /dev/null +++ b/macros/Hardware/AVR/AVRPWM1SetDuty.bin diff --git a/macros/Hardware/AVR/AVRPWM1SetDuty.sci b/macros/Hardware/AVR/AVRPWM1SetDuty.sci new file mode 100644 index 0000000..60dc0a9 --- /dev/null +++ b/macros/Hardware/AVR/AVRPWM1SetDuty.sci @@ -0,0 +1,52 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function AVRPWM1SetDuty(output_pin,duty,Top_Value) +//Function to Set Duty cycle of PWM Output generated by Timer1 at OC1A or OC1B pin. +//Parameters +// ouput_pin: +// 0 for selecting OC1A as output pin +// 1 for selecting OC1B as output pin +// +// duty: It holds an integer value from 0 to 100 which sets the percentage +// of time for which signal is active. +// +// Top_Value: It holds an integer value from 0 to 65535.This value sets the Top +// value of the counter TCNT1 i.e ICR.(for more info refer datasheet) +// +//Description +// Each Micro controller has PWM output pins which can generate varying voltage +// from 0V-5V.This function Sets the duty cycle of output PWM signal.Also this function +// decides the Top Vale of TCNT1 and the output pin to output PWM signal. +// +//Example +// AVRPWM1SetDuty(0,50,40000); //This function will produce PWM signal of 50% duty +// cycle on OC1A pin and TCNT1 will reset at 40000 instead +// at 65535. +// +//See also +// AVRPWM1Setup +// +//Authors +// Ashish Kamble +// +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. + +if(output_pin>=2) then +disp("Error : Invalid input argument ''output_pin'' in AVRPWM1SetDuty function."); +end +if(duty>100) then +disp("Error : Invalid input argument ''duty'' in AVRPWM1SetDuty function."); +end +if(Top_Value>65535) then +disp("Error : Invalid input argument ''Top_Value'' in AVRPWM1Setduty function."); +end +endfunction diff --git a/macros/Hardware/AVR/AVRPWM1Setup.bin b/macros/Hardware/AVR/AVRPWM1Setup.bin Binary files differnew file mode 100644 index 0000000..d0b17c2 --- /dev/null +++ b/macros/Hardware/AVR/AVRPWM1Setup.bin diff --git a/macros/Hardware/AVR/AVRPWM1Setup.sci b/macros/Hardware/AVR/AVRPWM1Setup.sci new file mode 100644 index 0000000..51aa25b --- /dev/null +++ b/macros/Hardware/AVR/AVRPWM1Setup.sci @@ -0,0 +1,79 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function AVRPWM1Setup(waveform_mode,output_mode,output_pin) +//Function to Setup OC1A or OC1B pin for required PWM mode +//Description +// Every Micro controller has PWM pins which can generate varying voltages +// from 0V-5V.This function helps to use OC1A or OC1B pin to produces required +// output waveform by setting the waveform mode and otput mode. +// +//Parameters +// waveform_mode: +// 0 for Phase correct PWM Mode +// 1 for Fast PWM Mode +// 2 for CTC Mode +// +// output_mode: +// For Phase Correct PWM Mode: +// 0 for Clear OC1A or OC1B on compare match when up-counting. Set OC1A or OC1B +// on compare match when down-counting. +// 1 for Set OC1A or OC1B on compare match when up-counting. Clear OC1A or OC1B +// on compare match when down-counting. +// +// For Fast PWM Mode: +// 0 for non-inverted output i.e Clear OC1A or OC1B on compare match, set OC1A +// OC1B at BOTTOM. +// 1 for inverted output i.e Set OC1A or OC1B on compare match, clear OC1A or OC1B +// at BOTTOM. +// +// For CTC Mode: +// 0 to Clear OC1A or OC1B on compare match +// 1 to Set OC1A or OC1B on compare match +// 2 to toggle OC1A or OC1B on compare match +// +// output_pin: +// 0 for selecting OC1A as output pin +// 1 for selecting OC1B as output pin +// +//Example +// AVRPWM1Setup(2,0,0); //This function will select CTC mode and will clear OC1A or OC1B +// on compare match.Also as defined the output will be produced at +// 0C1A pin. +//See also +// AVRPWM1SetDuty +// +//Authors +// Ashish Kamble +// +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. + +if(waveform_mode>=3) then +disp("Error : Invalid input argument ''waveform_mode'' in AVRPWM1Setup function."); +end +if(waveform_mode==0|waveform_mode==1) then +{ + //if((type(output_mode)~=8)|(output_mode>=2)) then + //disp("Error : Invalid input argument ''output_mode'' in AVRPWM1Setup function."); + //end +} +end +if(waveform_mode==2) then +{ + if((type(output_mode)~=8)|(output_mode>=3)) then + disp("Error : Invalid input argument ''output_mode'' in AVRPWM1Setup function."); + end +} +end +if(output_pin>=2) then +disp("Error : Invalid input argument ''output_pin'' in AVRPWM1Setup function."); +end +endfunction diff --git a/macros/Hardware/AVR/AVRPWM2SetDuty.bin b/macros/Hardware/AVR/AVRPWM2SetDuty.bin Binary files differnew file mode 100644 index 0000000..47fb532 --- /dev/null +++ b/macros/Hardware/AVR/AVRPWM2SetDuty.bin diff --git a/macros/Hardware/AVR/AVRPWM2SetDuty.sci b/macros/Hardware/AVR/AVRPWM2SetDuty.sci new file mode 100644 index 0000000..929c1a0 --- /dev/null +++ b/macros/Hardware/AVR/AVRPWM2SetDuty.sci @@ -0,0 +1,38 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function AVRPWM2SetDuty(duty) +//Function to Set Duty cycle of PWM Output generated by Timer2 at OC2 pin. +//Description +// Each Micro controller has PWM output pins which can generate varying voltage +// from 0V-5V.In this function by varying the duty cycle, varying voltage can be +// produced. +// +//Parameters +// duty : It holds an integer value from 0 to 100 which sets the percentage +// of time for which signal is active. +// +//Example +// AVRPWM2SetDuty(50); //Produces 2.5V at OC2 pin +// AVRPWM2SetDuty(0); //Produces 0V at OC2 pin +// +//See also +// AVRPWM2Setup +// +//Authors +// Ashish Kamble +// +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. + +if(duty>100) then +disp("Error : Invalid input argument ''duty'' in AVRPWM2SetDuty function."); +end +endfunction diff --git a/macros/Hardware/AVR/AVRPWM2Setup.bin b/macros/Hardware/AVR/AVRPWM2Setup.bin Binary files differnew file mode 100644 index 0000000..66996c0 --- /dev/null +++ b/macros/Hardware/AVR/AVRPWM2Setup.bin diff --git a/macros/Hardware/AVR/AVRPWM2Setup.sci b/macros/Hardware/AVR/AVRPWM2Setup.sci new file mode 100644 index 0000000..d4bc74a --- /dev/null +++ b/macros/Hardware/AVR/AVRPWM2Setup.sci @@ -0,0 +1,69 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function AVRPWM2Setup(waveform_mode,output_mode) +//Function to Setup OC2 pin for required PWM mode +//Description +// Every Micro controller has PWM pins which can generate varying voltages +// from 0V-5V.This function helps to use OC2 pin to produces required +// output waveform by setting the waveform mode and otput mode. +// +//Parameters +// waveform_mode: +// 0 for Phase correct PWM Mode +// 1 for Fast PWM Mode +// 2 for CTC Mode +//output_mode: +// For Phase Correct PWM Mode: +// 0 for Clear OC2 on compare match when up-counting. Set OC2 on compare +// match when down-counting. +// 1 for Set OC2 on compare match when up-counting. Clear OC2 on compare +// match when down-counting. +// +// For Fast PWM Mode: +// 0 for non-inverted output i.e Clear OC2 on compare match, set OC2 at BOTTOM. +// 1 for inverted output i.e Set OC2 on compare match, clear OC2 at BOTTOM. +// +// For CTC Mode: +// 0 to Clear OC2 on compare match +// 1 to Set OC2 on compare match +// 2 to toggle OC2 on compare match +// +//Example +// AVRPWM2Setup(2,0); //This function will select CTC waveform mode and will clear OC2 on +// compare match +//See also +// AVRPWM2SetDuty +// +//Authors +// Ashish Kamble +// +//This is curretly dummy function. It provides no functionality but is required +//for providing support for generating C code for AVR. + +if(waveform_mode>=3) then +disp("Error : Invalid input argument ''waveform_mode'' in AVRPWM2Setup function."); +end +if((waveform_mode==0)|(waveform_mode==1)) then +{ + //if((type(output_mode)~=8)|(output_mode>=2)) then + //disp("Error : Invalid input argument ''output_mode'' in AVRPWM2Setup function."); + //end +} +end +if(waveform_mode==2) then +{ + if((type(output_mode)~=8)|(output_mode>=3)) then + disp("Error : Invalid input argument ''output_mode'' in AVRPWM2Setup function."); + end +} +end + +endfunction diff --git a/macros/Hardware/AVR/AVRPWMSetDuty.bin b/macros/Hardware/AVR/AVRPWMSetDuty.bin Binary files differdeleted file mode 100644 index f3c9e3e..0000000 --- a/macros/Hardware/AVR/AVRPWMSetDuty.bin +++ /dev/null diff --git a/macros/Hardware/AVR/AVRPWMSetDuty.sci b/macros/Hardware/AVR/AVRPWMSetDuty.sci deleted file mode 100644 index 0042540..0000000 --- a/macros/Hardware/AVR/AVRPWMSetDuty.sci +++ /dev/null @@ -1,24 +0,0 @@ -function AVRPWMSetDuty(timer, duty) -// Function to set duty for PWM of AVR -// -// Calling Sequence -// AVRPWMSetDuty(uint8 timer, uint8 duty) -// -// Parameters -// timer: timer to be used for PWM generation (0,1,2) -// duty: duty for PWM waveform (0-100) -// -// Description -// This function sets duty for PWM waveform according to given parameters. -// -// Examples -// AVRPWMSetDuty(0,10) //Sets 10% duty for timer 0 output. -// -// 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/AVRPWMSetup.bin b/macros/Hardware/AVR/AVRPWMSetup.bin Binary files differdeleted file mode 100644 index 971e43e..0000000 --- a/macros/Hardware/AVR/AVRPWMSetup.bin +++ /dev/null diff --git a/macros/Hardware/AVR/AVRPWMSetup.sci b/macros/Hardware/AVR/AVRPWMSetup.sci deleted file mode 100644 index 1bee050..0000000 --- a/macros/Hardware/AVR/AVRPWMSetup.sci +++ /dev/null @@ -1,39 +0,0 @@ -function AVRPWMSetup(timer, prescalar, waveform_mode, output_mode) -// Function to initialise PWM of AVR -// -// Calling Sequence -// AVRPWMSetup(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/macros/Hardware/AVR/AVRReadADC.bin b/macros/Hardware/AVR/AVRReadADC.bin Binary files differindex c106708..3735097 100644 --- a/macros/Hardware/AVR/AVRReadADC.bin +++ b/macros/Hardware/AVR/AVRReadADC.bin diff --git a/macros/Hardware/AVR/AVRReadADC.sci b/macros/Hardware/AVR/AVRReadADC.sci index f9dfdac..7fd3e67 100644 --- a/macros/Hardware/AVR/AVRReadADC.sci +++ b/macros/Hardware/AVR/AVRReadADC.sci @@ -1,4 +1,14 @@ -function AVRReadADC(channel) +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function adc_result = AVRReadADC(channel) // Function to get voltage on analog pin on AVR // // Calling Sequence @@ -22,10 +32,13 @@ function AVRReadADC(channel) // adc_result = u8AVRReadADC(0) //Read ADC0 // // Authors -// Siddhesh Wani +// Siddhesh Wani Ashish Kamble // - - // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. + +if(channel>=8) then +disp("Error : Inavlid input argument ''channel'' in AVRReadADC function."); +end +adc_result = 0; //adc_result has been initialised to avoid runtime error. endfunction diff --git a/macros/Hardware/AVR/AVRSleep.bin b/macros/Hardware/AVR/AVRSleep.bin Binary files differnew file mode 100644 index 0000000..e4b10d8 --- /dev/null +++ b/macros/Hardware/AVR/AVRSleep.bin diff --git a/macros/Hardware/AVR/AVRSleep.sci b/macros/Hardware/AVR/AVRSleep.sci new file mode 100644 index 0000000..a1b6add --- /dev/null +++ b/macros/Hardware/AVR/AVRSleep.sci @@ -0,0 +1,4 @@ +function AVRSleep(delay) + + +endfunction diff --git a/macros/Hardware/AVR/AVRTimerSetup.bin b/macros/Hardware/AVR/AVRTimerSetup.bin Binary files differindex 4a49b86..d7d8c42 100644 --- a/macros/Hardware/AVR/AVRTimerSetup.bin +++ b/macros/Hardware/AVR/AVRTimerSetup.bin diff --git a/macros/Hardware/AVR/AVRTimerSetup.sci b/macros/Hardware/AVR/AVRTimerSetup.sci index 1529c34..7c5dd1d 100644 --- a/macros/Hardware/AVR/AVRTimerSetup.sci +++ b/macros/Hardware/AVR/AVRTimerSetup.sci @@ -1,31 +1,56 @@ -function AVRTimerSetup(timer, prescalar) -// Function to set the prescalar for timer. +// Copyright (C) 2017 - IIT Bombay - FOSSEE // -// 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 +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function AVRTimerSetup(timer,prescaler,clock_source) +//Function to setup Timers in ATmega16 +//Descrpition: +// This function tells the micro controller which clock source you will be using. +// The timer value and prescaler value passed in this function setup the timer as per +// your requirement. // -// See also -// AVRGetTimerValue +//Parameters: +// timer : It is an integer value. +// 0 to setup timer0 +// 1 to setup timer1 +// 2 to setup timer2 +// prescaler : It is an integer value. +// 1 for no prescaling i.e clock will run at max 16Hz frequency +// 8 for prescaling clock by 8 i.e new clock frequency will be (clk/8) +// 64 for prescaling clock by 64 i.e new clock frequency will be (clk/64) +// 256 for prescaling clock by 256 i.e new clock frequency will be (clk/256) +// 1024 for prescaling clock by 1024 i.e new clock frequency will be (clk/1024) +// clock_source : It is an integer value. +// 0 if you are using internal clock source +// 1 if you are using external clock source +//Example +// AVRTimerSetup(0,64,0); //This function will select timer0 with timer running as per +// internal clock source and prescaled by 64. +// +//See also +// AVRGetTimerValues // -// Authors -// Siddhesh Wani +//Authors +// Ashish Kamble // +//This is curretly dummy function. It provides no functionality but is required +//for providing support for generating C code for AVR. + +if(timer>=3) then +disp("Error : Invalid input argument ''timer'' in AVRTimerSetup function."); +end + +if(~((prescaler==1)|(prescaler==8)|(prescaler==64)|(prescaler==256)|(prescaler==1024))) then +disp("Error : Invalid input argument ''prescaler'' in AVRTimerSetup function."); +end -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for AVR. +if(clock_source>=2) then +disp("Error : Invalid input argument ''clock_source'' in AVRTimerSetup function."); +end endfunction diff --git a/macros/Hardware/AVR/AVRUARTReceive.bin b/macros/Hardware/AVR/AVRUARTReceive.bin Binary files differnew file mode 100644 index 0000000..013036e --- /dev/null +++ b/macros/Hardware/AVR/AVRUARTReceive.bin diff --git a/macros/Hardware/AVR/AVRUARTReceive.sci b/macros/Hardware/AVR/AVRUARTReceive.sci new file mode 100644 index 0000000..790894f --- /dev/null +++ b/macros/Hardware/AVR/AVRUARTReceive.sci @@ -0,0 +1,30 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function received = AVRUARTReceive() +// Function to Receive Char value send to ATmega16 using UART or USART. +// Description +// This function Receives Char as 8 bit value.This value is stored in UDR at receiving +// end. +// +//Examples +// state = AVRUARTReceive(); //This function will Receive char and return the entire value +// +//See also +// AVRUARTSetup +// AVRUARTTransmit +// +// Authors +// Ashish Kamble +// +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. +received = 0; // received has been initialised to avoid runtime error. +endfunction diff --git a/macros/Hardware/AVR/AVRUARTSetup.bin b/macros/Hardware/AVR/AVRUARTSetup.bin Binary files differindex 4a49b86..82ec291 100644 --- a/macros/Hardware/AVR/AVRUARTSetup.bin +++ b/macros/Hardware/AVR/AVRUARTSetup.bin diff --git a/macros/Hardware/AVR/AVRUARTSetup.sci b/macros/Hardware/AVR/AVRUARTSetup.sci index 1529c34..32e5db8 100644 --- a/macros/Hardware/AVR/AVRUARTSetup.sci +++ b/macros/Hardware/AVR/AVRUARTSetup.sci @@ -1,31 +1,61 @@ -function AVRTimerSetup(timer, prescalar) -// Function to set the prescalar for timer. +// Copyright (C) 2017 - IIT Bombay - FOSSEE // -// 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 -// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function AVRUARTSetup(mode, baudrate, stopbits, parity) +// Function to Setup Serial Communication i.e UART or USART in ATmega16. // 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. -// +// This function Setup the UART or USART for Serial Communicaion between ATmega16 +// and different micro controllers or between ATmega16 and Computer. +// +// Parameters +// mode : +// 0 for Asynchronous Normal mode +// 1 for Asynchronous Double Speed mode +// 2 for Synchronous mode +// +// baudrate : Enter one of the following available baudrates +// 2400 , 4800 , 9600 , 14400 , 19200 , 28800 , 38400 , 57600 , +// 768000 , 115200 , 230400 , 250000 , 1000000 . // -// Examples -// AVRTimerSetup(0,1) //Timer 0 with no scaling +// stopbits : +// 0 for one stopbit +// 1 for two stopbits // +// parity : +// 0 for parity disabled +// 1 for even parity +// 2 for odd parity +// +//Examples +// AVRUARTSetup(0,9600,0,0); //This function will enable UART Communication for ATmega16 +// with 9600 as baudrate,one stop bit and parity disabled // See also -// AVRGetTimerValue +// AVRUARTTransmit +// AVRUARTReceive // // Authors -// Siddhesh Wani +// Ashish Kamble // - // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. +if(mode>=3) then +disp("Error : Invalid input argument ''mode'' in AVRUARTSetup function."); +end + +if((baudrate <> 2400)&(baudrate <> 4800)&(baudrate <> 9600)&(baudrate <> 14400)&(baudrate <> 28800)&(baudrate <> 38400)&(baudrate <> 57600)&(baudrate <> 768000)&(baudrate <> 115200)&(baudrate <> 230400)&(baudrate <> 250000)& (baudrate <> 1000000)) then +disp("Error : Invalid input argument ''baudrate'' in AVRUARTSetup function."); +end +if(stopbits>=2) then +disp("Error : Invalid input argument ''stopbits'' in AVRUARTSetup function."); +end +if(parity>=3) then +disp("Error : Invalid input argument ''parity'' in AVRUARTSetup function."); +end endfunction diff --git a/macros/Hardware/AVR/AVRUARTTransmit.bin b/macros/Hardware/AVR/AVRUARTTransmit.bin Binary files differnew file mode 100644 index 0000000..9e53d9a --- /dev/null +++ b/macros/Hardware/AVR/AVRUARTTransmit.bin diff --git a/macros/Hardware/AVR/AVRUARTTransmit.sci b/macros/Hardware/AVR/AVRUARTTransmit.sci new file mode 100644 index 0000000..eb35849 --- /dev/null +++ b/macros/Hardware/AVR/AVRUARTTransmit.sci @@ -0,0 +1,33 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function AVRUARTTransmit(data) +// Function to Transmit data using UART or USART. +// Description +// This function Tranmits data over UART or USART.The data to be transmitted can +// be a Char , String , Unsigned Int, Signed Int. +// +// Parameter +// data : +// The data to be transmitted can be a Char,String,Unsigned Int,Signed Int. +// +//Examples +// AVRUARTTransmit("This is example"); //This function will transmit the entered string. +// +//See also +// AVRUARTSetup +// AVRUARTReceive +// +// Authors +// Ashish Kamble +// +// 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 Binary files differindex 0aa7587..ba84783 100644 --- a/macros/Hardware/AVR/GetAVRSupportFunctions.bin +++ b/macros/Hardware/AVR/GetAVRSupportFunctions.bin diff --git a/macros/Hardware/AVR/GetAVRSupportFunctions.sci b/macros/Hardware/AVR/GetAVRSupportFunctions.sci index cce49f9..99c6242 100644 --- a/macros/Hardware/AVR/GetAVRSupportFunctions.sci +++ b/macros/Hardware/AVR/GetAVRSupportFunctions.sci @@ -1,3 +1,13 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + function AVRSupportFunctions = GetAVRSupportFunctions() // ----------------------------------------------------------------- // Get list of AVR peripherals supported @@ -8,7 +18,7 @@ function AVRSupportFunctions = GetAVRSupportFunctions() // Output data: // None // -// Author: Siddhesh Wani +// Author: Siddhesh Wani Ashish Kamble // ----------------------------------------------------------------- AVRSupportFunctions = [ @@ -16,10 +26,18 @@ AVRSupportFunctions = [ "AVRDigitalIn" "AVRDigitalOut" "AVRDigitalSetup" + "AVRDigitalPortSetup" + "AVRTimerSetup" "AVRGetTimerValue" - "AVRPWMSetDuty" - "AVRPWMSetup" + "AVRPWM0Setup" + "AVRPWM0SetDuty" + "AVRPWM1Setup" + "AVRPWM1SetDuty" + "AVRPWM2Setup" + "AVRPWM2SetDuty" "AVRReadADC" - "AVRTimerSetup"]; + "AVRSleep" + "AVRUARTSetup" + ]; endfunction diff --git a/macros/Hardware/AVR/GetPeripheral.sci b/macros/Hardware/AVR/GetPeripheral.sci index 73e9f19..ac909de 100644 --- a/macros/Hardware/AVR/GetPeripheral.sci +++ b/macros/Hardware/AVR/GetPeripheral.sci @@ -1,3 +1,13 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + function Peripheral = GetPeripheral(FunName,InArg) // ----------------------------------------------------------------- // Get an acronym for peripheral being used to be inserted in list of diff --git a/macros/Hardware/AVR/InsertPeripheralInList.sci b/macros/Hardware/AVR/InsertPeripheralInList.sci index bafc593..198ea1d 100644 --- a/macros/Hardware/AVR/InsertPeripheralInList.sci +++ b/macros/Hardware/AVR/InsertPeripheralInList.sci @@ -1,3 +1,13 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + function InsertPeripheralInList(Peripheral,PeripheralListFile) // ----------------------------------------------------------------- // Insert input peripheral in peripherals' list diff --git a/macros/Hardware/AVR/IsAVRSupportFunction.sci b/macros/Hardware/AVR/IsAVRSupportFunction.sci index a4cbbc8..94f4af7 100644 --- a/macros/Hardware/AVR/IsAVRSupportFunction.sci +++ b/macros/Hardware/AVR/IsAVRSupportFunction.sci @@ -1,3 +1,13 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + function Output = IsAVRSupportFunction(FunName) // ----------------------------------------------------------------- // Check whether input function name is an AVR support function or not. diff --git a/macros/Hardware/AVR/lib b/macros/Hardware/AVR/lib Binary files differindex 64d346a..f07c4e6 100644 --- a/macros/Hardware/AVR/lib +++ b/macros/Hardware/AVR/lib diff --git a/macros/Hardware/AVR/names b/macros/Hardware/AVR/names index 624fee8..8fcfdb7 100644 --- a/macros/Hardware/AVR/names +++ b/macros/Hardware/AVR/names @@ -1,13 +1,21 @@ AVRADCSetup AVRDigitalIn AVRDigitalOut +AVRDigitalPortSetup AVRDigitalSetup AVRGetTimerValue -AVRPWMSetDuty -AVRPWMSetup +AVRPWM0SetDuty +AVRPWM0Setup +AVRPWM1SetDuty +AVRPWM1Setup +AVRPWM2SetDuty +AVRPWM2Setup AVRReadADC +AVRSleep AVRTimerSetup +AVRUARTReceive AVRUARTSetup +AVRUARTTransmit GetAVRSupportFunctions GetPeripheral InsertPeripheralInList diff --git a/macros/Hardware/RasberryPi/lib b/macros/Hardware/RasberryPi/lib Binary files differindex d25d944..2426bc1 100644 --- a/macros/Hardware/RasberryPi/lib +++ b/macros/Hardware/RasberryPi/lib diff --git a/macros/Scilab-Arduino/lib b/macros/Scilab-Arduino/lib Binary files differindex bd0cb70..ce6d16d 100644 --- a/macros/Scilab-Arduino/lib +++ b/macros/Scilab-Arduino/lib diff --git a/macros/SymbolTable/lib b/macros/SymbolTable/lib Binary files differindex 7ff755e..cd1105b 100644 --- a/macros/SymbolTable/lib +++ b/macros/SymbolTable/lib diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index b9e7d8a..5c8ff33 100644 --- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -863,6 +863,12 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'acosd'; //BJ : Works but not able to generate all cases , AS : same for float
+ //--> acosd(%pi)
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
FunctionName = 'acosh'; // BJ : Done AS : Float_Done
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
@@ -873,11 +879,66 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
FunctionName = 'acot'; // BJ : Done AS : Float_Done
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+FunctionName = 'acotd'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+FunctionName = 'acoth'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+FunctionName = 'acsc'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+FunctionName = 'asec'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+FunctionName = 'asech'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+FunctionName = 'asind'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+FunctionName = 'atand'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+FunctionName = 'asecd'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+FunctionName = 'acscd'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+FunctionName = 'acsch'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
FunctionName = 'sqrt'; // BJ : Done AS : Float_Done
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
@@ -4591,6 +4652,39 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+//------------------------------------
+//---- Class AVRDigitalPortSetup ---------
+//------------------------------------
+ClassName = 'AVRDigitalPortSetup';
+
+// --- 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('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+//PrintStringInfo('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRDigitalPortSetup';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+
+
+
//------------------------------------
//---- Class AVRDigitalOut -----------
//------------------------------------
@@ -4681,7 +4775,7 @@ PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
PrintStringInfo('NIN= 1',ClassFileName,'file','y');
PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
-PrintStringInfo('OUT(1).TP= ''u16''',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');
@@ -4697,16 +4791,17 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
//------------------------------------
-//---- Class AVRPWMSetup -------------
+//---- Class AVRPWM0Setup -------------
//------------------------------------
-ClassName = 'AVRPWMSetup';
+ClassName = 'AVRPWM0Setup';
// --- Class Annotation. ---
PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
-PrintStringInfo('NIN= 4',ClassFileName,'file','y');
-PrintStringInfo('NOUT= 0',ClassFileName,'file','y');
+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');
@@ -4716,35 +4811,337 @@ ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
-FunctionName = 'AVRPWMSetup';
+FunctionName = 'AVRPWM0Setup';
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
//------------------------------------
-//---- Class AVRPWMSetDuty -----------
+//---- Class AVRPWM2Setup -------------
//------------------------------------
-ClassName = 'AVRPWMSetDuty';
+ClassName = 'AVRPWM2Setup';
// --- Class Annotation. ---
PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
PrintStringInfo('NIN= 2',ClassFileName,'file','y');
-PrintStringInfo('NOUT= 0 ',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('d0d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRPWM2Setup';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+//------------------------------------
+//---- Class AVRPWM1Setup -------------
+//------------------------------------
+ClassName = 'AVRPWM1Setup';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 3',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('d0d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRPWM1Setup';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+
+//------------------------------------
+//---- Class AVRPWM0SetDuty -----------
+//------------------------------------
+ClassName = 'AVRPWM0SetDuty';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',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(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRPWM0SetDuty';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+//------------------------------------
+//---- Class AVRPWM2SetDuty -----------
+//------------------------------------
+ClassName = 'AVRPWM2SetDuty';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',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(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
-FunctionName = 'AVRPWMSetDuty';
+FunctionName = 'AVRPWM2SetDuty';
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class AVRPWM1SetDuty -----------
+//------------------------------------
+ClassName = 'AVRPWM1SetDuty';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 3',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(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRPWM1SetDuty';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+
+
+//------------------------------------
+//---- Class AVRTimerInit -----------
+//------------------------------------
+ClassName = 'AVRTimerSetup';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 3',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('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+//PrintStringInfo('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRTimerSetup';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+
+
+//------------------------------------
+//---- Class AVRGetTimerValue -----------
+//------------------------------------
+ClassName = 'AVRGetTimerValue';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u16''',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('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+//PrintStringInfo('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRGetTimerValue';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+//------------------------------------
+//---- Class AVRSleep -----------
+//------------------------------------
+ClassName = 'AVRSleep';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u16''',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('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+//PrintStringInfo('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRSleep';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+
+//------------------------------------
+//---- Class AVRUARTSetup -----------
+//------------------------------------
+ClassName = 'AVRUARTSetup';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 4',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('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+//PrintStringInfo('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRUARTSetup';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+//------------------------------------
+//---- Class AVRUARTTransmit -----------
+//------------------------------------
+ClassName = 'AVRUARTTransmit';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',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('d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('s0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('i80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u160'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('i160'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('g0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+//
+//PrintStringInfo('d2'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('s2'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u82'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('i82'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u162'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('i162'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('g2'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('d2'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+//PrintStringInfo('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRUARTTransmit';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+
+
+
+//------------------------------------
+//---- Class AVRUARTReceiveChar -----------
+//------------------------------------
+ClassName = 'AVRUARTReceiveChar';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 0',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('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+//PrintStringInfo('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRUARTReceiveChar';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
//------------------------------------
//---- Class RPI_DigitalSetup --------
//------------------------------------
@@ -4754,7 +5151,7 @@ ClassName = 'RPI_DigitalSetup'; PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
PrintStringInfo('NIN= 2',ClassFileName,'file','y');
-PrintStringInfo('NOUT= 0',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');
diff --git a/macros/ToolInitialization/lib b/macros/ToolInitialization/lib Binary files differindex 6240d3d..06164e6 100644 --- a/macros/ToolInitialization/lib +++ b/macros/ToolInitialization/lib diff --git a/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci index 175c8dc..67f5cea 100644 --- a/macros/findDeps/getAllHeaders.sci +++ b/macros/findDeps/getAllHeaders.sci @@ -111,6 +111,18 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/elementaryFunctions/includes/int8.h" "src/c/elementaryFunctions/includes/uint16.h" "src/c/elementaryFunctions/includes/int16.h" + "src/c/elementaryFunctions/includes/acosd.h" + "src/c/elementaryFunctions/includes/acot.h" + "src/c/elementaryFunctions/includes/acotd.h" + "src/c/elementaryFunctions/includes/acoth.h" + "src/c/elementaryFunctions/includes/acsc.h" + "src/c/elementaryFunctions/includes/acscd.h" + "src/c/elementaryFunctions/includes/acsch.h" + "src/c/elementaryFunctions/includes/asec.h" + "src/c/elementaryFunctions/includes/asecd.h" + "src/c/elementaryFunctions/includes/asech.h" + "src/c/elementaryFunctions/includes/asind.h" + "src/c/elementaryFunctions/includes/atand.h" "src/c/statisticsFunctions/includes/variance.h" "src/c/statisticsFunctions/includes/sum.h" "src/c/statisticsFunctions/includes/mean.h" @@ -174,6 +186,8 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/hardware/avr/includes/AVRPeripheralADC.h" "src/c/hardware/avr/includes/AVRPeripheralPWM.h" "src/c/hardware/avr/includes/AVRUtil.h" + "src/c/hardware/avr/includes/AVRPeripheralTimer.h" + "src/c/hardware/avr/includes/AVRPeripheralUART.h" ]; RPi_headers = [ diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci index 92f4db9..135f88b 100644 --- a/macros/findDeps/getAllInterfaces.sci +++ b/macros/findDeps/getAllInterfaces.sci @@ -100,6 +100,18 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/elementaryFunctions/interfaces/int_int8.h" "src/c/elementaryFunctions/interfaces/int_uint16.h" "src/c/elementaryFunctions/interfaces/int_int16.h" + "src/c/elementaryFunctions/interfaces/int_acosd.h" + "src/c/elementaryFunctions/interfaces/int_acot.h" + "src/c/elementaryFunctions/interfaces/int_acotd.h" + "src/c/elementaryFunctions/interfaces/int_acoth.h" + "src/c/elementaryFunctions/interfaces/int_acsc.h" + "src/c/elementaryFunctions/interfaces/int_acscd.h" + "src/c/elementaryFunctions/interfaces/int_acsch.h" + "src/c/elementaryFunctions/interfaces/int_asec.h" + "src/c/elementaryFunctions/interfaces/int_asecd.h" + "src/c/elementaryFunctions/interfaces/int_asech.h" + "src/c/elementaryFunctions/interfaces/int_asind.h" + "src/c/elementaryFunctions/interfaces/int_atand.h" "src/c/statisticsFunctions/interfaces/int_mean.h" "src/c/statisticsFunctions/interfaces/int_meanf.h" "src/c/statisticsFunctions/interfaces/int_stdevf.h" @@ -167,6 +179,8 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h" "src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h" "src/c/hardware/avr/interfaces/int_AVRUtil.h" + "src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h" + "src/c/hardware/avr/interfaces/int_AVRPeripheralUART.h" ]; RPI_interfaces = [ diff --git a/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci index 624de4b..9a5a5c2 100644 --- a/macros/findDeps/getAllSources.sci +++ b/macros/findDeps/getAllSources.sci @@ -684,6 +684,66 @@ function allSources = getAllSources(SharedInfo) "src/c/elementaryFunctions/linspace/dlinspacea.c" "src/c/elementaryFunctions/logspace/dlogspaces.c" "src/c/elementaryFunctions/logspace/dlogspacea.c" + "src/c/elementaryFunctions/acosd/dacosda.c" + "src/c/elementaryFunctions/acosd/dacosds.c" + "src/c/elementaryFunctions/acosd/sacosda.c" + "src/c/elementaryFunctions/acosd/sacosds.c" + "src/c/elementaryFunctions/acot/dacota.c" + "src/c/elementaryFunctions/acot/dacots.c" + "src/c/elementaryFunctions/acot/sacota.c" + "src/c/elementaryFunctions/acot/sacots.c" + "src/c/elementaryFunctions/acot/cacots.c" + "src/c/elementaryFunctions/acot/cacota.c" + "src/c/elementaryFunctions/acot/zacots.c" + "src/c/elementaryFunctions/acot/zacota.c" + "src/c/elementaryFunctions/acotd/dacotda.c" + "src/c/elementaryFunctions/acotd/dacotds.c" + "src/c/elementaryFunctions/acotd/sacotda.c" + "src/c/elementaryFunctions/acotd/sacotds.c" + "src/c/elementaryFunctions/acoth/dacotha.c" + "src/c/elementaryFunctions/acoth/dacoths.c" + "src/c/elementaryFunctions/acoth/sacotha.c" + "src/c/elementaryFunctions/acoth/sacoths.c" + "src/c/elementaryFunctions/acoth/cacoths.c" + "src/c/elementaryFunctions/acoth/cacotha.c" + "src/c/elementaryFunctions/acoth/zacoths.c" + "src/c/elementaryFunctions/acoth/zacotha.c" + "src/c/elementaryFunctions/acsc/dacsca.c" + "src/c/elementaryFunctions/acsc/dacscs.c" + "src/c/elementaryFunctions/acsc/sacsca.c" + "src/c/elementaryFunctions/acsc/sacscs.c" + "src/c/elementaryFunctions/acsc/cacscs.c" + "src/c/elementaryFunctions/acsc/cacsca.c" + "src/c/elementaryFunctions/acsc/zacscs.c" + "src/c/elementaryFunctions/acsc/zacsca.c" + "src/c/elementaryFunctions/acscd/dacscda.c" + "src/c/elementaryFunctions/acscd/dacscds.c" + "src/c/elementaryFunctions/acscd/sacscda.c" + "src/c/elementaryFunctions/acscd/sacscds.c" + "src/c/elementaryFunctions/acsch/dacscha.c" + "src/c/elementaryFunctions/acsch/dacschs.c" + "src/c/elementaryFunctions/acsch/sacscha.c" + "src/c/elementaryFunctions/acsch/sacschs.c" + "src/c/elementaryFunctions/asec/daseca.c" + "src/c/elementaryFunctions/asec/dasecs.c" + "src/c/elementaryFunctions/asec/saseca.c" + "src/c/elementaryFunctions/asec/sasecs.c" + "src/c/elementaryFunctions/asecd/dasecda.c" + "src/c/elementaryFunctions/asecd/dasecds.c" + "src/c/elementaryFunctions/asecd/sasecda.c" + "src/c/elementaryFunctions/asecd/sasecds.c" + "src/c/elementaryFunctions/asech/dasecha.c" + "src/c/elementaryFunctions/asech/dasechs.c" + "src/c/elementaryFunctions/asech/sasecha.c" + "src/c/elementaryFunctions/asech/sasechs.c" + "src/c/elementaryFunctions/asind/dasinda.c" + "src/c/elementaryFunctions/asind/dasinds.c" + "src/c/elementaryFunctions/asind/sasinda.c" + "src/c/elementaryFunctions/asind/sasinds.c" + "src/c/elementaryFunctions/atand/datanda.c" + "src/c/elementaryFunctions/atand/datands.c" + "src/c/elementaryFunctions/atand/satanda.c" + "src/c/elementaryFunctions/atand/satands.c" "src/c/statisticsFunctions/max/dmaxa.c" "src/c/statisticsFunctions/max/smaxa.c" "src/c/statisticsFunctions/max/srowmaxa.c" @@ -1002,13 +1062,36 @@ function allSources = getAllSources(SharedInfo) //Files to be inserted only if output format selected is 'AVR'. AVR_files = [ "src/c/hardware/avr/gpio/u8AVRDigitalSetups.c" + "src/c/hardware/avr/gpio/u8AVRDigitalPortSetups.c" "src/c/hardware/avr/gpio/u8AVRDigitalOuts.c" "src/c/hardware/avr/gpio/u8AVRDigitalIns.c" "src/c/hardware/avr/adc/u8AVRADCSetups.c" "src/c/hardware/avr/adc/u8AVRReadADCs.c" - "src/c/hardware/avr/pwm/u8AVRPWMSetups.c" - "src/c/hardware/avr/pwm/u8AVRPWMSetDutys.c" - "src/c/hardware/avr/util/u16AVRSleeps.c" + "src/c/hardware/avr/pwm/u8AVRPWM0Setups.c" + "src/c/hardware/avr/pwm/u8AVRPWM2Setups.c" + "src/c/hardware/avr/pwm/u8AVRPWM1Setups.c" + "src/c/hardware/avr/pwm/u8AVRPWM0SetDutys.c" + "src/c/hardware/avr/pwm/u8AVRPWM2SetDutys.c" + "src/c/hardware/avr/pwm/u8AVRPWM1SetDutys.c" + "src/c/hardware/avr/util/u16AVRSleeps.c" + "src/c/hardware/avr/timer/u8AVRTimerSetups.c" + "src/c/hardware/avr/timer/u8AVRGetTimerValues.c" + "src/c/hardware/avr/uart/u8AVRUARTReceiveCharu8.c" + "src/c/hardware/avr/uart/u8AVRUARTSetups.c" + "src/c/hardware/avr/uart/u8AVRUARTTransmits.c" + "src/c/hardware/avr/uart/i16AVRUARTTransmits.c" + "src/c/hardware/avr/uart/i8AVRUARTTransmits.c" + "src/c/hardware/avr/uart/gAVRUARTTransmits.c" + "src/c/hardware/avr/uart/u16AVRUARTTransmits.c" + "src/c/hardware/avr/uart/u8AVRUARTTransmita.c" + "src/c/hardware/avr/uart/i16AVRUARTTransmita.c" + "src/c/hardware/avr/uart/i8AVRUARTTransmita.c" + "src/c/hardware/avr/uart/dAVRUARTTransmits.c" +// "src/c/hardware/avr/uart/gAVRUARTTransmita.c" + "src/c/hardware/avr/uart/u16AVRUARTTransmita.c" +// "src/c/hardware/avr/uart/sAVRUARTTransmits.c" + + ]; RPI_files = [ diff --git a/macros/findDeps/lib b/macros/findDeps/lib Binary files differBinary files differindex c1deaa6..b3a9fe5 100644 --- a/macros/findDeps/lib +++ b/macros/findDeps/lib diff --git a/macros/runsci2c.sci b/macros/runsci2c.sci index 0bc3e92..71cc1ff 100644 --- a/macros/runsci2c.sci +++ b/macros/runsci2c.sci @@ -141,7 +141,7 @@ for i = 1:size(allInterfaces, "*") //disp("Copying "+allInterfaces(i)+" in "+SCI2COutputPath+"/interfaces/");
copyfile(allInterfaces(i), SCI2COutputPath+"/interfaces/");
end
-
+disp(allLibraries);
// -- Libraries
if(~isempty(allLibraries))
PrintStepInfo('Copying libraries', FileInfo.GeneralReport,'both');
@@ -177,7 +177,9 @@ if (Target == 'Arduino') //disp("Copying "+arduinoFiles(i)+" in "+SCI2COutputPath+"/arduino/sci2carduino");
copyfile(arduinoFiles(i), SCI2COutputPath+"/arduino/sci2c_arduino/");
end
-
+elseif (Target == 'AVR')
+ AVRFile = SCI2CHOME + "/" + "src/c/hardware/avr/default_files/Makefile";
+ copyfile(AVRFile, SCI2COutputPath);
else
if BuildTool == "make"
diff --git a/macros/scilab2c.sci b/macros/scilab2c.sci index 4fccb07..41494ea 100644 --- a/macros/scilab2c.sci +++ b/macros/scilab2c.sci @@ -143,7 +143,7 @@ error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), // --- LAUNCH USER SCI CODE TO TEST IT BEFORE TRANSLATING IT!!! --- // If Target choosen is 'Standalone' then only execute the code, otherwise directly start conversion. - if ((Target == "StandAlone"))// | (Target == "RPi")) + if (Target == "StandAlone" |Target == "AVR") runscicode(UserScilabMainFile, UserSciFilesPaths); // --- ASK USER FOR CONTINUATION. --- diff --git a/src/c/elementaryFunctions/acosd/cacoss.c b/src/c/elementaryFunctions/acosd/cacoss.c new file mode 100644 index 0000000..9742031 --- /dev/null +++ b/src/c/elementaryFunctions/acosd/cacoss.c @@ -0,0 +1,147 @@ +/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2007-2008 - INRIA - Bruno JOFRET
+ * Copyright (C) Bruno Pincon
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+/*
+ * This fonction is a translation of fortran wacos write by Bruno Pincon <Bruno.Pincon@iecn.u-nancy.fr>
+ * REFERENCE
+ * This is a Fortran-77 translation of an algorithm by
+ * T.E. Hull, T. F. Fairgrieve and P.T.P. Tang which
+ * appears in their article :
+ * "Implementing the Complex Arcsine and Arccosine
+ * Functions Using Exception Handling", ACM, TOMS,
+ * Vol 23, No. 3, Sept 1997, p. 299-335
+ */
+
+#include "acos.h"
+#include "atan.h"
+#include "log.h"
+#include "log1p.h"
+#include "sqrt.h"
+#include "abs.h"
+#include "lapack.h"
+#include "min.h"
+#include "max.h"
+
+#define localSign(x) (x>0 ? 1.0f : -1.0f)
+
+floatComplex cacoss(floatComplex z) {
+ static float sfltPi = 3.1415926535897932384626433f;
+ static float sfltPi_2 = 1.5707963267948966192313216f;
+ static float sfltLn2 = 0.6931471805599453094172321f;
+ static float sfltAcross = 1.5f;
+ static float sfltBcross = 0.6417f;
+
+ float fltLsup = ssqrts((float) getOverflowThreshold())/8.0f;
+ float fltLinf = 4.0f * ssqrts((float) getUnderflowThreshold());
+ float fltEpsm = ssqrts((float) getRelativeMachinePrecision());
+
+ float fltAbsReal = sabss(creals(z));
+ float fltAbsImg = sabss(cimags(z));
+ float fltSignReal = localSign(creals(z));
+ float fltSignImg = localSign(cimags(z));
+
+ float fltR = 0, fltS = 0, fltA = 0, fltB = 0;
+
+ float fltTemp = 0;
+
+ float _pfltReal = 0;
+ float _pfltImg = 0;
+
+ if( min(fltAbsReal, fltAbsImg) > fltLinf && max(fltAbsReal, fltAbsImg) <= fltLsup)
+ {/* we are in the safe region */
+ fltR = ssqrts( (fltAbsReal + 1 )*(fltAbsReal + 1 ) + fltAbsImg*fltAbsImg);
+ fltS = ssqrts( (fltAbsReal - 1 )*(fltAbsReal - 1 ) + fltAbsImg*fltAbsImg);
+ fltA = 0.5f * ( fltR + fltS );
+ fltB = fltAbsReal / fltA;
+
+
+ /* compute the real part */
+ if(fltB <= sfltBcross)
+ _pfltReal = sacoss(fltB);
+ else if( fltAbsReal <= 1)
+ _pfltReal = satans(ssqrts(0.5f * (fltA + fltAbsReal) * (fltAbsImg*fltAbsImg / (fltR + (fltAbsReal + 1)) + (fltS + (1 - fltAbsReal)))) / fltAbsReal);
+ else
+ _pfltReal = satans((fltAbsImg * ssqrts(0.5f * ((fltA + fltAbsReal) / (fltR + (fltAbsReal + 1)) + (fltA + fltAbsReal) / (fltS + (fltAbsReal - 1))))) / fltAbsReal);
+
+ /* compute the imaginary part */
+ if(fltA <= sfltAcross)
+ {
+ float fltImg1 = 0;
+
+ if(fltAbsReal < 1)
+ /* Am1 = 0.5d0*((y**2)/(R+(x+1.d0))+(y**2)/(S+(1.d0-x))) */
+ fltImg1 = 0.5f * (fltAbsImg*fltAbsImg / (fltR + (fltAbsReal + 1)) + fltAbsImg*fltAbsImg / (fltS + (1 - fltAbsReal)));
+ else
+ /* Am1 = 0.5d0*((y**2)/(R+(x+1.d0))+(S+(x-1.d0))) */
+ fltImg1 = 0.5f * (fltAbsImg*fltAbsImg / (fltR + (fltAbsReal + 1)) + (fltS + (fltAbsReal - 1)));
+ /* ai = logp1(Am1 + sqrt(Am1*(A+1.d0))) */
+ fltTemp = fltImg1 + ssqrts(fltImg1 *( fltA + 1));
+ _pfltImg = slog1ps(fltTemp);
+ }
+ else
+ /* ai = log(A + sqrt(A**2 - 1.d0)) */
+ _pfltImg = slogs(fltA + ssqrts(fltA*fltA - 1));
+ }
+ else
+ {/* evaluation in the special regions ... */
+ if(fltAbsImg <= fltEpsm * sabss(fltAbsReal - 1))
+ {
+ if(fltAbsReal < 1)
+ {
+ _pfltReal = sacoss(fltAbsReal);
+ _pfltImg = fltAbsImg / ssqrts((1 + fltAbsReal) * (1 - fltAbsReal));
+ }
+ else
+ {
+ _pfltReal = 0;
+ if(fltAbsReal <= fltLsup)
+ {
+ fltTemp = (fltAbsReal - 1) + ssqrts((fltAbsReal - 1) * (fltAbsReal + 1));
+ _pfltImg = slog1ps(fltTemp);
+ }
+ else
+ _pfltImg = sfltLn2 + slogs(fltAbsReal);
+ }
+ }
+ else if(fltAbsImg < fltLinf)
+ {
+ _pfltReal = ssqrts(fltAbsImg);
+ _pfltImg = _pfltReal;
+ }
+ else if((fltEpsm * fltAbsImg - 1 >= fltAbsReal))
+ {
+ _pfltReal = sfltPi_2;
+ _pfltImg = sfltLn2 + slogs(fltAbsImg);
+ }
+ else if(fltAbsReal > 1)
+ {
+ _pfltReal = satans(fltAbsImg / fltAbsReal);
+ fltTemp = (fltAbsReal / fltAbsImg)*(fltAbsReal / fltAbsImg);
+ _pfltImg = sfltLn2 + slogs(fltAbsImg) + 0.5f * slog1ps(fltTemp);
+ }
+ else
+ {
+ float fltTemp2 = ssqrts(1 + fltAbsImg*fltAbsImg);
+ _pfltReal = sfltPi_2;
+ fltTemp = 2 * fltAbsImg * (fltAbsImg + fltTemp2);
+ _pfltImg = 0.5f * slog1ps(fltTemp);
+ }
+ }
+ if(fltSignReal < 0)
+ _pfltReal = sfltPi - _pfltReal;
+
+ if(fltAbsImg != 0 || fltSignReal < 0)
+ _pfltImg = - fltSignImg * _pfltImg;
+
+ return FloatComplex(_pfltReal, _pfltImg);
+}
diff --git a/src/c/elementaryFunctions/acosd/dacosda.c b/src/c/elementaryFunctions/acosd/dacosda.c new file mode 100644 index 0000000..2e95e9f --- /dev/null +++ b/src/c/elementaryFunctions/acosd/dacosda.c @@ -0,0 +1,22 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acosd.h" + +void dacosda(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dacosds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acosd/dacosds.c b/src/c/elementaryFunctions/acosd/dacosds.c new file mode 100644 index 0000000..8f59dab --- /dev/null +++ b/src/c/elementaryFunctions/acosd/dacosds.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acosd.h" + +double dacosds(double x) +{ + return ((acos(x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/acosd/sacosda.c b/src/c/elementaryFunctions/acosd/sacosda.c new file mode 100644 index 0000000..440d9dc --- /dev/null +++ b/src/c/elementaryFunctions/acosd/sacosda.c @@ -0,0 +1,22 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acosd.h" + +void sacosda(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sacosds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acosd/sacosds.c b/src/c/elementaryFunctions/acosd/sacosds.c new file mode 100644 index 0000000..c166ff0 --- /dev/null +++ b/src/c/elementaryFunctions/acosd/sacosds.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acosd.h" + +double sacosds(float x) +{ + return ((acos(x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/acot/cacota.c b/src/c/elementaryFunctions/acot/cacota.c new file mode 100644 index 0000000..64e82b2 --- /dev/null +++ b/src/c/elementaryFunctions/acot/cacota.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acot.h" +#include "floatComplex.h" + +void cacota(floatComplex* x, int size, floatComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = cacots(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acot/cacots.c b/src/c/elementaryFunctions/acot/cacots.c new file mode 100644 index 0000000..f4c6236 --- /dev/null +++ b/src/c/elementaryFunctions/acot/cacots.c @@ -0,0 +1,23 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acot.h" +#include "division.h" +#include "floatComplex.h" +#include "atan.h" + +floatComplex cacots(floatComplex x) +{ + floatComplex xinv; + xinv = crdivs(FloatComplex(1,0),x); + return catans(xinv); +} diff --git a/src/c/elementaryFunctions/acot/dacota.c b/src/c/elementaryFunctions/acot/dacota.c new file mode 100644 index 0000000..794d081 --- /dev/null +++ b/src/c/elementaryFunctions/acot/dacota.c @@ -0,0 +1,20 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acot.h" + +void dacota(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = dacots(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acot/dacots.c b/src/c/elementaryFunctions/acot/dacots.c new file mode 100644 index 0000000..42ce7b5 --- /dev/null +++ b/src/c/elementaryFunctions/acot/dacots.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acot.h" + +double dacots(double x) +{ + return ((3.14159265359/2)-atan(x)); +} diff --git a/src/c/elementaryFunctions/acot/sacota.c b/src/c/elementaryFunctions/acot/sacota.c new file mode 100644 index 0000000..b99a773 --- /dev/null +++ b/src/c/elementaryFunctions/acot/sacota.c @@ -0,0 +1,20 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acot.h" + +void sacota(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = sacots(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acot/sacots.c b/src/c/elementaryFunctions/acot/sacots.c new file mode 100644 index 0000000..db6dca2 --- /dev/null +++ b/src/c/elementaryFunctions/acot/sacots.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acot.h" + +float sacots(float x) +{ + return ((3.14159265359/2)-atanf(x)); +} diff --git a/src/c/elementaryFunctions/acot/zacota.c b/src/c/elementaryFunctions/acot/zacota.c new file mode 100644 index 0000000..d08ebdd --- /dev/null +++ b/src/c/elementaryFunctions/acot/zacota.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acot.h" +#include "doubleComplex.h" + +void zacota(doubleComplex* x, int size, doubleComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = zacots(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acot/zacots.c b/src/c/elementaryFunctions/acot/zacots.c new file mode 100644 index 0000000..3bf99b2 --- /dev/null +++ b/src/c/elementaryFunctions/acot/zacots.c @@ -0,0 +1,23 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acot.h" +#include "division.h" +#include "doubleComplex.h" +#include "atan.h" + +doubleComplex zacots(doubleComplex x) +{ + doubleComplex xinv; + xinv = zrdivs(DoubleComplex(1,0),x); + return zatans(xinv); +} diff --git a/src/c/elementaryFunctions/acotd/dacotda.c b/src/c/elementaryFunctions/acotd/dacotda.c new file mode 100644 index 0000000..a2b6485 --- /dev/null +++ b/src/c/elementaryFunctions/acotd/dacotda.c @@ -0,0 +1,20 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acotd.h" + +void dacotda(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = dacotds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acotd/dacotds.c b/src/c/elementaryFunctions/acotd/dacotds.c new file mode 100644 index 0000000..f149ac2 --- /dev/null +++ b/src/c/elementaryFunctions/acotd/dacotds.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acotd.h" + +double dacotds(double x) +{ + return ((((3.14159265359/2)-atan(x))*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/acotd/sacotda.c b/src/c/elementaryFunctions/acotd/sacotda.c new file mode 100644 index 0000000..3950304 --- /dev/null +++ b/src/c/elementaryFunctions/acotd/sacotda.c @@ -0,0 +1,20 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acotd.h" + +void sacotda(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = sacotds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acotd/sacotds.c b/src/c/elementaryFunctions/acotd/sacotds.c new file mode 100644 index 0000000..2579753 --- /dev/null +++ b/src/c/elementaryFunctions/acotd/sacotds.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acotd.h" + +float sacotds(float x) +{ + return ((((3.14159265359/2)-atanf(x))*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/acoth/cacotha.c b/src/c/elementaryFunctions/acoth/cacotha.c new file mode 100644 index 0000000..f4e72dc --- /dev/null +++ b/src/c/elementaryFunctions/acoth/cacotha.c @@ -0,0 +1,22 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acoth.h" +#include "floatComplex.h" + +void cacotha(floatComplex* x, int size, floatComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = cacoths(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acoth/cacoths.c b/src/c/elementaryFunctions/acoth/cacoths.c new file mode 100644 index 0000000..658c227 --- /dev/null +++ b/src/c/elementaryFunctions/acoth/cacoths.c @@ -0,0 +1,23 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acoth.h" +#include "division.h" +#include "floatComplex.h" +#include "atanh.h" + +floatComplex cacoths(floatComplex x) +{ + floatComplex xinv; + xinv = crdivs(FloatComplex(1,0),x); + return catanhs(xinv); +} diff --git a/src/c/elementaryFunctions/acoth/dacotha.c b/src/c/elementaryFunctions/acoth/dacotha.c new file mode 100644 index 0000000..b97b903 --- /dev/null +++ b/src/c/elementaryFunctions/acoth/dacotha.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acoth.h" + +void dacotha(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dacoths(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acoth/dacoths.c b/src/c/elementaryFunctions/acoth/dacoths.c new file mode 100644 index 0000000..a2dd875 --- /dev/null +++ b/src/c/elementaryFunctions/acoth/dacoths.c @@ -0,0 +1,19 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acoth.h" +#include "log.h" + + +double dacoths(double x) +{ + return (log((1+x)/(x-1))/2); +} diff --git a/src/c/elementaryFunctions/acoth/sacotha.c b/src/c/elementaryFunctions/acoth/sacotha.c new file mode 100644 index 0000000..383f188 --- /dev/null +++ b/src/c/elementaryFunctions/acoth/sacotha.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acoth.h" + +void sacotha(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sacoths(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acoth/sacoths.c b/src/c/elementaryFunctions/acoth/sacoths.c new file mode 100644 index 0000000..12f5381 --- /dev/null +++ b/src/c/elementaryFunctions/acoth/sacoths.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acoth.h" +#include "log.h" + +float sacoths(float x) +{ + return (log((1+x)/(x-1))/2); +} diff --git a/src/c/elementaryFunctions/acoth/zacotha.c b/src/c/elementaryFunctions/acoth/zacotha.c new file mode 100644 index 0000000..3eb335e --- /dev/null +++ b/src/c/elementaryFunctions/acoth/zacotha.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "acoth.h" +#include "doubleComplex.h" + +void zacotha(doubleComplex* x, int size, doubleComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) { + y[i] = zacoths(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acoth/zacoths.c b/src/c/elementaryFunctions/acoth/zacoths.c new file mode 100644 index 0000000..bbb387b --- /dev/null +++ b/src/c/elementaryFunctions/acoth/zacoths.c @@ -0,0 +1,23 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acoth.h" +#include "division.h" +#include "doubleComplex.h" +#include "atanh.h" + +doubleComplex zacoths(doubleComplex x) +{ + doubleComplex xinv; + xinv = zrdivs(DoubleComplex(1,0),x); + return zatanhs(xinv); +} diff --git a/src/c/elementaryFunctions/acsc/cacsca.c b/src/c/elementaryFunctions/acsc/cacsca.c new file mode 100644 index 0000000..0512a20 --- /dev/null +++ b/src/c/elementaryFunctions/acsc/cacsca.c @@ -0,0 +1,22 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" +#include "floatComplex.h" + +void cacsca(floatComplex* x, int size, floatComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = cacscs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsc/cacscs.c b/src/c/elementaryFunctions/acsc/cacscs.c new file mode 100644 index 0000000..9eea94e --- /dev/null +++ b/src/c/elementaryFunctions/acsc/cacscs.c @@ -0,0 +1,22 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" +#include "floatComplex.h" +#include "asin.h" +#include "division.h" + +floatComplex cacscs(floatComplex x) +{ + floatComplex xinv; + xinv = crdivs(FloatComplex(1,0),x); + return casins(xinv); +} diff --git a/src/c/elementaryFunctions/acsc/dacsca.c b/src/c/elementaryFunctions/acsc/dacsca.c new file mode 100644 index 0000000..3f00d21 --- /dev/null +++ b/src/c/elementaryFunctions/acsc/dacsca.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" + +void dacsca(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dacscs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsc/dacscs.c b/src/c/elementaryFunctions/acsc/dacscs.c new file mode 100644 index 0000000..4b5ac25 --- /dev/null +++ b/src/c/elementaryFunctions/acsc/dacscs.c @@ -0,0 +1,17 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" + +double dacscs(double x) +{ + return asin(1/x); +} diff --git a/src/c/elementaryFunctions/acsc/sacsca.c b/src/c/elementaryFunctions/acsc/sacsca.c new file mode 100644 index 0000000..79e6bf9 --- /dev/null +++ b/src/c/elementaryFunctions/acsc/sacsca.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" + +void sacsca(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sacscs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsc/sacscs.c b/src/c/elementaryFunctions/acsc/sacscs.c new file mode 100644 index 0000000..e91fa39 --- /dev/null +++ b/src/c/elementaryFunctions/acsc/sacscs.c @@ -0,0 +1,17 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" + +float sacscs(float x) +{ + return asin(1/x); +} diff --git a/src/c/elementaryFunctions/acsc/zacsca.c b/src/c/elementaryFunctions/acsc/zacsca.c new file mode 100644 index 0000000..164406f --- /dev/null +++ b/src/c/elementaryFunctions/acsc/zacsca.c @@ -0,0 +1,22 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" +#include "doubleComplex.h" + +void zacsca(doubleComplex* x, int size, doubleComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = zacscs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsc/zacscs.c b/src/c/elementaryFunctions/acsc/zacscs.c new file mode 100644 index 0000000..91bb6c8 --- /dev/null +++ b/src/c/elementaryFunctions/acsc/zacscs.c @@ -0,0 +1,23 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "acsc.h" +#include "doubleComplex.h" +#include "division.h" +#include "asin.h" + +doubleComplex zacscs(doubleComplex x) +{ + doubleComplex xinv; + xinv = zrdivs(DoubleComplex(1,0),x); + return zasins(xinv); +} diff --git a/src/c/elementaryFunctions/acscd/dacscda.c b/src/c/elementaryFunctions/acscd/dacscda.c new file mode 100644 index 0000000..84eeaed --- /dev/null +++ b/src/c/elementaryFunctions/acscd/dacscda.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acscd.h" + +void dacscda(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dacscds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acscd/dacscds.c b/src/c/elementaryFunctions/acscd/dacscds.c new file mode 100644 index 0000000..27512ad --- /dev/null +++ b/src/c/elementaryFunctions/acscd/dacscds.c @@ -0,0 +1,17 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acscd.h" + +double dacscds(double x) +{ + return ((asin(1/x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/acscd/sacscda.c b/src/c/elementaryFunctions/acscd/sacscda.c new file mode 100644 index 0000000..a5d130c --- /dev/null +++ b/src/c/elementaryFunctions/acscd/sacscda.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acscd.h" + +void sacscda(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sacscds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acscd/sacscds.c b/src/c/elementaryFunctions/acscd/sacscds.c new file mode 100644 index 0000000..1c820c2 --- /dev/null +++ b/src/c/elementaryFunctions/acscd/sacscds.c @@ -0,0 +1,17 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acscd.h" + +float sacscds(float x) +{ + return ((asin(1/x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/acsch/cacscha.c b/src/c/elementaryFunctions/acsch/cacscha.c new file mode 100644 index 0000000..0512a20 --- /dev/null +++ b/src/c/elementaryFunctions/acsch/cacscha.c @@ -0,0 +1,22 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" +#include "floatComplex.h" + +void cacsca(floatComplex* x, int size, floatComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = cacscs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsch/cacschs.c b/src/c/elementaryFunctions/acsch/cacschs.c new file mode 100644 index 0000000..a250b9d --- /dev/null +++ b/src/c/elementaryFunctions/acsch/cacschs.c @@ -0,0 +1,30 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsch.h" +#include "floatComplex.h" +#include "asin.h" +#include "division.h" + +floatComplex cacschs(floatComplex x) +{ + floatComplex xinv; + floatComplex temp; + xinv = crdivs(FloatComplex(1,0),x); + temp = sqrt(1+cmuls(xinv*xinv)) + +} + + + + + +log(sqrt(1+(1/(x*x)))+(1/x)); diff --git a/src/c/elementaryFunctions/acsch/dacscha.c b/src/c/elementaryFunctions/acsch/dacscha.c new file mode 100644 index 0000000..e717710 --- /dev/null +++ b/src/c/elementaryFunctions/acsch/dacscha.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsch.h" + +void dacscha(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dacschs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsch/dacschs.c b/src/c/elementaryFunctions/acsch/dacschs.c new file mode 100644 index 0000000..b0a3229 --- /dev/null +++ b/src/c/elementaryFunctions/acsch/dacschs.c @@ -0,0 +1,17 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsch.h" + +double dacschs(double x) +{ + return log(sqrt(1+(1/(x*x)))+(1/x)); +} diff --git a/src/c/elementaryFunctions/acsch/sacscha.c b/src/c/elementaryFunctions/acsch/sacscha.c new file mode 100644 index 0000000..c2321c6 --- /dev/null +++ b/src/c/elementaryFunctions/acsch/sacscha.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsch.h" + +void sacscha(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sacschs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsch/sacschs.c b/src/c/elementaryFunctions/acsch/sacschs.c new file mode 100644 index 0000000..031773b --- /dev/null +++ b/src/c/elementaryFunctions/acsch/sacschs.c @@ -0,0 +1,17 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsch.h" + +double sacschs(float x) +{ + return log(sqrt(1+(1/(x*x)))+(1/x)); +} diff --git a/src/c/elementaryFunctions/acsch/zacscha.c b/src/c/elementaryFunctions/acsch/zacscha.c new file mode 100644 index 0000000..164406f --- /dev/null +++ b/src/c/elementaryFunctions/acsch/zacscha.c @@ -0,0 +1,22 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" +#include "doubleComplex.h" + +void zacsca(doubleComplex* x, int size, doubleComplex* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = zacscs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/acsch/zacschs.c b/src/c/elementaryFunctions/acsch/zacschs.c new file mode 100644 index 0000000..6e33e25 --- /dev/null +++ b/src/c/elementaryFunctions/acsch/zacschs.c @@ -0,0 +1,22 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "acsc.h" +#include "doubleComplex.h" +#include "division.h" +#include "asin.h" + +doubleComplex zacscs(doubleComplex x) +{ + doubleComplex xinv; + xinv = zrdivs(DoubleComplex(1,0),x); + return zasins(xinv); +} diff --git a/src/c/elementaryFunctions/asec/daseca.c b/src/c/elementaryFunctions/asec/daseca.c new file mode 100644 index 0000000..2cf1dcd --- /dev/null +++ b/src/c/elementaryFunctions/asec/daseca.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asec.h" + +void daseca(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dasecs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asec/dasecs.c b/src/c/elementaryFunctions/asec/dasecs.c new file mode 100644 index 0000000..4f2f766 --- /dev/null +++ b/src/c/elementaryFunctions/asec/dasecs.c @@ -0,0 +1,17 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asec.h" + +double dasecs(double x) +{ + return acos(1/x); +} diff --git a/src/c/elementaryFunctions/asec/saseca.c b/src/c/elementaryFunctions/asec/saseca.c new file mode 100644 index 0000000..3b0afd8 --- /dev/null +++ b/src/c/elementaryFunctions/asec/saseca.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asec.h" + +void saseca(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sasecs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asec/sasecs.c b/src/c/elementaryFunctions/asec/sasecs.c new file mode 100644 index 0000000..5db46a6 --- /dev/null +++ b/src/c/elementaryFunctions/asec/sasecs.c @@ -0,0 +1,27 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asec.h" + +double sasecs(float x) +{ + return acos(1/x); +} diff --git a/src/c/elementaryFunctions/asecd/dasecda.c b/src/c/elementaryFunctions/asecd/dasecda.c new file mode 100644 index 0000000..e692762 --- /dev/null +++ b/src/c/elementaryFunctions/asecd/dasecda.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asecd.h" + +void dasecda(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dasecds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asecd/dasecds.c b/src/c/elementaryFunctions/asecd/dasecds.c new file mode 100644 index 0000000..dead318 --- /dev/null +++ b/src/c/elementaryFunctions/asecd/dasecds.c @@ -0,0 +1,17 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asecd.h" + +double dasecds(double x) +{ + return ((acos(1/x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/asecd/sasecda.c b/src/c/elementaryFunctions/asecd/sasecda.c new file mode 100644 index 0000000..5c9a42f --- /dev/null +++ b/src/c/elementaryFunctions/asecd/sasecda.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asecd.h" + +void sasecda(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sasecds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asecd/sasecds.c b/src/c/elementaryFunctions/asecd/sasecds.c new file mode 100644 index 0000000..2e26517 --- /dev/null +++ b/src/c/elementaryFunctions/asecd/sasecds.c @@ -0,0 +1,17 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asecd.h" + +double sasecds(float x) +{ + return ((acos(1/x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/asech/dasecha.c b/src/c/elementaryFunctions/asech/dasecha.c new file mode 100644 index 0000000..7309e3f --- /dev/null +++ b/src/c/elementaryFunctions/asech/dasecha.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asech.h" + +void dasecha(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dasechs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asech/dasechs.c b/src/c/elementaryFunctions/asech/dasechs.c new file mode 100644 index 0000000..ad5756a --- /dev/null +++ b/src/c/elementaryFunctions/asech/dasechs.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asech.h" +#include "log.h" + +double dasechs(double x) +{ + return log(sqrt((1/x)+1)*sqrt((1/x)-1)+(1/x)); +} diff --git a/src/c/elementaryFunctions/asech/sasecha.c b/src/c/elementaryFunctions/asech/sasecha.c new file mode 100644 index 0000000..f28eace --- /dev/null +++ b/src/c/elementaryFunctions/asech/sasecha.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asech.h" + +void sasecha(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sasechs(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asech/sasechs.c b/src/c/elementaryFunctions/asech/sasechs.c new file mode 100644 index 0000000..b1a1cab --- /dev/null +++ b/src/c/elementaryFunctions/asech/sasechs.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#include <math.h> +#include "asech.h" +#include "log.h" + +double sasechs(float x) +{ + return log(sqrt((1/x)+1)*sqrt((1/x)-1)+(1/x)); +} diff --git a/src/c/elementaryFunctions/asind/dasinda.c b/src/c/elementaryFunctions/asind/dasinda.c new file mode 100644 index 0000000..4c7d9af --- /dev/null +++ b/src/c/elementaryFunctions/asind/dasinda.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "asind.h" + +void dasinda(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = dasinds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asind/dasinds.c b/src/c/elementaryFunctions/asind/dasinds.c new file mode 100644 index 0000000..bc028a1 --- /dev/null +++ b/src/c/elementaryFunctions/asind/dasinds.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "asind.h" + +double dasinds(double x) +{ + return ((asin(x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/asind/sasinda.c b/src/c/elementaryFunctions/asind/sasinda.c new file mode 100644 index 0000000..100d09c --- /dev/null +++ b/src/c/elementaryFunctions/asind/sasinda.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "asind.h" + +void sasinda(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = sasinds(x[i]); + } +} diff --git a/src/c/elementaryFunctions/asind/sasinds.c b/src/c/elementaryFunctions/asind/sasinds.c new file mode 100644 index 0000000..1bbb362 --- /dev/null +++ b/src/c/elementaryFunctions/asind/sasinds.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "asind.h" + +double sasinds(float x) +{ + return ((asin(x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/atan/datans.c b/src/c/elementaryFunctions/atan/datans.c index a16df82..11785c0 100644 --- a/src/c/elementaryFunctions/atan/datans.c +++ b/src/c/elementaryFunctions/atan/datans.c @@ -13,6 +13,7 @@ #include <math.h> #include "atan.h" -double datans(double x) { +double datans(double x) +{ return (atan(x)); } diff --git a/src/c/elementaryFunctions/atand/datanda.c b/src/c/elementaryFunctions/atand/datanda.c new file mode 100644 index 0000000..5bf8cd9 --- /dev/null +++ b/src/c/elementaryFunctions/atand/datanda.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "atand.h" + +void datanda(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = datands(x[i]); + } +} diff --git a/src/c/elementaryFunctions/atand/datands.c b/src/c/elementaryFunctions/atand/datands.c new file mode 100644 index 0000000..8346ebe --- /dev/null +++ b/src/c/elementaryFunctions/atand/datands.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "atand.h" + +double datands(double x) +{ + return ((atan(x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/atand/satanda.c b/src/c/elementaryFunctions/atand/satanda.c new file mode 100644 index 0000000..1669d69 --- /dev/null +++ b/src/c/elementaryFunctions/atand/satanda.c @@ -0,0 +1,21 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include "atand.h" + +void satanda(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = satands(x[i]); + } +} diff --git a/src/c/elementaryFunctions/atand/satands.c b/src/c/elementaryFunctions/atand/satands.c new file mode 100644 index 0000000..49ee628 --- /dev/null +++ b/src/c/elementaryFunctions/atand/satands.c @@ -0,0 +1,18 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#include <math.h> +#include "atand.h" + +double satands(float x) +{ + return ((atan(x)*180)/3.14159265359); +} diff --git a/src/c/elementaryFunctions/includes/acosd.h b/src/c/elementaryFunctions/includes/acosd.h new file mode 100644 index 0000000..96dae80 --- /dev/null +++ b/src/c/elementaryFunctions/includes/acosd.h @@ -0,0 +1,33 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ACOSD_H__ +#define __ACOSD_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dacosds(double x); + +void dacosda(double* x, int size, double* y); + +double sacosds(float x); + +void sacosda(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOSD_H__ */ + diff --git a/src/c/elementaryFunctions/includes/acot.h b/src/c/elementaryFunctions/includes/acot.h new file mode 100644 index 0000000..430be12 --- /dev/null +++ b/src/c/elementaryFunctions/includes/acot.h @@ -0,0 +1,43 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ACOT_H__ +#define __ACOT_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dacots(double x); + +void dacota(double* x, int size, double* y); + +float sacots(float x); + +void sacota(float* x, int size, float* y); + +floatComplex cacots(floatComplex x); + +void cacota(floatComplex* x, int size, floatComplex* y); + +doubleComplex zacots(doubleComplex x); + +void zacota(doubleComplex* x, int size, doubleComplex* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOT_H__ */ + diff --git a/src/c/elementaryFunctions/includes/acotd.h b/src/c/elementaryFunctions/includes/acotd.h new file mode 100644 index 0000000..3be05cc --- /dev/null +++ b/src/c/elementaryFunctions/includes/acotd.h @@ -0,0 +1,37 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ACOTD_H__ +#define __ACOTD_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double dacotds(double x); + +void dacotda(double* x, int size, double* y); + +float sacotds(float x); + +void sacotda(float* x, int size, float* y); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOTD_H__ */ + diff --git a/src/c/elementaryFunctions/includes/acoth.h b/src/c/elementaryFunctions/includes/acoth.h new file mode 100644 index 0000000..975182f --- /dev/null +++ b/src/c/elementaryFunctions/includes/acoth.h @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ACOTH_H__ +#define __ACOTH_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double dacoths(double x); + +void dacotha(double* x, int size, double* y); + +float sacoths(float x); + +void sacotha(float* x, int size, float* y); + +floatComplex cacoths(floatComplex x); + +void cacotha(floatComplex* x, int size, floatComplex* y); + +doubleComplex zacoths(doubleComplex x); + +void zacotha(doubleComplex* x, int size, doubleComplex* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOTH_H__ */ + diff --git a/src/c/elementaryFunctions/includes/acsc.h b/src/c/elementaryFunctions/includes/acsc.h new file mode 100644 index 0000000..be6455a --- /dev/null +++ b/src/c/elementaryFunctions/includes/acsc.h @@ -0,0 +1,44 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __ACSC_H__ +#define __ACSC_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dacscs(double x); + +void dacsca(double* x, int size, double* y); + +float sacscs(float x); + +void sacsca(float* x, int size, float* y); + +floatComplex cacscs(floatComplex x); + +void cacsca(floatComplex* x, int size, floatComplex* y); + +doubleComplex zacscs(doubleComplex x); + +void zacsca(doubleComplex* x, int size, doubleComplex* y); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACSC_H__ */ + diff --git a/src/c/elementaryFunctions/includes/acscd.h b/src/c/elementaryFunctions/includes/acscd.h new file mode 100644 index 0000000..3c5bb18 --- /dev/null +++ b/src/c/elementaryFunctions/includes/acscd.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __ACSCD_H__ +#define __ACSCD_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dacscds(double x); + +void dacscda(double* x, int size, double* y); + +float sacscds(float x); + +void sacscda(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACSCD_H__ */ + diff --git a/src/c/elementaryFunctions/includes/acsch.h b/src/c/elementaryFunctions/includes/acsch.h new file mode 100644 index 0000000..ba2b1e1 --- /dev/null +++ b/src/c/elementaryFunctions/includes/acsch.h @@ -0,0 +1,32 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __ACSCH_H__ +#define __ACSCH_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dacschs(double x); + +void dacscha(double* x, int size, double* y); + +double sacschs(float x); + +void sacscha(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACSCH_H__ */ + diff --git a/src/c/elementaryFunctions/includes/asec.h b/src/c/elementaryFunctions/includes/asec.h new file mode 100644 index 0000000..8d1a65d --- /dev/null +++ b/src/c/elementaryFunctions/includes/asec.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ASEC_H__ +#define __ASEC_H__ +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double dasecs(double x); + +void daseca(double* x, int size, double* y); + +double sasecs(float x); + +void saseca(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASEC_H__ */ + diff --git a/src/c/elementaryFunctions/includes/asecd.h b/src/c/elementaryFunctions/includes/asecd.h new file mode 100644 index 0000000..104677b --- /dev/null +++ b/src/c/elementaryFunctions/includes/asecd.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ASECD_H__ +#define __ASECD_H__ +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double dasecds(double x); + +void dasecda(double* x, int size, double* y); + +double sasecds(float x); + +void sasecda(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASECD_H__ */ + diff --git a/src/c/elementaryFunctions/includes/asech.h b/src/c/elementaryFunctions/includes/asech.h new file mode 100644 index 0000000..5e6c5e9 --- /dev/null +++ b/src/c/elementaryFunctions/includes/asech.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ASECH_H__ +#define __ASECH_H__ +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double dasechs(double x); + +void dasecha(double* x, int size, double* y); + +double sasechs(float x); + +void sasecha(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASECH_H__ */ + diff --git a/src/c/elementaryFunctions/includes/asind.h b/src/c/elementaryFunctions/includes/asind.h new file mode 100644 index 0000000..8f7d710 --- /dev/null +++ b/src/c/elementaryFunctions/includes/asind.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ASIND_H__ +#define __ASIND_H__ +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double dasinds(double x); + +void dasinda(double* x, int size, double* y); + +double sasinds(float x); + +void sasinda(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASIND_H__ */ + diff --git a/src/c/elementaryFunctions/includes/atand.h b/src/c/elementaryFunctions/includes/atand.h new file mode 100644 index 0000000..ed10f09 --- /dev/null +++ b/src/c/elementaryFunctions/includes/atand.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __ATAND_H__ +#define __ATAND_H__ +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +double datands(double x); + +void datanda(double* x, int size, double* y); + +double satands(float x); + +void satanda(float* x, int size, float* y); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ATAND_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acosd.h b/src/c/elementaryFunctions/interfaces/int_acosd.h new file mode 100644 index 0000000..ee188c9 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acosd.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ACOSD_H__ +#define __INT_ACOSD_H__ + +#include "acosd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acosdd0(in1) dacosds(in1); + +#define d2acosdd2(in1,in2,in3) dacosda(in1,in2[0]*in2[1],in3); + +#define s0acosds0(in1) sacosds(in1); + +#define s2acosds2(in1,in2,in3) sacosda(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOSD_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acot.h b/src/c/elementaryFunctions/interfaces/int_acot.h new file mode 100644 index 0000000..371e64b --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acot.h @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ACOT_H__ +#define __INT_ACOT_H__ + +#include "acot.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acotd0(in1) dacots(in1); + +#define d2acotd2(in1,in2,in3) dacota(in1,in2[0]*in2[1],in3); + +#define s0acots0(in1) sacots(in1); + +#define s2acots2(in1,in2,in3) sacota(in1,in2[0]*in2[1],in3); + +#define c0acotd0(in1) cacots(in1); + +#define c2acotc2(in1,in2,in3) cacota(in1,in2[0]*in2[1],in3); + +#define z0acotz0(in1) zacots(in1); + +#define z2acotz2(in1,in2,in3) zacota(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOT_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acotd.h b/src/c/elementaryFunctions/interfaces/int_acotd.h new file mode 100644 index 0000000..22367be --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acotd.h @@ -0,0 +1,33 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ACOTD_H__ +#define __INT_ACOTD_H__ + +#include "acotd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acotdd0(in1) dacotds(in1); + +#define d2acotdd2(in1,in2,in3) dacotda(in1,in2[0]*in2[1],in3); + +#define s0acotds0(in1) sacotds(in1); + +#define s2acotds2(in1,in2,in3) sacotda(in1,in2[0]*in2[1],in3); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOTD_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acoth.h b/src/c/elementaryFunctions/interfaces/int_acoth.h new file mode 100644 index 0000000..8ec51a7 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acoth.h @@ -0,0 +1,43 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + +#ifndef __INT_ACOTH_H__ +#define __INT_ACOTH_H__ + +#include "acoth.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acothd0(in1) dacoths(in1); + +#define d2acothd2(in1,in2,in3) dacotha(in1,in2[0]*in2[1],in3); + +#define s0acoths0(in1) sacoths(in1); + +#define s2acoths2(in1,in2,in3) sacotha(in1,in2[0]*in2[1],in3); + +#define c0acothc0(in1) cacoths(in1); + +#define c2acothc2(in1,in2,in3) cacotha(in1,in2[0]*in2[1],in3); + +#define z0acothz0(in1) zacoths(in1); + +#define z2acothz2(in1,in2,in3) zacotha(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACOTH_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acsc.h b/src/c/elementaryFunctions/interfaces/int_acsc.h new file mode 100644 index 0000000..e16f7c9 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acsc.h @@ -0,0 +1,42 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ACSC_H__ +#define __INT_ACSC_H__ + +#include "acsc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acscd0(in1) dacscs(in1); + +#define d2acscd2(in1,in2,in3) dacsca(in1,in2[0]*in2[1],in3); + +#define s0acscs0(in1) sacscs(in1); + +#define s2acscs2(in1,in2,in3) sacsca(in1,in2[0]*in2[1],in3); + +#define c0acscc0(in1) cacscs(in1); + +#define c2acscc2(in1,in2,in3) cacsca(in1,in2[0]*in2[1],in3); + +#define z0acscz0(in1) zacscs(in1); + +#define z2acscz2(in1,in2,in3) zacsca(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACSC_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acscd.h b/src/c/elementaryFunctions/interfaces/int_acscd.h new file mode 100644 index 0000000..fa13acb --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acscd.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ACSCD_H__ +#define __INT_ACSCD_H__ + +#include "acscd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acscdd0(in1) dacscds(in1); + +#define d2acscdd2(in1,in2,in3) dacscda(in1,in2[0]*in2[1],in3); + +#define s0acscds0(in1) sacscds(in1); + +#define s2acscds2(in1,in2,in3) sacscda(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACSCD_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_acsch.h b/src/c/elementaryFunctions/interfaces/int_acsch.h new file mode 100644 index 0000000..2101abe --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_acsch.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ACSCH_H__ +#define __INT_ACSCH_H__ + +#include "acsch.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0acschd0(in1) dacschs(in1); + +#define d2acschd2(in1,in2,in3) dacscha(in1,in2[0]*in2[1],in3); + +#define s0acschs0(in1) sacschs(in1); + +#define s2acschs2(in1,in2,in3) sacscha(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ACSCH_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_asec.h b/src/c/elementaryFunctions/interfaces/int_asec.h new file mode 100644 index 0000000..25a1f11 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_asec.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ASEC_H__ +#define __INT_ASEC_H__ + +#include "asec.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0asecd0(in1) dasecs(in1); + +#define d2asecd2(in1,in2,in3) daseca(in1,in2[0]*in2[1],in3); + +#define s0asecs0(in1) sasecs(in1); + +#define s2asecs2(in1,in2,in3) saseca(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASEC_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_asecd.h b/src/c/elementaryFunctions/interfaces/int_asecd.h new file mode 100644 index 0000000..a722b6b --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_asecd.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ASECD_H__ +#define __INT_ASECD_H__ + +#include "asecd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0asecdd0(in1) dasecds(in1); + +#define d2asecdd2(in1,in2,in3) dasecda(in1,in2[0]*in2[1],in3); + +#define s0asecds0(in1) sasecds(in1); + +#define s2asecds2(in1,in2,in3) sasecda(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASECD_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_asech.h b/src/c/elementaryFunctions/interfaces/int_asech.h new file mode 100644 index 0000000..c6830f5 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_asech.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ASECH_H__ +#define __INT_ASECH_H__ + +#include "asech.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0asechd0(in1) dasechs(in1); + +#define d2asechd2(in1,in2,in3) dasecha(in1,in2[0]*in2[1],in3); + +#define s0asechs0(in1) sasechs(in1); + +#define s2asechs2(in1,in2,in3) sasecha(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASECH_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_asind.h b/src/c/elementaryFunctions/interfaces/int_asind.h new file mode 100644 index 0000000..fe640ea --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_asind.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ASIND_H__ +#define __INT_ASIND_H__ + +#include "asind.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0asindd0(in1) dasinds(in1); + +#define d2asindd2(in1,in2,in3) dasinda(in1,in2[0]*in2[1],in3); + +#define s0asinds0(in1) sasinds(in1); + +#define s2asinds2(in1,in2,in3) sasinda(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ASIND_H__ */ + diff --git a/src/c/elementaryFunctions/interfaces/int_atand.h b/src/c/elementaryFunctions/interfaces/int_atand.h new file mode 100644 index 0000000..0adc906 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_atand.h @@ -0,0 +1,34 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in +#ifndef __INT_ATAND_H__ +#define __INT_ATAND_H__ + +#include "atand.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0atandd0(in1) datands(in1); + +#define d2atandd2(in1,in2,in3) datanda(in1,in2[0]*in2[1],in3); + +#define s0atands0(in1) satands(in1); + +#define s2atands2(in1,in2,in3) satanda(in1,in2[0]*in2[1],in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__ATAND_H__ */ + diff --git a/src/c/elementaryFunctions/linspace/dlinspacea.c~ b/src/c/elementaryFunctions/linspace/dlinspacea.c~ deleted file mode 100644 index f67968d..0000000 --- a/src/c/elementaryFunctions/linspace/dlinspacea.c~ +++ /dev/null @@ -1,39 +0,0 @@ -/* - Scilab2C FOSSEE IIT Bombay - */ - -#include "linspace.h" -void dlinspacea(double *low_limit,int _row,double *up_limit,double range_num,double *out) -{ - int i,j,k; - double temp; - float step_iterate[_row]; // for each row the spacing between two values is different. - for(i=0;i<_row;i++) - { - - step_iterate[i] = (up_limit[i]-low_limit[i])/(range_num-1); - - } - for(j=0;j < _row;j++) - { - out[j] = low_limit[j]; // For every row first element is the first value of low_limit array - temp = low_limit[j]; - for(k=1;k < (double)range_num;k++ ) - { - out[(_row*k)+j] = temp + step_iterate[j]; /* Output matrix positions for 3 X 5 matrix are [0 3 6 9 12;1 4 7 10 13;2 5 8 11 14] so (_row*k)+j) used*/ - temp = out[(_row*k)+j]; - if(k == (double)range_num-1 ) - { - out[(_row*k)+j] = (double)up_limit[j]; // Last value of output is equal to first value of up_limit array - } - - } - - - } - - - - -} - diff --git a/src/c/elementaryFunctions/linspace/dlinspaces.c~ b/src/c/elementaryFunctions/linspace/dlinspaces.c~ deleted file mode 100644 index 82b88e3..0000000 --- a/src/c/elementaryFunctions/linspace/dlinspaces.c~ +++ /dev/null @@ -1,25 +0,0 @@ -/* - Scilab2C FOSSEE IIT Bombay - */ - -#include "linspace.h" -void dlinspaces(double low_limit,double up_limit,double range_num,double *out) -{ - int j; - double temp = low_limit; - float step_iterate = (up_limit-low_limit)/(range_num-1); - out[0] = low_limit; //First value of output is equal to low_limit value - for(j=1; j<(double)range_num; j++) - { - out[j] = temp + step_iterate; - temp = out[j]; - if(j == (double)range_num-1 ) - { - out[j] = (double)up_limit; // Last value of output is equal to up_limit value - } - } - - - -} - diff --git a/src/c/elementaryFunctions/linspace/u8linspacea.c~ b/src/c/elementaryFunctions/linspace/u8linspacea.c~ deleted file mode 100644 index 2e623fa..0000000 --- a/src/c/elementaryFunctions/linspace/u8linspacea.c~ +++ /dev/null @@ -1,39 +0,0 @@ -/* - Scilab2C FOSSEE IIT Bombay - */ - -#include "linspace.h" -void u8linspacea(uint8 *low_limit,int _row,uint8 *up_limit,double range_num,uint8 *out) -{ - int i,j,k; - uint8 temp; - float step_iterate[_row]; // for each row the spacing between two values is different. - for(i=0;i<_row;i++) - { - - step_iterate[i] = (up_limit[i]-low_limit[i])/(range_num-1); - - } - for(j=0;j < _row;j++) - { - out[j] = low_limit[j]; // For every row first element is the first value of low_limit array - temp = low_limit[j]; - for(k=1;k < (double)range_num;k++ ) - { - out[(_row*k)+j] = temp + step_iterate[j]; /* Output matrix positions for 3 X 5 matrix are [0 3 6 9 12;1 4 7 10 13;2 5 8 11 14] so (_row*k)+j) used*/ - temp = out[(_row*k)+j]; - if(k == (double)range_num-1 ) - { - out[(_row*k)+j] = (uint8)up_limit[j]; // Last value of output is equal to first value of up_limit array - } - - } - - - } - - - - -} - diff --git a/src/c/elementaryFunctions/linspace/u8linspaces.c~ b/src/c/elementaryFunctions/linspace/u8linspaces.c~ deleted file mode 100644 index 0320a27..0000000 --- a/src/c/elementaryFunctions/linspace/u8linspaces.c~ +++ /dev/null @@ -1,25 +0,0 @@ -/* - Scilab2C FOSSEE IIT Bombay - */ - -#include "linspace.h" -void u8linspaces(uint8 low_limit,uint8 up_limit,double range_num,uint8 *out) -{ - int j; - uint8 temp = low_limit; - float step_iterate = (up_limit-low_limit)/(range_num-1); - out[0] = low_limit; //First value of output is equal to low_limit value - for(j=1; j<(double)range_num; j++) - { - out[j] = temp + step_iterate; - temp = out[j]; - if(j == (double)range_num-1 ) - { - out[j] = (uint8)up_limit; // Last value of output is equal to up_limit value - } - } - - - -} - diff --git a/src/c/hardware/avr/adc/u8AVRADCSetups.c b/src/c/hardware/avr/adc/u8AVRADCSetups.c index f9d310b..66f491b 100644 --- a/src/c/hardware/avr/adc/u8AVRADCSetups.c +++ b/src/c/hardware/avr/adc/u8AVRADCSetups.c @@ -1,19 +1,19 @@ // Function to initialise ADC of AVR // // Calling Sequence -// AVRSetupADC(uint8 prescalar, uint8 adc_ref) +// AVRSetupADC(uint8 prescaler, uint8 adc_ref) // // Parameters -// prescalar: prescalar to be used for generating ADC clock (0-7) +// prescaler: prescaler to be used for generating ADC clock (0-7) // adc_ref : reference voltage to be used for ADC conversion // 0 -> Voltage on VREF pin // 1 -> Voltage on AVCC pin // 2 -> Internal 2.56 reference voltage // // Description -// This function initialises ADc of AVR with given parameters. 'prescalar' is +// This function initialises ADc of AVR with given parameters. 'prescaler' is // needed for deciding ADC clock. ADC clock should be between 50KHz and 200KHz -// and it given as (MCU clock/2^prescalar). Select appropriate prescalar depending +// and it given as (MCU clock/2^prescaler). Select appropriate prescaler depending // on MCU clock. 'adc_ref' selects one of the available reference voltage sources // available // Examples @@ -21,21 +21,23 @@ // // Authors // Siddhesh Wani -// +// Ashish Kamble #include "AVRPeripheralADC.h" -void u8AVRADCSetups(uint8 prescalar, uint8 adc_ref) +uint8 u8AVRADCSetups(uint8 prescaler, uint8 adc_ref) { - /*Set the prescalar value*/ - ADCSRA |= (prescalar & 0x07); +/*Set the prescaler value*/ + ADCSRA |= (prescaler & 0x07); /*Set the adc reference voltage*/ - ADMUX |= ((adc_ref & 0x03) << 6); + ADMUX |= ((adc_ref & 0x03) << 6); /*Enable ADC hardware. Set ADEN bit*/ - ADCSRA |= (1<<7); +ADCSRA |= (1<<7); +return 0; } + diff --git a/src/c/hardware/avr/adc/u8AVRReadADCs.c b/src/c/hardware/avr/adc/u8AVRReadADCs.c index 71fe136..302f8c8 100644 --- a/src/c/hardware/avr/adc/u8AVRReadADCs.c +++ b/src/c/hardware/avr/adc/u8AVRReadADCs.c @@ -1,3 +1,13 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + // Function to get voltage on analog pin on AVR // // Calling Sequence @@ -22,25 +32,51 @@ // // Authors // Siddhesh Wani -// +// Ashish Kamble #include "AVRPeripheralADC.h" -uint16 u8AVRReadADCs(uint8 channel) +uint8 u8AVRReadADCs(uint8 channel) { - /*Set ADC conversion channel*/ - ADMUX |= (channel & 0x1F); + +uint8 i; + + ADCH=0x00; + + i=channel&0x07; + ADMUX=i|0x60; //i|0x40 for 10 bits + ADCSRA|=1<<ADSC; + + while(ADCSRA & (1<<ADSC)); // wait for conv. to complete + uint8 temp=ADCH; //unsigned int temp=ADC; for 10 bits + + return temp; + +} + + + + + + + + + + +/*Set ADC conversion channel*/ +// ADMUX |= (channel & 0x1F); /*Start ADC conversion. Set 'ADSC' bit*/ - ADCSRA |= (1<<6); +// ADCSRA |= (1<<6); /*Wait for conversion to complete. Check 'ADIF' bit*/ - while(!(ADCSRA & (1<<4))); +// while(!(ADCSRA & (1<<4))); /*Clear ADIF flag*/ - ADCSRA |= (1<<4); +// ADCSRA |= (1<<4); /*ADC conversion result is stored in ADCH/L registers*/ - return (ADC); -} +// return (ADC); + + diff --git a/src/c/hardware/avr/default_files/Makefile b/src/c/hardware/avr/default_files/Makefile new file mode 100644 index 0000000..c388196 --- /dev/null +++ b/src/c/hardware/avr/default_files/Makefile @@ -0,0 +1,387 @@ + +# make all = Make software and program +# make clean = Clean out built project files. +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! + +# Microcontroller Type +MCU = atmega16 + +# Target file name (without extension). +TARGET = main + +# Programming hardware: +AVRDUDE_PROGRAMMER = usbasp + +AVRDUDE_PORT = /dev/usb + +############# Don't need to change below here for most purposes (Elliot) + +# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + + +CSRCDIR = src/c +HSRCDIR = includes +ISRCDIR = interfaces +SCI2CDIR = . +# List C source files here. (C dependencies are automatically generated.) +SRC = $(wildcard $(CSRCDIR)/*.c) main.c + +# If there is more than one source file, append them above, or modify and +# uncomment the following: +#SRC += foo.c bar.c + +# You can also wrap lines by appending a backslash to the end of the line: +#SRC += baz.c \ +#xyzzy.c + + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = includes interfaces +EXTRALIBDIRS = . + + +# Optional compiler flags. +# -g: generate debugging information (for GDB, or for COFF conversion) +# -O*: optimization level +# -f...: tuning, see gcc manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create assembler listing +#CFLAGS = -g -O$(OPT) \ +#-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ +#-Wall -Wstrict-prototypes \ +#-Wa,-adhlns=$(<:.c=.lst) \ +#$(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS = -g -Wall $(patsubst %,-I%,$(EXTRAINCDIRS)) $(patsubst %,-L%,$(EXTRALIBDIRS)) + +# Set a "language standard" compiler flag. +# Unremark just one line below to set the language standard to use. +# gnu99 = C99 + GNU extensions. See GCC manual for more information. +#CFLAGS += -std=c89 +#CFLAGS += -std=gnu89 +#CFLAGS += -std=c99 +#CFLAGS += -std=gnu99 + + + +# Optional assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs + + + +# Optional linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref + + + +# Additional libraries + +# Minimalistic printf version +#LDFLAGS += -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires -lm below) +#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt + +# -lm = math library +LDFLAGS += -lc +LDFLAGS += -lm + +# Programming support using avrdude. Settings and variables. + + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + +AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER) + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE += -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_FLAGS += -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> +# to submit bug reports. +#AVRDUDE_FLAGS += -v -v + +#Run while cable attached or don't +AVRDUDE_FLAGS += -E reset #keep chip disabled while cable attached +#AVRDUDE_FLAGS += -E noreset + +#AVRDUDE_WRITE_FLASH = -U lfuse:w:0x04:m #run with 8 Mhz clock + +#AVRDUDE_WRITE_FLASH = -U lfuse:w:0x21:m #run with 1 Mhz clock #default clock mode + +#AVRDUDE_WRITE_FLASH = -U lfuse:w:0x01:m #run with 1 Mhz clock no start up time + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = /usr/lib/avr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = $(DIRAVR)/include +DIRLIB = $(DIRAVR)/lib + + +# Define programs and commands. +SHELL = sh + +CC = avr-gcc + +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +AR = avr-ar + +# Programming support using avrdude. +AVRDUDE = avrdude + + +REMOVE = rm -f +COPY = cp + +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + +#LOCAL_LIB +LOCAL_LIB = main.a + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + +# Default target: make program! +all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ + $(TARGET).lss $(TARGET).sym sizeafter finished end +# $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + + + +# Display compiler version information. +gccversion : + @$(CC) --version + + + + +# Convert ELF to COFF for use in debugging / simulating in +# AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ + --change-section-address .data-0x800000 \ + --change-section-address .bss-0x800000 \ + --change-section-address .noinit-0x800000 \ + --change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + avr-nm -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: %.a + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(LOCAL_LIB) -o $@ $(LDFLAGS) + +$(LOCAL_LIB): $(OBJ) + $(AR) rcs $@ $(OBJ) + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) *~ + +# Automatically generate C source code dependencies. +# (Code originally taken from the GNU make user manual and modified +# (See README.txt Credits).) +# +# Note that this will work with sh (bash) and sed that is shipped with WinAVR +# (see the SHELL variable defined above). +# This may not work with other shells or other seds. +# +%.d: %.c + set -e; $(CC) -MM $(ALL_CFLAGS) $< \ + | sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ + [ -s $@ ] || rm -f $@ + + +# Remove the '-' if you want to see the dependency files generated. +-include $(SRC:.c=.d) + + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ + clean clean_list program diff --git a/src/c/hardware/avr/gpio/u8AVRDigitalIns.c b/src/c/hardware/avr/gpio/u8AVRDigitalIns.c index 6b61a56..a2517b9 100644 --- a/src/c/hardware/avr/gpio/u8AVRDigitalIns.c +++ b/src/c/hardware/avr/gpio/u8AVRDigitalIns.c @@ -1,3 +1,13 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + // Function to get current state (high\low) of a digital pin on AVR // // Calling Sequence @@ -28,27 +38,26 @@ uint8 u8AVRDigitalIns(uint8 port,uint8 pin) { - uint8 state = 0; + unsigned int state = 0; if(port == PORT_A) { - state = (uint8)(PINA & (1<<pin)); - return state; + state = bit_is_clear(PINA,pin); + return !state; } if(port == PORT_B) { - state = (uint8)(PINB & (1<<pin)); - return state; + state = bit_is_clear(PINB,pin); + return !state; } if(port == PORT_C) { - state = (uint8)(PINC & (1<<pin)); - return state; + state = bit_is_clear(PINC,pin); + return !state; } if(port == PORT_D) { - state = (uint8)(PIND & (1<<pin)); - return state; + state = bit_is_clear(PIND,pin); + return !state; } -//return state; } diff --git a/src/c/hardware/avr/gpio/u8AVRDigitalOuts.c b/src/c/hardware/avr/gpio/u8AVRDigitalOuts.c index 118da54..8998fc9 100644 --- a/src/c/hardware/avr/gpio/u8AVRDigitalOuts.c +++ b/src/c/hardware/avr/gpio/u8AVRDigitalOuts.c @@ -1,3 +1,13 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + // Function to change state (high\low) of a digital output pin on AVR // // Calling Sequence @@ -20,7 +30,7 @@ // // Authors // Siddhesh Wani -// +// Ashish Kamble #include "AVRPeripheralGPIO.h" diff --git a/src/c/hardware/avr/gpio/u8AVRDigitalPortSetups.c b/src/c/hardware/avr/gpio/u8AVRDigitalPortSetups.c new file mode 100644 index 0000000..54ec731 --- /dev/null +++ b/src/c/hardware/avr/gpio/u8AVRDigitalPortSetups.c @@ -0,0 +1,81 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +// Function to decide direction of a digital pin on AVR +// +// Calling Sequence +// AVRDigitalPortSetup(port,direction) +// +// Parameters +// port : port of microcontroller to be used (1 for PORTA, 2 for PORTB,...) +// direction : direction to be set for pin (0 for input, 1 for output) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs/inputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port to be +// used as digital output/input. Also, desired direction must be specified as +// 'INPUT' or 'OUTPUT'. +// +// Examples +// AVRDigitalPortSetup(1,0); //this function will PortA as input Port +// +// Authors +// Siddhesh Wani +// Ashish Kamble + + +#include "AVRPeripheralGPIO.h" + +uint8 u8AVRDigitalPortSetups(uint8 port,uint8 direction) +{ + if(direction == INPUT) + { + /*Set port as input*/ + if(port == PORT_A) + { + DDRA = 0x00; + } + if(port == PORT_B) + { + DDRB = 0x00; + } + if(port == PORT_C) + { + DDRC = 0x00; + } + if(port == PORT_D) + { + DDRD = 0x00; + } + } + else + { + /*Set port as output*/ + if(port == PORT_A) + { + DDRA = 0xFF; + } + if(port == PORT_B) + { + DDRB = 0xFF; + } + if(port == PORT_C) + { + DDRC = 0xFF; + } + if(port == PORT_D) + { + DDRD = 0xFF; + } + } + return 0; +} + diff --git a/src/c/hardware/avr/includes/AVRPeripheralADC.h b/src/c/hardware/avr/includes/AVRPeripheralADC.h index 736c340..2a27e37 100644 --- a/src/c/hardware/avr/includes/AVRPeripheralADC.h +++ b/src/c/hardware/avr/includes/AVRPeripheralADC.h @@ -15,9 +15,9 @@ extern "C" { #endif //Function prototypes -void u8AVRADCSetups(uint8 prescalar, uint8 adc_ref); +uint8 u8AVRADCSetups(uint8 prescaler, uint8 adc_ref); -uint16 u8AVRReadADCs(uint8 channel); +uint8 u8AVRReadADCs(uint8 channel); #ifdef __cplusplus diff --git a/src/c/hardware/avr/includes/AVRPeripheralGPIO.h b/src/c/hardware/avr/includes/AVRPeripheralGPIO.h index 37f2377..9a8d2d6 100644 --- a/src/c/hardware/avr/includes/AVRPeripheralGPIO.h +++ b/src/c/hardware/avr/includes/AVRPeripheralGPIO.h @@ -1,8 +1,14 @@ -//This file defines constants corresponding to gpios and digital input functions. -// -// Authors -// Siddhesh Wani +// Copyright (C) 2017 - IIT Bombay - FOSSEE // +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + #ifndef __AVRPERIPHERALGPIO_H__ #define __AVRPERIPHERALGPIO_H__ @@ -38,6 +44,9 @@ uint8 u8AVRDigitalIns(uint8 port,uint8 pin); void u8AVRDigitalOuts(uint8 port,uint8 pin,uint8 state); +uint8 u8AVRDigitalPortSetups(uint8 port,uint8 direction); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/hardware/avr/includes/AVRPeripheralPWM.h b/src/c/hardware/avr/includes/AVRPeripheralPWM.h index 2e41db6..2107a5a 100644 --- a/src/c/hardware/avr/includes/AVRPeripheralPWM.h +++ b/src/c/hardware/avr/includes/AVRPeripheralPWM.h @@ -1,7 +1,7 @@ //This file defines functions prototypes related to PWM. // // Authors -// Siddhesh Wani +// Ashish Kamble // #ifndef __AVRPERIPHERALPWM_H__ @@ -15,10 +15,17 @@ extern "C" { #endif //Function prototypes -void u8AVRPWMSetups(uint8 timer, uint8 prescalar, uint8 waveform_mode, uint8 output_mode); +uint8 u8AVRPWM0Setups(uint8 waveform_mode, uint8 output_mode); -void u8AVRPWMSetDutys(uint8 timer, uint8 duty); +uint8 u8AVRPWM2Setups(uint8 waveform_mode, uint8 output_mode); +uint8 u8AVRPWM1Setups(uint8 waveform_mode, uint8 output_mode, uint8 output_pin); + +uint8 u8AVRPWM0SetDutys(uint8 duty); + +uint8 u8AVRPWM2SetDutys(uint8 duty); + +uint8 u8AVRPWM1SetDutys(uint8 output_pin, uint16 duty, uint16 Top_Value); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/hardware/avr/includes/AVRPeripheralTimer.h b/src/c/hardware/avr/includes/AVRPeripheralTimer.h index 78b04aa..ab08769 100644 --- a/src/c/hardware/avr/includes/AVRPeripheralTimer.h +++ b/src/c/hardware/avr/includes/AVRPeripheralTimer.h @@ -1,8 +1,13 @@ -//This file defines functions prototypes related to Timer. -// -// Authors -// Siddhesh Wani +// Copyright (C) 2017 - IIT Bombay - FOSSEE // +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in #ifndef __AVRPERIPHERALTIMER_H__ #define __AVRPERIPHERALTIMER_H__ @@ -15,10 +20,10 @@ extern "C" { #endif //Function prototypes -uint8 u8AVRTimerSetups(uint8 timer, uint8 prescalar); -uint8 u8AVRGetTimerValue(uint8 timer); +uint16 u8AVRGetTimerValues(uint16 timer); +uint8 u8AVRTimerSetups(uint8 timer, uint16 prescaler,uint8 clock_source); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/hardware/avr/includes/AVRPeripheralUART.h b/src/c/hardware/avr/includes/AVRPeripheralUART.h new file mode 100644 index 0000000..09db3b0 --- /dev/null +++ b/src/c/hardware/avr/includes/AVRPeripheralUART.h @@ -0,0 +1,59 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + + +#ifndef __AVRPERIPHERALUART_H__ +#define __AVRPERIPHERALUART_H__ + +#include <avr/io.h> +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +//Function prototypes +uint8 u8AVRUARTSetups(uint8 mode, uint32 baudrate, uint8 stopbits, uint8 parity); + +uint8 u8AVRUARTTransmits(uint8 data); + +uint8 gAVRUARTTransmits(char* msg,int size); + +uint8 u16AVRUARTTransmits(uint16 data); + +uint8 i16AVRUARTTransmits(int16 data); + +uint8 i8AVRUARTTransmits(int8 data); + +//uint8 sAVRUARTTransmits(float data); + +uint8 u8AVRUARTTransmita(uint8 *x,int size); + +//uint8 gAVRUARTTransmita(uint8 *x,int size); + +uint8 u16AVRUARTTransmita(uint16 *x,int size); + +uint8 i16AVRUARTTransmita(int16 *x,int size); + +uint8 i8AVRUARTTransmita(int8 *x,int size); + +uint8 u8AVRUSARTReceiveCharu8(); + +uint8 dAVRUARTTransmits(double data); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRUART_H__ */ + + diff --git a/src/c/hardware/avr/includes/AVRUtil.h b/src/c/hardware/avr/includes/AVRUtil.h index 0aa1923..55789be 100644 --- a/src/c/hardware/avr/includes/AVRUtil.h +++ b/src/c/hardware/avr/includes/AVRUtil.h @@ -1,8 +1,14 @@ -//This file defines functions corresponding to delay functions -// -// Authors -// Siddhesh Wani +// Copyright (C) 2017 - IIT Bombay - FOSSEE // +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Siddhesh Wani +// Email: toolbox@scilab.in + #ifndef __AVRUTIL_H__ #define __AVRUTIL_H__ diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h index 425b03f..5d3a48e 100644 --- a/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h +++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h @@ -1,8 +1,14 @@ -//This file defines constants corresponding to gpios. -// -// Authors -// Siddhesh Wani +// Copyright (C) 2017 - IIT Bombay - FOSSEE // +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Aithor: Ashish Kamble +// Email: toolbox@scilab.in + #ifndef __INT_AVRPERIPHERALADC_H__ #define __INT_AVRPERIPHERALADC_H__ diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h index c034718..3fcbb8f 100644 --- a/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h +++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h @@ -1,8 +1,15 @@ -//This file defines constants corresponding to gpios. -// -// Authors -// Siddhesh Wani + +// Copyright (C) 2017 - IIT Bombay - FOSSEE // +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Siddhesh Wani, Ashish Kamble +// Email: toolbox@scilab.in + #ifndef __INT_AVRPERIPHERALGPIO_H__ #define __INT_AVRPERIPHERALGPIO_H__ @@ -22,6 +29,10 @@ extern "C" { #define AVRDigitalOut(in1,in2,in3) u8AVRDigitalOuts((uint8) in1,\ (uint8) in2, (uint8) in3); +#define AVRDigitalPortSetup(in1,in2) u8AVRDigitalPortSetups((uint8) in1,\ + (uint8) in2); + + #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 2d5e5cb..5c5950b 100644 --- a/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h +++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralPWM.h @@ -1,8 +1,14 @@ -//This file defines constants corresponding to gpios. -// -// Authors -// Siddhesh Wani +// Copyright (C) 2017 - IIT Bombay - FOSSEE // +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Ashish Kamble +// Email: toolbox@scilab.in + #ifndef __INT_AVRPERIPHERALPWM_H__ #define __INT_AVRPERIPHERALPWM_H__ @@ -14,10 +20,17 @@ extern "C" { #endif -#define AVRPWMSetup(in1,in2,in3,in4) u8AVRPWMSetups((uint8) in1,\ - (uint8) in2, (uint8) in3, (uint8) in4); +#define AVRPWM0Setup(in1,in2) u8AVRPWM0Setups((uint8) in1, (uint8) in2); + +#define AVRPWM2Setup(in1,in2) u8AVRPWM2Setups((uint8) in1, (uint8) in2); + +#define AVRPWM1Setup(in1,in2,in3) u8AVRPWM1Setups((uint8) in1, (uint8) in2, (uint8) in3); + +#define AVRPWM0SetDuty(in1) u8AVRPWM0SetDutys((uint8) in1); + +#define AVRPWM2SetDuty(in1) u8AVRPWM2SetDutys((uint8) in1); -#define AVRPWMSetDuty(in1,in2) u8AVRPWMSetDutys((uint8) in1, (uint8) in2); +#define AVRPWM1SetDuty(in1,in2,in3) u8AVRPWM1SetDutys((uint8) in1,(uint16) in2,(uint16) in3); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h index b4b66ba..3ec6a7e 100644 --- a/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h +++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralTimer.h @@ -1,8 +1,14 @@ -//This file defines constants corresponding to gpios. -// -// Authors -// Siddhesh Wani +// Copyright (C) 2017 - IIT Bombay - FOSSEE // +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Siddhesh Wani, Ashish Kamble +// Email: toolbox@scilab.in + #ifndef __INT_AVRPERIPHERALTIMER_H__ #define __INT_AVRPERIPHERALTIMER_H__ @@ -14,9 +20,9 @@ extern "C" { #endif -#define AVRTimerSetup(in1,in2) u8AVRTimerSetups((uint8) in1, (uint8) in2); +#define AVRGetTimerValue(in1) u8AVRGetTimerValues((uint16) in1); -#define AVRGetTimerValue(in1) u8AVRGetTimerValues((uint8) in1); +#define AVRTimerSetup(in1,in2,in3) u8AVRTimerSetups((uint8) in1, (uint16) in2, (uint8) in3); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/hardware/avr/interfaces/int_AVRPeripheralUART.h b/src/c/hardware/avr/interfaces/int_AVRPeripheralUART.h new file mode 100644 index 0000000..81b4af6 --- /dev/null +++ b/src/c/hardware/avr/interfaces/int_AVRPeripheralUART.h @@ -0,0 +1,57 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Authors: Siddhesh Wani, Ashish Kamble +// Email: toolbox@scilab.in + + +#ifndef __INT_AVRPERIPHERALUART_H__ +#define __INT_AVRPERIPHERALUART_H__ + +#include <avr/io.h> +#include "AVRPeripheralUART.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define AVRUARTSetup(in1,in2,in3,in4) u8AVRUARTSetups((uint8) in1,(uint32) in2,(uint8) in3,(uint8) in4); + +#define u80AVRUARTTransmitu80(in1) u8AVRUARTTransmits((uint8) in1); + +#define g2AVRUARTTransmitu80(in1,in2) gAVRUARTTransmits((char*) in1,in2[0]*in2[1]); + +#define u160AVRUARTTransmitu80(in1) u16AVRUARTTransmits((uint16) in1); + +#define i160AVRUARTTransmitu80(in1) i16AVRUARTTransmits((int16) in1); + +#define i80AVRUARTTransmitu80(in1) i8AVRUARTTransmits((int8) in1); + +#define u82AVRUARTTransmitu80(in1,in2) u8AVRUARTTransmita((uint8) in1,in2[0]*in2[1]); + +#define d0AVRUARTTransmitu80(in1) dAVRUARTTransmits((double) in1); + +//#define g2AVRUARTTransmitu80(in1,in2) gAVRUARTTransmita((char*) in1,in2[0]*in2[1]); + +#define u162AVRUARTTransmitu80(in1,in2) u16AVRUARTTransmita((uint16) in1,in2[0]*in2[1]); + +#define i162AVRUARTTransmitu80(in1,in2) i16AVRUARTTransmita((int16) in1,in2[0]*in2[1]); + +#define i82AVRUARTTransmitu80(in1,in2) i8AVRUARTTransmita((int8) in1,in2[0]*in2[1]); + +#define u80AVRUSARTReceiveCharu80() u8AVRUSARTReceiveCharu8(); + +//#define s0AVRUARTTransmitu80(in1) sAVRUARTTransmits((float) in1); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALUART_H__ */ diff --git a/src/c/hardware/avr/interfaces/int_AVRUtil.h b/src/c/hardware/avr/interfaces/int_AVRUtil.h index 2d6bbef..51cbce5 100644 --- a/src/c/hardware/avr/interfaces/int_AVRUtil.h +++ b/src/c/hardware/avr/interfaces/int_AVRUtil.h @@ -1,8 +1,14 @@ -//This file defines interfaces corresponding to uitl function. -// -// Authors -// Siddhesh Wani +// Copyright (C) 2017 - IIT Bombay - FOSSEE // +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Siddhesh Wani +// Email: toolbox@scilab.in + #ifndef __INT_AVRUTIL_H__ #define __INT_AVRUTIL_H__ @@ -14,7 +20,10 @@ extern "C" { #endif -#define d0sleepu80(in1) u16AVRSleeps ((uint16) in1); +//#define d0sleepu80(in1) u16AVRSleeps ((uint16) in1); + +#define AVRSleep(in1) u16AVRSleeps ((uint16) in1); + #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/hardware/avr/pwm/u8AVRPWM0SetDutys.c b/src/c/hardware/avr/pwm/u8AVRPWM0SetDutys.c new file mode 100644 index 0000000..106a872 --- /dev/null +++ b/src/c/hardware/avr/pwm/u8AVRPWM0SetDutys.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Set Duty cycle of PWM Output generated by Timer0 at OC0 pin. + + +#include "AVRPeripheralPWM.h" + +uint8 u8AVRPWM0SetDutys(uint8 duty) +{ + uint8 duty_value = 0; + duty_value = (((uint16)(duty * 0xff))/100); + OCR0 = duty_value; + return 0; +} + diff --git a/src/c/hardware/avr/pwm/u8AVRPWM0Setups.c b/src/c/hardware/avr/pwm/u8AVRPWM0Setups.c new file mode 100644 index 0000000..131ee68 --- /dev/null +++ b/src/c/hardware/avr/pwm/u8AVRPWM0Setups.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Setup PWM output for OC0 pin. + + +#include "AVRPeripheralPWM.h" + + +uint8 u8AVRPWM0Setups(uint8 waveform_mode, uint8 output_mode) +{ + switch(waveform_mode) + { + case 0: + TCCR0 |= (1<<WGM00); + break; + + case 1: + TCCR0 |= (1<<WGM00)|(1<<WGM01); + break; + + case 2: + TCCR0 |= (1<<WGM01); + break; + } + switch(output_mode) + { + case 0: + TCCR0 |= (1<<COM01); + break; + + case 1: + TCCR0 |= (1<<COM00)|(1<<COM01); + break; + + case 2: + TCCR0 |= (1<<COM00); + break; + } + return 0; +} + diff --git a/src/c/hardware/avr/pwm/u8AVRPWM1SetDutys.c b/src/c/hardware/avr/pwm/u8AVRPWM1SetDutys.c new file mode 100644 index 0000000..47aad1c --- /dev/null +++ b/src/c/hardware/avr/pwm/u8AVRPWM1SetDutys.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Set Duty cycle and Top Value of PWM Output generated by Timer1 at OC1A or OC1B pin. + +#include "AVRPeripheralPWM.h" + +uint8 u8AVRPWM1SetDutys(uint8 output_pin, uint16 duty, uint16 Top_Value) +{ + uint16 duty_value = 0; + ICR1 = Top_Value; + if(output_pin==0) + { + duty_value = (((uint16)(duty * Top_Value))/100); + OCR1A = duty_value; + } + else if(output_pin==1) + { + duty_value = (((uint16)(duty * Top_Value))/100); + OCR1B = duty_value; + } + return 0; +} diff --git a/src/c/hardware/avr/pwm/u8AVRPWM1Setups.c b/src/c/hardware/avr/pwm/u8AVRPWM1Setups.c new file mode 100644 index 0000000..b3f2d8f --- /dev/null +++ b/src/c/hardware/avr/pwm/u8AVRPWM1Setups.c @@ -0,0 +1,69 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Setup PWM output for OC1A or OC1B pin. + +#include "AVRPeripheralPWM.h" + +uint8 u8AVRPWM1Setups(uint8 waveform_mode, uint8 output_mode, uint8 output_pin) +{ + switch(waveform_mode) + { + case 0: + TCCR1A |= (1<<WGM11); + TCCR1B |= (1<<WGM13); + break; + + case 1: + TCCR1A |= (1<<WGM11); + TCCR1B |= (1<<WGM12)|(1<<WGM13); + break; + + case 2: + TCCR1B |= (1<<WGM12)|(1<<WGM13); + break; + } + if(output_pin==0) + { + switch(output_mode) + { + case 0: + TCCR1A |= (1<<COM1A1); + break; + + case 1: + TCCR1A |= (1<<COM1A0)|(1<<COM1A1); + break; + + case 2: + TCCR1A |= (1<<COM1A0); + break; + } + } + else if(output_pin==1) + { + switch(output_mode==0) + { + case 0: + TCCR1A |= (1<<COM1B1); + break; + + case 1: + TCCR1A |= (1<<COM1B0)|(1<<COM1B1); + break; + + case 2: + TCCR1A |= (1<<COM1B0); + break; + } + } + return 0; +} diff --git a/src/c/hardware/avr/pwm/u8AVRPWM2SetDutys.c b/src/c/hardware/avr/pwm/u8AVRPWM2SetDutys.c new file mode 100644 index 0000000..e0b5318 --- /dev/null +++ b/src/c/hardware/avr/pwm/u8AVRPWM2SetDutys.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Set Duty cycle of PWM Output generated by Timer2 at OC2 pin. + +#include "AVRPeripheralPWM.h" + +uint8 u8AVRPWM2SetDutys(uint8 duty) +{ + uint8 duty_value = 0; + duty_value = (uint8)(((uint16)(duty * 0xff))/100); + OCR2 = duty_value; + return 0; +} diff --git a/src/c/hardware/avr/pwm/u8AVRPWM2Setups.c b/src/c/hardware/avr/pwm/u8AVRPWM2Setups.c new file mode 100644 index 0000000..f5f8767 --- /dev/null +++ b/src/c/hardware/avr/pwm/u8AVRPWM2Setups.c @@ -0,0 +1,47 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Setup PWM output for OC2 pin. + +#include "AVRPeripheralPWM.h" + +uint8 u8AVRPWM2Setups(uint8 waveform_mode, uint8 output_mode) +{ + switch(waveform_mode) + { + case 0: + TCCR2 |= (1<<WGM20); + break; + + case 1: + TCCR2 |= (1<<WGM20)|(1<<WGM21); + break; + + case 2: + TCCR2 |= (1<<WGM21); + break; + } + switch(output_mode) + { + case 0: + TCCR2 |= (1<<COM21); + break; + + case 1: + TCCR2 |= (1<<COM20)|(1<<COM21); + break; + + case 2: + TCCR2 |= (1<<COM20); + break; + } + return 0; +} diff --git a/src/c/hardware/avr/pwm/u8AVRPWMSetDutys.c b/src/c/hardware/avr/pwm/u8AVRPWMSetDutys.c deleted file mode 100644 index 0f358fc..0000000 --- a/src/c/hardware/avr/pwm/u8AVRPWMSetDutys.c +++ /dev/null @@ -1,39 +0,0 @@ -// Function to set duty for PWM of AVR -// -// Calling Sequence -// u8AVRPWMSetDutys(uint8 timer, uint8 duty) -// -// Parameters -// timer: timer to be used for PWM generation (0,1,2) -// duty: duty for PWM waveform (0-100) -// -// Description -// This function sets duty for PWM waveform according to given parameters. -// -// Examples -// u8AVRPWMSetDutys(0,10) //Sets 10% duty for timer 0 output. -// -// Authors -// Siddhesh Wani -// - -#include "AVRPeripheralPWM.h" - -void u8AVRPWMSetDutys(uint8 timer, uint8 duty) -{ - uint8 duty_value=0; - - switch(timer) - { - case 0: - duty_value = (uint8)(((uint16)(duty * 0xff))/100); - OCR0 = duty_value; - break; - case 2: - duty_value = (uint8)(((uint16)(duty * 0xff))/100); - OCR2 = duty_value; - break; - } - - -} diff --git a/src/c/hardware/avr/pwm/u8AVRPWMSetups.c b/src/c/hardware/avr/pwm/u8AVRPWMSetups.c deleted file mode 100644 index 945f231..0000000 --- a/src/c/hardware/avr/pwm/u8AVRPWMSetups.c +++ /dev/null @@ -1,60 +0,0 @@ -// 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" - - -void 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: - TCCR2|= (prescalar & 0x07); //Select clock source - //Select waveform generation mode - TCCR2|= ((waveform_mode & 0x04) << 4); - //Select compare output mode - TCCR2 |= ((output_mode & 0x01) << 3); //WGM0 - TCCR2 |= ((output_mode & 0x02) << 6); //WGM1 - break; - } -} - diff --git a/src/c/hardware/avr/timer/u16AVRGetTimerValues.c b/src/c/hardware/avr/timer/u16AVRGetTimerValues.c new file mode 100644 index 0000000..8ef16e8 --- /dev/null +++ b/src/c/hardware/avr/timer/u16AVRGetTimerValues.c @@ -0,0 +1,51 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function selects the clock source and timer with prescaler. + + +#include "AVRPeripheralTimer.h" +#include <avr/interrupt.h> + + +uint16 u8AVRGetTimerValues(uint16 timer) +{ + uint16_t x; + switch(timer) + { + case 0: + { + x = TCNT0; + break; + } + + case 1: + { + unsigned char sreg; + unsigned int val; + sreg = SREG; + cli(); + val = TCNT1; + SREG = sreg; + sei(); + x = val; + break; + } + + case 2: + { + x = TCNT2; + break; + } + } +return x; +} + diff --git a/src/c/hardware/avr/timer/u8AVRGetTimerValues.c b/src/c/hardware/avr/timer/u8AVRGetTimerValues.c index c542c18..e08bb3a 100644 --- a/src/c/hardware/avr/timer/u8AVRGetTimerValues.c +++ b/src/c/hardware/avr/timer/u8AVRGetTimerValues.c @@ -1,3 +1,14 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + + // Function to get timer count // // Calling Sequence @@ -12,26 +23,41 @@ // // // Authors -// Siddhesh Wani +// Ashish Kamble // #include "AVRPeripheralTimer.h" +#include <avr/interrupt.h> -uint8 u8AVRGetTimerValues(uint8 timer) -{ +uint16 u8AVRGetTimerValues(uint16 timer) +{ uint16_t x; switch(timer) { case 0: - return TCNT0; - + { + x = TCNT0; + break; + } case 1: - break; + { + unsigned char sreg; + unsigned int val; + sreg = SREG; + cli(); + val = TCNT1; + SREG = sreg; + sei(); + x = val; + break; + } case 2: - return TCNT2; + { + x = TCNT2; + break; + } } - - return 0; +return x; } diff --git a/src/c/hardware/avr/timer/u8AVRTimerSetups.c b/src/c/hardware/avr/timer/u8AVRTimerSetups.c index 1d93429..6ee8d2a 100644 --- a/src/c/hardware/avr/timer/u8AVRTimerSetups.c +++ b/src/c/hardware/avr/timer/u8AVRTimerSetups.c @@ -1,42 +1,110 @@ -// 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 -// +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function selects the clock source and timer with prescaler. #include "AVRPeripheralTimer.h" - -uint8 u8AVRTimerSetups(uint8 timer,uint8 prescalar) +uint8 u8AVRTimerSetups(uint8 timer,uint16 prescaler,uint8 clock_source) { - 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; + + if(clock_source==0) + { + if(timer==0) + { + switch(prescaler) + { + case 1: TCCR0 |= (1<<CS00); + TCNT0 = 0x00; + case 8: TCCR0 |= (1<<CS01); + TCNT0 = 0x00; + case 64: TCCR0 |= (1<<CS00)|(1<<CS01); + TCNT0 = 0x00; + case 256: TCCR0 |= (1<<CS02); + TCNT0 = 0x00; + case 1024: TCCR0 |= (1<<CS00)|(1<<CS02); + TCNT0 = 0x00; + } + } + else if(timer==2) + { + switch(prescaler) + { + case 1: TCCR2 |= (1<<CS20); + TCNT2 = 0x00; + case 8: TCCR2 |= (1<<CS21); + TCNT2 = 0x00; + case 64: TCCR2 |= (1<<CS20)|(1<<CS21); + TCNT2 = 0x00; + case 256: TCCR2 |= (1<<CS22); + TCNT2 = 0x00; + case 1024: TCCR2 |= (1<<CS20)|(1<<CS22); + TCNT2 = 0x00; + } + } + else if(timer==1) + { + switch(prescaler) + { + case 1: TCCR1B |= (1<<CS10); + TCNT1H = 0x00; + TCNT1L = 0x00; + case 8: TCCR1B |= (1<<CS11); + TCNT1H = 0x00; + TCNT1L = 0x00; + case 64: TCCR1B |= (1<<CS10)|(1<<CS11); + TCNT1H = 0x00; + TCNT1L = 0x00; + case 256: TCCR1B |= (1<<CS12); + TCNT1H = 0x00; + TCNT1L = 0x00; + case 1024: TCCR1B |= (1<<CS10)|(1<<CS12); + TCNT1H = 0x00; + TCNT1L = 0x00; + } + } + } + else if(clock_source==1) + { + if(timer==0) + { + TCCR0 |= (1<<CS00)|(1<<CS01)|(1<<CS02); + TCNT0 = 0x00; + } + else if(timer==2) + { + TCCR2 |= (1<<CS20)|(1<<CS21)|(1<<CS22); + TCNT2 = 0x00; + } + else if(timer==1) + { + TCCR1B |= (1<<CS10)|(1<<CS11)|(1<<CS12); + TCNT1H = 0x00; + TCNT1L = 0x00; + } + } + return 0; } + + + + + + + + + + + + + + diff --git a/src/c/hardware/avr/uart/dAVRUARTTransmits.c b/src/c/hardware/avr/uart/dAVRUARTTransmits.c new file mode 100644 index 0000000..ec63c4d --- /dev/null +++ b/src/c/hardware/avr/uart/dAVRUARTTransmits.c @@ -0,0 +1,88 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Not Tested// +#include "AVRPeripheralUART.h" +#include<math.h> + + +uint8 dAVRUARTTransmits(double data) +{ + //Extract integer part + long int intpart = (long int)data; + //Extract double part + //double floatpart = data - (double)intpart; + char* str; + int i = 0; + while(intpart) + { + str[i] = (intpart%10) + '0'; + intpart = intpart/10; + i++; + } + str[i]='\0'; + /* + int j = 0; + int k = i-1; + char temp; + while(j<k) + { + temp = str[j]; + str[j] = str[k]; + str[k] = temp; + j++; + k--; + } +*/ + + + /* + char* strfloat; + floatpart = floatpart*1000000000; + int l = 0; + while(floatpart) + { + strfloat[l] = ((unsigned int)floatpart%10) + '0'; + floatpart = floatpart/10; + l++; + } + while(*strfloat!='\0') + { + str[i+1] = strfloat[l-1]; + i++; + l--; + } + */ + + while(*str!='\0') + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = *str; // Put data into buffer, sends the data + str++; + } + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (10); // Put data into buffer, sends the data + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (13); // Put data into buffer, sends the data + return 0; +} + + + + + + + + + + + + diff --git a/src/c/hardware/avr/uart/dAVRUARTTransmitu8.c b/src/c/hardware/avr/uart/dAVRUARTTransmitu8.c new file mode 100644 index 0000000..8978cc0 --- /dev/null +++ b/src/c/hardware/avr/uart/dAVRUARTTransmitu8.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Char. + + +#include "AVRPeripheralUART.h" + +uint8 dAVRUARTTransmitu8(uint8 data) +{ + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = data; // Put data into buffer, sends the data +} diff --git a/src/c/hardware/avr/uart/gAVRUARTTransmita.c b/src/c/hardware/avr/uart/gAVRUARTTransmita.c new file mode 100644 index 0000000..fea9319 --- /dev/null +++ b/src/c/hardware/avr/uart/gAVRUARTTransmita.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit String. + + +#include "AVRPeripheralUART.h" + + +uint8 gAVRUARTTransmita(uint8 *x, int size) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + gAVRUARTTransmits(x[i]); + } + return 0; +} diff --git a/src/c/hardware/avr/uart/gAVRUARTTransmits.c b/src/c/hardware/avr/uart/gAVRUARTTransmits.c new file mode 100644 index 0000000..502f272 --- /dev/null +++ b/src/c/hardware/avr/uart/gAVRUARTTransmits.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit String. + + +#include "AVRPeripheralUART.h" + + +uint8 gAVRUARTTransmits(char* msg,int size) +{ + while(*msg!='\0') + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = *msg; // Put data into buffer, sends the data + msg++; + } +while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (10); // Put data into buffer, sends the data + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (13); // Put data into buffer, sends the data + return 0; +} diff --git a/src/c/hardware/avr/uart/gAVRUARTTransmitu8.c b/src/c/hardware/avr/uart/gAVRUARTTransmitu8.c new file mode 100644 index 0000000..f338406 --- /dev/null +++ b/src/c/hardware/avr/uart/gAVRUARTTransmitu8.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit String. + + +#include "AVRPeripheralUART.h" + +uint8 gAVRUARTTransmitu8(uint8 *msg) +{ + while(*msg!='\0') + { + AVRUARTTransmitChar(*msg); + msg++; + } +} diff --git a/src/c/hardware/avr/uart/i16AVRUARTTransmita.c b/src/c/hardware/avr/uart/i16AVRUARTTransmita.c new file mode 100644 index 0000000..8d0fcd4 --- /dev/null +++ b/src/c/hardware/avr/uart/i16AVRUARTTransmita.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Signed Integer Values. + + +#include "AVRPeripheralUART.h" + +uint8 i16AVRUARTTransmita(int16 *x, int size) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + i16AVRUARTTransmits(x[i]); + } + return 0; +} + + diff --git a/src/c/hardware/avr/uart/i16AVRUARTTransmits.c b/src/c/hardware/avr/uart/i16AVRUARTTransmits.c new file mode 100644 index 0000000..4d90776 --- /dev/null +++ b/src/c/hardware/avr/uart/i16AVRUARTTransmits.c @@ -0,0 +1,73 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Signed Integer Values. + + +#include "AVRPeripheralUART.h" + + +uint8 i16AVRUARTTransmits(int16 data) +{ + uint8 temp1; + uint8 temp2; + uint8 temp3; + uint8 temp4; + uint8 temp5; + if(data<0) + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (45); // Put data into buffer, sends the data + } + data = abs(data); + temp1 = data/10000; + if(temp1==0); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp1); // Put data into buffer, sends the data + } + data = data % 10000; + temp2 = data/1000; + if((temp1==0)&(temp2==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp2); // Put data into buffer, sends the data + } + data = data % 1000; + temp3 = data/100; + if((temp1==0)&(temp2==0)&(temp3==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp3); // Put data into buffer, sends the data + } + data = data % 100; + temp4 = data/10; + if((temp1==0)&(temp2==0)&(temp3==0)&(temp4==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp4); // Put data into buffer, sends the data + } + temp5 = data % 10; + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp5); // Put data into buffer, sends the data + + + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (10); // Put data into buffer, sends the data + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (13); // Put data into buffer, sends the data + return 0; +} + diff --git a/src/c/hardware/avr/uart/i16AVRUARTTransmitu8.c b/src/c/hardware/avr/uart/i16AVRUARTTransmitu8.c new file mode 100644 index 0000000..99638c7 --- /dev/null +++ b/src/c/hardware/avr/uart/i16AVRUARTTransmitu8.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Signed Integer Values. + + +#include "AVRPeripheralUART.h" + +uint8 i16AVRUARTTransmitu8(int16 data) +{ + uint16 temp1; + uint16 temp2; + temp1 = abs(data)/100; + if(data<0) + AVRUARTTransmitChar(45); + AVRUARTTransmitChar(48+temp1); + temp1 = abs(data) - temp1*100; + temp2 = temp1; + temp1 = temp1/10; + AVRUARTTransmitChar(48+temp1); + temp2 = temp2 - temp1*10; + AVRUARTTransmitChar(48+temp2); +} diff --git a/src/c/hardware/avr/uart/i8AVRUARTTransmita.c b/src/c/hardware/avr/uart/i8AVRUARTTransmita.c new file mode 100644 index 0000000..1034573 --- /dev/null +++ b/src/c/hardware/avr/uart/i8AVRUARTTransmita.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Signed Integer Values. + + +#include "AVRPeripheralUART.h" + +uint8 i8AVRUARTTransmita(int8 *x,int size) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + i8AVRUARTTransmits(x[i]); + } + return 0; +} diff --git a/src/c/hardware/avr/uart/i8AVRUARTTransmits.c b/src/c/hardware/avr/uart/i8AVRUARTTransmits.c new file mode 100644 index 0000000..6b8c20f --- /dev/null +++ b/src/c/hardware/avr/uart/i8AVRUARTTransmits.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Signed Integer Values. + + +#include "AVRPeripheralUART.h" + +uint8 i8AVRUARTTransmits(int8 data) +{ + uint8 temp1; + temp1 = abs(data); + if(data<0) + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (45); // Put data into buffer, sends the data + u8AVRUARTTransmits(temp1); + return 0; +} diff --git a/src/c/hardware/avr/uart/u16AVRUARTTransmita.c b/src/c/hardware/avr/uart/u16AVRUARTTransmita.c new file mode 100644 index 0000000..8b8e630 --- /dev/null +++ b/src/c/hardware/avr/uart/u16AVRUARTTransmita.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Unsigned Integer Values. + +#include "AVRPeripheralUART.h" + +uint8 u16AVRUARTTransmita(uint16 *x, int size) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + u16AVRUARTTransmits(x[i]); + } + return 0; +} + + + + diff --git a/src/c/hardware/avr/uart/u16AVRUARTTransmits.c b/src/c/hardware/avr/uart/u16AVRUARTTransmits.c new file mode 100644 index 0000000..3cfb4a2 --- /dev/null +++ b/src/c/hardware/avr/uart/u16AVRUARTTransmits.c @@ -0,0 +1,87 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Unsigned Integer Values. + +#include "AVRPeripheralUART.h" + +uint8 u16AVRUARTTransmits(uint16 data) +{ + uint8 temp1; + uint8 temp2; + uint8 temp3; + uint8 temp4; + uint8 temp5; + temp1 = data/10000; + if(temp1==0); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp1); // Put data into buffer, sends the data + } + data = data % 10000; + temp2 = data/1000; + if((temp1==0)&(temp2==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp2); // Put data into buffer, sends the data + } + data = data % 1000; + temp3 = data/100; + if((temp1==0)&(temp2==0)&(temp3==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp3); // Put data into buffer, sends the data + } + data = data % 100; + temp4 = data/10; + if((temp1==0)&(temp2==0)&(temp3==0)&(temp4==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp4); // Put data into buffer, sends the data + } + temp5 = data % 10; + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp5); // Put data into buffer, sends the data + + + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (10); // Put data into buffer, sends the data + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (13); // Put data into buffer, sends the data + return 0; +} + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/c/hardware/avr/uart/u16AVRUARTTransmitu8.c b/src/c/hardware/avr/uart/u16AVRUARTTransmitu8.c new file mode 100644 index 0000000..a68a5aa --- /dev/null +++ b/src/c/hardware/avr/uart/u16AVRUARTTransmitu8.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Unsigned Integer Values. + +#include "AVRPeripheralUART.h" + +uint8 u16AVRUARTTransmitu8(uint16 data) +{ + uint8 temp1; + uint8 temp2; + uint8 temp3; + uint8 temp4; + temp1 = data/10000; + dAVRUARTTransmitu8(48+temp1); + temp1 = data - temp1*10000; + temp2 = temp1; + temp1 = temp1/1000; + dAVRUARTTransmitu8(48+temp1); + temp1 = temp2 - temp1*1000; + temp3 = temp1; + temp1 = temp1/100; + dAVRUARTTransmitu8(48+temp1); + temp1 = temp3 - temp1*100; + temp4 = temp1; + temp1 = temp1/10; + dAVRUARTTransmitu8(48+temp1); + temp1 = temp4 - temp1*10; + dAVRUARTTransmitu8(48+temp1); +} diff --git a/src/c/hardware/avr/uart/u8AVRUARTReceiveCharu8.c b/src/c/hardware/avr/uart/u8AVRUARTReceiveCharu8.c new file mode 100644 index 0000000..df0a55b --- /dev/null +++ b/src/c/hardware/avr/uart/u8AVRUARTReceiveCharu8.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Receive Char. + +#include "AVRPeripheralUART.h" + +uint8 u8AVRUSARTReceiveCharu8() +{ + while ( !(UCSRA & (1<<RXC)) ) ; // Wait for data to be received + return UDR; // Get and return received data from buffer +} diff --git a/src/c/hardware/avr/uart/u8AVRUARTSetups.c b/src/c/hardware/avr/uart/u8AVRUARTSetups.c index f311500..085ac6e 100644 --- a/src/c/hardware/avr/uart/u8AVRUARTSetups.c +++ b/src/c/hardware/avr/uart/u8AVRUARTSetups.c @@ -1,84 +1,143 @@ -// 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 -// +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Setup Serial communication for ATmega16. + #include "AVRPeripheralUART.h" -uint8 u8AVRUARTSetups(uint8 mode, uint8 baudrate, uint8 stopbits, uint8 parity) +uint8 u8AVRUARTSetups(uint8 mode, uint32 baudrate, uint8 stopbits, uint8 parity) +{ +//Enable UART and USART + UCSRC |= (1<<URSEL); + UCSRB |= (1<<TXEN)|(1<<RXEN); + + switch (mode) //According to mode set bits UMSEL and U2X +{ + case 0: //Normal mode + UCSRC &= ~(1<<UMSEL); //Clear bit 6 UMSEL and U2X=0 + UCSRA &= ~(1<<U2X); + UCSRC &= ~(1<<UCPOL); // Clock polarity bit + break; + + case 1: //Double speed mode + UCSRC &= ~(1<<UMSEL); //Clear bit 6 UMSEL and U2X=1 + UCSRA |= (1<<U2X); + UCSRC &= ~(1<<UCPOL); //Clock polarity bit + break; + + case 2: //Synchronous mode + UCSRC |= (1<<UMSEL); //Set bit 6 UMSEL and set clock polarity + UCSRC |= (1<<UCPOL); + break; +} + +//Set stop bits +if(stopbits == 0) +{ + UCSRC &= ~(1<<USBS); // 1 stopbit +} +else UCSRC |= (1<<USBS); //2 stopbits + +//Set parity bit settings +switch(parity) +{ + case 0: // Parity disabled + UCSRC &= ~(1<<UPM1); //UPM1:0=0 + UCSRC &= ~(1<<UPM0); + break; + + case 1: // Even parity + UCSRC |= (1<<UPM1); //UPM1:0 = 2 + UCSRC &= ~(1<<UPM0); + break; + + case 2: // Odd parity + UCSRC |= (1<<UPM1); //UPM1:1 = 3 + UCSRC |= (1<<UPM0); + break; +} + +//Set baudrate +UCSRC &= ~(1<<URSEL); +switch(baudrate) { - 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; + case 2400: + UBRRL = 0xA0; + UBRRH = 0x01; + break; + + case 4800: + UBRRL = 0xCF; + UBRRH = 0x00; + break; + + case 9600: + UBRRL = 0x67; + UBRRH = 0x00; + break; + + case 14400: + UBRRL = 0x44; + UBRRH = 0x00; + break; + + case 19200: + UBRRL = 0x33; + UBRRH = 0x00; + break; + + case 28800: + UBRRL = 0x22; + UBRRH = 0x00; + break; + + case 38400: + UBRRL = 0x19; + UBRRH = 0x00; + break; + + case 57600: + UBRRL = 0x10; + UBRRH = 0x00; + break; + + case 768000: + UBRRL = 0x0C; + UBRRH = 0x00; + break; + + case 115200: + UBRRL = 0x08; + UBRRH = 0x00; + break; + + case 230400: + UBRRL = 0x03; + UBRRH = 0x00; + break; + + case 250000: + UBRRL = 0x03; + UBRRH = 0x00; + break; + + case 1000000: + UBRRL = 0x00; + UBRRH = 0x00; + break; } +//Set data format +UCSRC|= (1<<URSEL)|(1<<UCSZ0)|(1<<UCSZ1); + + return 0; +} diff --git a/src/c/hardware/avr/uart/u8AVRUARTTransmita.c b/src/c/hardware/avr/uart/u8AVRUARTTransmita.c new file mode 100644 index 0000000..14e2a0e --- /dev/null +++ b/src/c/hardware/avr/uart/u8AVRUARTTransmita.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Char. + + +#include "AVRPeripheralUART.h" + + +uint8 u8AVRUARTTransmita(uint8* x, int size) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + u8AVRUARTTransmits(x[i]); + } + return 0; +} diff --git a/src/c/hardware/avr/uart/u8AVRUARTTransmits.c b/src/c/hardware/avr/uart/u8AVRUARTTransmits.c new file mode 100644 index 0000000..e7e5c71 --- /dev/null +++ b/src/c/hardware/avr/uart/u8AVRUARTTransmits.c @@ -0,0 +1,60 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ashish Kamble + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +//Function to Transmit Char. + + +#include "AVRPeripheralUART.h" + +uint8 u8AVRUARTTransmits(uint8 data) +{ + uint8 temp1; + uint8 temp2; + temp1 = data; + data = data/100; + if(data==0); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+data); // Put data into buffer, sends the data + } + temp1 = temp1 - data*100; + temp2 = temp1; + temp1 = temp1/10; + if((data==0)&(temp1==0)); + else + { + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp1); // Put data into buffer, sends the data + } + temp2 = temp2 - temp1*10; + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (48+temp2); // Put data into buffer, sends the data + + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (10); // Put data into buffer, sends the data + while ( !( UCSRA & (1<<UDRE)) ) ; // Wait for empty transmit buffer + UDR = (13); // Put data into buffer, sends the data + return 0; +} + + + + + + + + + + + + + diff --git a/src/c/hardware/avr/util/u16AVRSleeps.c b/src/c/hardware/avr/util/u16AVRSleeps.c index 4d81c96..a6a7e50 100644 --- a/src/c/hardware/avr/util/u16AVRSleeps.c +++ b/src/c/hardware/avr/util/u16AVRSleeps.c @@ -1,8 +1,15 @@ -//Function to introduce specific delay in milliseconds -// -//Authors -// Siddhesh Wani +// Copyright (C) 2017 - IIT Bombay - FOSSEE // +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Organization: FOSSEE, IIT Bombay +// Author: Siddhesh Wani +// Email: toolbox@scilab.in + +//Function to introduce specific delay in milliseconds #include "AVRUtil.h" |