From de14a5628ad439e20770d10733ebdac46562a860 Mon Sep 17 00:00:00 2001 From: Jorawar Singh Date: Fri, 7 Jul 2017 13:00:37 +0530 Subject: Raspberry Pi function changes and minor gui changes --- macros/Hardware/AVR/lib | Bin 908 -> 0 bytes macros/Hardware/RasberryPi/lib | Bin 912 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 macros/Hardware/AVR/lib delete mode 100644 macros/Hardware/RasberryPi/lib (limited to 'macros/Hardware') diff --git a/macros/Hardware/AVR/lib b/macros/Hardware/AVR/lib deleted file mode 100644 index a3d9e10c..00000000 Binary files a/macros/Hardware/AVR/lib and /dev/null differ diff --git a/macros/Hardware/RasberryPi/lib b/macros/Hardware/RasberryPi/lib deleted file mode 100644 index ac87d042..00000000 Binary files a/macros/Hardware/RasberryPi/lib and /dev/null differ -- cgit From 3f52712f806fbd80d66dfdcaff401e5cf94dcca4 Mon Sep 17 00:00:00 2001 From: yash1112 Date: Fri, 7 Jul 2017 21:20:49 +0530 Subject: sci2c arduino updated --- macros/Hardware/AVR/AVRADCSetup.sci | 47 ++++++++++++ macros/Hardware/AVR/AVRDigitalIn.sci | 50 +++++++++++++ macros/Hardware/AVR/AVRDigitalOut.sci | 51 +++++++++++++ macros/Hardware/AVR/AVRDigitalPortSetup.sci | 47 ++++++++++++ macros/Hardware/AVR/AVRDigitalSetup.sci | 51 +++++++++++++ macros/Hardware/AVR/AVRGetTimerValue.sci | 40 +++++++++++ macros/Hardware/AVR/AVRPWM0SetDuty.sci | 35 +++++++++ macros/Hardware/AVR/AVRPWM0Setup.sci | 68 ++++++++++++++++++ macros/Hardware/AVR/AVRPWM1SetDuty.sci | 52 ++++++++++++++ macros/Hardware/AVR/AVRPWM1Setup.sci | 79 +++++++++++++++++++++ macros/Hardware/AVR/AVRPWM2SetDuty.sci | 38 ++++++++++ macros/Hardware/AVR/AVRPWM2Setup.sci | 69 ++++++++++++++++++ macros/Hardware/AVR/AVRReadADC.sci | 44 ++++++++++++ macros/Hardware/AVR/AVRSleep.sci | 4 ++ macros/Hardware/AVR/AVRTimerSetup.sci | 56 +++++++++++++++ macros/Hardware/AVR/AVRUARTReceive.sci | 30 ++++++++ macros/Hardware/AVR/AVRUARTSetup.sci | 61 ++++++++++++++++ macros/Hardware/AVR/AVRUARTTransmit.sci | 33 +++++++++ macros/Hardware/AVR/GetAVRSupportFunctions.sci | 43 +++++++++++ macros/Hardware/AVR/GetPeripheral.sci | 31 ++++++++ macros/Hardware/AVR/InsertPeripheralInList.sci | 27 +++++++ macros/Hardware/AVR/IsAVRSupportFunction.sci | 32 +++++++++ macros/Hardware/AVR/buildmacros.sce | 4 ++ macros/Hardware/AVR/lib | Bin 0 -> 1008 bytes macros/Hardware/AVR/names | 22 ++++++ .../Hardware/RasberryPi/GetRPISupportFunctions.sci | 48 +++++++++++++ .../Hardware/RasberryPi/IsRPISupportFunction.sci | 32 +++++++++ macros/Hardware/RasberryPi/RPI_DelayMicro.sci | 38 ++++++++++ macros/Hardware/RasberryPi/RPI_DelayMilli.sci | 39 ++++++++++ macros/Hardware/RasberryPi/RPI_DigitalIn.sci | 43 +++++++++++ macros/Hardware/RasberryPi/RPI_DigitalOut.sci | 44 ++++++++++++ macros/Hardware/RasberryPi/RPI_DigitalSetup.sci | 36 ++++++++++ macros/Hardware/RasberryPi/RPI_GetMicros.sci | 39 ++++++++++ macros/Hardware/RasberryPi/RPI_GetMillis.sci | 39 ++++++++++ macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci | 35 +++++++++ macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci | 32 +++++++++ macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci | 35 +++++++++ macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci | 39 ++++++++++ macros/Hardware/RasberryPi/RPI_PinISR.sci | 56 +++++++++++++++ macros/Hardware/RasberryPi/RPI_SerialClose.sci | 33 +++++++++ macros/Hardware/RasberryPi/RPI_SerialFlush.sci | 34 +++++++++ macros/Hardware/RasberryPi/RPI_SerialGetChar.sci | 36 ++++++++++ macros/Hardware/RasberryPi/RPI_SerialSendChar.sci | 37 ++++++++++ macros/Hardware/RasberryPi/RPI_SerialSendData.sci | 38 ++++++++++ macros/Hardware/RasberryPi/RPI_SerialSetup.sci | 36 ++++++++++ macros/Hardware/RasberryPi/buildmacros.sce | 4 ++ macros/Hardware/RasberryPi/lib | Bin 0 -> 1012 bytes macros/Hardware/RasberryPi/names | 21 ++++++ .../Hardware/RasberryPi/u16RPISerialDataAvail.sci | 37 ++++++++++ 49 files changed, 1845 insertions(+) create mode 100644 macros/Hardware/AVR/AVRADCSetup.sci create mode 100644 macros/Hardware/AVR/AVRDigitalIn.sci create mode 100644 macros/Hardware/AVR/AVRDigitalOut.sci create mode 100644 macros/Hardware/AVR/AVRDigitalPortSetup.sci create mode 100644 macros/Hardware/AVR/AVRDigitalSetup.sci create mode 100644 macros/Hardware/AVR/AVRGetTimerValue.sci create mode 100644 macros/Hardware/AVR/AVRPWM0SetDuty.sci create mode 100644 macros/Hardware/AVR/AVRPWM0Setup.sci create mode 100644 macros/Hardware/AVR/AVRPWM1SetDuty.sci create mode 100644 macros/Hardware/AVR/AVRPWM1Setup.sci create mode 100644 macros/Hardware/AVR/AVRPWM2SetDuty.sci create mode 100644 macros/Hardware/AVR/AVRPWM2Setup.sci create mode 100644 macros/Hardware/AVR/AVRReadADC.sci create mode 100644 macros/Hardware/AVR/AVRSleep.sci create mode 100644 macros/Hardware/AVR/AVRTimerSetup.sci create mode 100644 macros/Hardware/AVR/AVRUARTReceive.sci create mode 100644 macros/Hardware/AVR/AVRUARTSetup.sci create mode 100644 macros/Hardware/AVR/AVRUARTTransmit.sci create mode 100644 macros/Hardware/AVR/GetAVRSupportFunctions.sci create mode 100644 macros/Hardware/AVR/GetPeripheral.sci create mode 100644 macros/Hardware/AVR/InsertPeripheralInList.sci create mode 100644 macros/Hardware/AVR/IsAVRSupportFunction.sci create mode 100644 macros/Hardware/AVR/buildmacros.sce create mode 100644 macros/Hardware/AVR/lib create mode 100644 macros/Hardware/AVR/names create mode 100644 macros/Hardware/RasberryPi/GetRPISupportFunctions.sci create mode 100644 macros/Hardware/RasberryPi/IsRPISupportFunction.sci create mode 100644 macros/Hardware/RasberryPi/RPI_DelayMicro.sci create mode 100644 macros/Hardware/RasberryPi/RPI_DelayMilli.sci create mode 100644 macros/Hardware/RasberryPi/RPI_DigitalIn.sci create mode 100644 macros/Hardware/RasberryPi/RPI_DigitalOut.sci create mode 100644 macros/Hardware/RasberryPi/RPI_DigitalSetup.sci create mode 100644 macros/Hardware/RasberryPi/RPI_GetMicros.sci create mode 100644 macros/Hardware/RasberryPi/RPI_GetMillis.sci create mode 100644 macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci create mode 100644 macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci create mode 100644 macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci create mode 100644 macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci create mode 100644 macros/Hardware/RasberryPi/RPI_PinISR.sci create mode 100644 macros/Hardware/RasberryPi/RPI_SerialClose.sci create mode 100644 macros/Hardware/RasberryPi/RPI_SerialFlush.sci create mode 100644 macros/Hardware/RasberryPi/RPI_SerialGetChar.sci create mode 100644 macros/Hardware/RasberryPi/RPI_SerialSendChar.sci create mode 100644 macros/Hardware/RasberryPi/RPI_SerialSendData.sci create mode 100644 macros/Hardware/RasberryPi/RPI_SerialSetup.sci create mode 100644 macros/Hardware/RasberryPi/buildmacros.sce create mode 100644 macros/Hardware/RasberryPi/lib create mode 100644 macros/Hardware/RasberryPi/names create mode 100644 macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci (limited to 'macros/Hardware') diff --git a/macros/Hardware/AVR/AVRADCSetup.sci b/macros/Hardware/AVR/AVRADCSetup.sci new file mode 100644 index 00000000..264062bc --- /dev/null +++ b/macros/Hardware/AVR/AVRADCSetup.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 AVRADCSetup(prescaler,adc_ref) +// Function to initialise ADC of AVR +// +// Calling Sequence +// AVRADCSetup(uint8 prescaler, uint8 adc_ref) +// +// Parameters +// 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. 'prescaler' is +// needed for deciding ADC clock. ADC clock should be between 50KHz and 200KHz +// 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 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.sci b/macros/Hardware/AVR/AVRDigitalIn.sci new file mode 100644 index 00000000..54eb327b --- /dev/null +++ b/macros/Hardware/AVR/AVRDigitalIn.sci @@ -0,0 +1,50 @@ +// 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 +// +// Calling Sequence +// state=AVRDigitalIn(port,pin) +// +// Parameters +// port : port of microcontroller to be used +// pin : pin of port (mentioned above) to be used +// Returns +// state : state of an input pin (HIGH\LOW) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// 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 as +// digital input. +// +// Examples +// pinA0 = AVRDigitalIn(1,0) //To read state on pin 0 of port A +// +// See also +// AVRDigitalOut AVRDigitalSetup +// +// +// 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 : 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.sci b/macros/Hardware/AVR/AVRDigitalOut.sci new file mode 100644 index 00000000..a86a5aa9 --- /dev/null +++ b/macros/Hardware/AVR/AVRDigitalOut.sci @@ -0,0 +1,51 @@ +// 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 +// +// Calling Sequence +// AVRDigitalOut(port,pin,state) +// +// Parameters +// port : port of microcontroller to be used +// pin : pin of port (mentioned above) to be used +// state : state to be outputed on pin (HIGH\LOW) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port as +// digital output. Also, desired output state must be specified as +// 'HIGH' or 'LOW'. +// +// Examples +// AVRDigitalOut('A',0,HIGH) +// +// See also +// AVRDigitalIn +// +// +// 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>=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.sci b/macros/Hardware/AVR/AVRDigitalPortSetup.sci new file mode 100644 index 00000000..5f0b9671 --- /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.sci b/macros/Hardware/AVR/AVRDigitalSetup.sci new file mode 100644 index 00000000..e707d4fa --- /dev/null +++ b/macros/Hardware/AVR/AVRDigitalSetup.sci @@ -0,0 +1,51 @@ +// 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 +// direction : direction to be set for pin (INPUT\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 +// AVRDigitalSetup('A',0,OUTPUT) +// +// 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 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.sci b/macros/Hardware/AVR/AVRGetTimerValue.sci new file mode 100644 index 00000000..afb47ac8 --- /dev/null +++ b/macros/Hardware/AVR/AVRGetTimerValue.sci @@ -0,0 +1,40 @@ +// 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 count = AVRGetTimerValue(timer) +// Function to get timer count +// +// Parameters +// timer : timer whose current count is to be returned +// 0 for timer0 +// 1 for timer1 +// 2 for timer2 +// +// Description +// This function returns the count value of a desired timer.By knowing the count value +// certain interrupt action can be taken. +// +// Examples +// AVRGetTimerValue(0); //returns present count of the TCNT0 counter +// +// See also +// AVRTimerSetup +// +// 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 AVRGetTimerValue function."); +end +count = 0; +endfunction diff --git a/macros/Hardware/AVR/AVRPWM0SetDuty.sci b/macros/Hardware/AVR/AVRPWM0SetDuty.sci new file mode 100644 index 00000000..604d2f40 --- /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.sci b/macros/Hardware/AVR/AVRPWM0Setup.sci new file mode 100644 index 00000000..39861c86 --- /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.sci b/macros/Hardware/AVR/AVRPWM1SetDuty.sci new file mode 100644 index 00000000..60dc0a9f --- /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.sci b/macros/Hardware/AVR/AVRPWM1Setup.sci new file mode 100644 index 00000000..51aa25b1 --- /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.sci b/macros/Hardware/AVR/AVRPWM2SetDuty.sci new file mode 100644 index 00000000..929c1a0a --- /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.sci b/macros/Hardware/AVR/AVRPWM2Setup.sci new file mode 100644 index 00000000..d4bc74a6 --- /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/AVRReadADC.sci b/macros/Hardware/AVR/AVRReadADC.sci new file mode 100644 index 00000000..7fd3e67e --- /dev/null +++ b/macros/Hardware/AVR/AVRReadADC.sci @@ -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 +// Email: toolbox@scilab.in + +function adc_result = AVRReadADC(channel) +// Function to get voltage on analog pin on AVR +// +// Calling Sequence +// u8AVRReadADCs(channel) +// +// Parameters +// channel : Select which channel is to be read. Values from 0-7 select one +// of the pins ADC0-ADC7. For other possible channel values refer +// datasheet +// Returns-> +// result : Digital value for the voltage present on channel selected +// +// Description +// This function returns digital value for present on adc pins. 'channel' +// selects which of the ADC0-ADC7 is to be used for reading analog value. +// Apart from reading just ADC0-ADC7 other it can also read differential +// voltages between some pins. For channel values for those options, please +// refer datasheet. +// +// Examples +// adc_result = u8AVRReadADC(0) //Read ADC0 +// +// 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(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.sci b/macros/Hardware/AVR/AVRSleep.sci new file mode 100644 index 00000000..a1b6add2 --- /dev/null +++ b/macros/Hardware/AVR/AVRSleep.sci @@ -0,0 +1,4 @@ +function AVRSleep(delay) + + +endfunction diff --git a/macros/Hardware/AVR/AVRTimerSetup.sci b/macros/Hardware/AVR/AVRTimerSetup.sci new file mode 100644 index 00000000..7c5dd1da --- /dev/null +++ b/macros/Hardware/AVR/AVRTimerSetup.sci @@ -0,0 +1,56 @@ +// 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 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. +// +//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 +// 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 + +if(clock_source>=2) then +disp("Error : Invalid input argument ''clock_source'' in AVRTimerSetup function."); +end +endfunction diff --git a/macros/Hardware/AVR/AVRUARTReceive.sci b/macros/Hardware/AVR/AVRUARTReceive.sci new file mode 100644 index 00000000..790894fb --- /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.sci b/macros/Hardware/AVR/AVRUARTSetup.sci new file mode 100644 index 00000000..32e5db86 --- /dev/null +++ b/macros/Hardware/AVR/AVRUARTSetup.sci @@ -0,0 +1,61 @@ +// 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 AVRUARTSetup(mode, baudrate, stopbits, parity) +// Function to Setup Serial Communication i.e UART or USART in ATmega16. +// Description +// 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 . +// +// 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 +// AVRUARTTransmit +// 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. +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.sci b/macros/Hardware/AVR/AVRUARTTransmit.sci new file mode 100644 index 00000000..eb358499 --- /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.sci b/macros/Hardware/AVR/GetAVRSupportFunctions.sci new file mode 100644 index 00000000..99c6242f --- /dev/null +++ b/macros/Hardware/AVR/GetAVRSupportFunctions.sci @@ -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 +// Email: toolbox@scilab.in + +function AVRSupportFunctions = GetAVRSupportFunctions() +// ----------------------------------------------------------------- +// Get list of AVR peripherals supported +// +// Input data: +// None +// +// Output data: +// None +// +// Author: Siddhesh Wani Ashish Kamble +// ----------------------------------------------------------------- + +AVRSupportFunctions = [ + "AVRADCSetup" + "AVRDigitalIn" + "AVRDigitalOut" + "AVRDigitalSetup" + "AVRDigitalPortSetup" + "AVRTimerSetup" + "AVRGetTimerValue" + "AVRPWM0Setup" + "AVRPWM0SetDuty" + "AVRPWM1Setup" + "AVRPWM1SetDuty" + "AVRPWM2Setup" + "AVRPWM2SetDuty" + "AVRReadADC" + "AVRSleep" + "AVRUARTSetup" + ]; + +endfunction diff --git a/macros/Hardware/AVR/GetPeripheral.sci b/macros/Hardware/AVR/GetPeripheral.sci new file mode 100644 index 00000000..ac909deb --- /dev/null +++ b/macros/Hardware/AVR/GetPeripheral.sci @@ -0,0 +1,31 @@ +// 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 +// used peripherals +// +// Input data: +// FunName: Name of the function to be checked +// InArg:Input arguements passed to function 'FunName' +// +// Output data: +// Peripheral: Acronym for peripheral to be initialised +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +//select FunName + +//case AVRDigitalOut: +// Peripheral = list('PORT', InArg(1),InArg(2)]; +//end +endfunction diff --git a/macros/Hardware/AVR/InsertPeripheralInList.sci b/macros/Hardware/AVR/InsertPeripheralInList.sci new file mode 100644 index 00000000..198ea1da --- /dev/null +++ b/macros/Hardware/AVR/InsertPeripheralInList.sci @@ -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 +// Email: toolbox@scilab.in + +function InsertPeripheralInList(Peripheral,PeripheralListFile) +// ----------------------------------------------------------------- +// Insert input peripheral in peripherals' list +// +// Input data: +// Peripheral: Peripheral of type 'list' to be instertd in list +// PeripheralListFile: Name of file containing list of peripheral used +// +// Output data: +// None +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +load(PeripheralListFile,'PheripheralList'); + +endfunction diff --git a/macros/Hardware/AVR/IsAVRSupportFunction.sci b/macros/Hardware/AVR/IsAVRSupportFunction.sci new file mode 100644 index 00000000..94f4af7c --- /dev/null +++ b/macros/Hardware/AVR/IsAVRSupportFunction.sci @@ -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 +// Email: toolbox@scilab.in + +function Output = IsAVRSupportFunction(FunName) +// ----------------------------------------------------------------- +// Check whether input function name is an AVR support function or not. +// +// Input data: +// FunName: Name of the function to be checked +// +// Output data: +// Output: True or False depending whether given function is an AVR +// support functions or not +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +//Get list of supported functions for AVR +AVRSupportFunctions = GetAVRSupportFunctions(); + +//Check whether input function is present in above list or not +FunNameInAVRSupport = members(FunName,AVRSupportFunctions); +Output = bool2s(FunNameInAVRSupport~=0); + +endfunction diff --git a/macros/Hardware/AVR/buildmacros.sce b/macros/Hardware/AVR/buildmacros.sce new file mode 100644 index 00000000..2954a424 --- /dev/null +++ b/macros/Hardware/AVR/buildmacros.sce @@ -0,0 +1,4 @@ + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/Hardware/AVR/lib b/macros/Hardware/AVR/lib new file mode 100644 index 00000000..7631c354 Binary files /dev/null and b/macros/Hardware/AVR/lib differ diff --git a/macros/Hardware/AVR/names b/macros/Hardware/AVR/names new file mode 100644 index 00000000..8fcfdb75 --- /dev/null +++ b/macros/Hardware/AVR/names @@ -0,0 +1,22 @@ +AVRADCSetup +AVRDigitalIn +AVRDigitalOut +AVRDigitalPortSetup +AVRDigitalSetup +AVRGetTimerValue +AVRPWM0SetDuty +AVRPWM0Setup +AVRPWM1SetDuty +AVRPWM1Setup +AVRPWM2SetDuty +AVRPWM2Setup +AVRReadADC +AVRSleep +AVRTimerSetup +AVRUARTReceive +AVRUARTSetup +AVRUARTTransmit +GetAVRSupportFunctions +GetPeripheral +InsertPeripheralInList +IsAVRSupportFunction diff --git a/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci b/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci new file mode 100644 index 00000000..3e6397b2 --- /dev/null +++ b/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci @@ -0,0 +1,48 @@ +function RPiSupportFunctions = GetRPISupportFunctions() +// ----------------------------------------------------------------- +// Get list of RPI peripherals supported +// +// Input data: +// None +// +// Output data: +// None +// 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 +// Author: Siddhesh Wani +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in +// +// ----------------------------------------------------------------- + +RPiSupportFunctions = [ + "RPI_DigitalIn" + "RPI_DigitalOut" + "RPI_DigitalSetup" + "RPI_DelayMilli" + "RPI_DelayMicro" + "RPI_GetMillis" + "RPI_GetMicros" + "RPI_SerialSetup" + "RPI_SerialClose" + "RPI_SerialSendChar" + "RPI_SerialFlush" + "RPI_SerialGetChar" + "RPI_ThreadCreate" + "RPI_PinISR" + "RPI_HardPWMWrite" + "RPI_HardPWMSetRange" + "RPI_HardPWMSetClock" + "RPI_HardPWMSetMode" + ]; + +//Note: "RPI_SerialSendData" is removed since distinction between input data +//types is required + + +endfunction diff --git a/macros/Hardware/RasberryPi/IsRPISupportFunction.sci b/macros/Hardware/RasberryPi/IsRPISupportFunction.sci new file mode 100644 index 00000000..c6a2c365 --- /dev/null +++ b/macros/Hardware/RasberryPi/IsRPISupportFunction.sci @@ -0,0 +1,32 @@ +function Output = IsRPISupportFunction(FunName) +// ----------------------------------------------------------------- +// Check whether input function name is a RPi support function or not. +// +// Input data: +// FunName: Name of the function to be checked +// +// Output data: +// Output: True or False depending whether given function is a RPi +// support functions or not +// +// 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 +// Author: Siddhesh Wani +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in +// +// ----------------------------------------------------------------- + +//Get list of supported functions for AVR +RPISupportFunctions = GetRPISupportFunctions(); + +//Check whether input function is present in above list or not +FunNameInRPISupport = members(FunName,RPISupportFunctions); +Output = bool2s(FunNameInRPISupport~=0); + +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_DelayMicro.sci b/macros/Hardware/RasberryPi/RPI_DelayMicro.sci new file mode 100644 index 00000000..bbb0bb3b --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_DelayMicro.sci @@ -0,0 +1,38 @@ +// 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 RPI_DelayMicro(time) +// Function to insert some delay in code execution. +// +// Calling Sequence +// RPI_DelayMicro(time) +// +// Parameters +// time: time(microseconds) for which execution is to be delayed +// +// Description +// this function can be used for insertig execution delays. 'time' should be +// specified in microseconds.'time' should be between (1-65536). +// Note: Delay inserted by this function is not accurate, but depedent on +// operating system, other running tasks etc. +// +// Examples +// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. +// +// See also +// RPI_DelayMicro +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_DelayMilli.sci b/macros/Hardware/RasberryPi/RPI_DelayMilli.sci new file mode 100644 index 00000000..13b79625 --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_DelayMilli.sci @@ -0,0 +1,39 @@ +// 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 RPI_DelayMilli(time) +// Function to insert some delay in milli seconds in code execution. +// +// Calling Sequence +// RPI_DelayMilli(time) +// +// Parameters +// time: time(milliseconds) for which execution is to be delayed +// +// Description +// This function can be used for insertig execution delays. 'time' should be +// specified in milliseconds. If more resolution is required, use 'RPI_DelayMicro' +// for inserting delay in microseconds. +// Note: Delay inserted by this function is not accurate, but depedent on +// operating system, other running tasks etc. +// +// Examples +// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. +// +// See also +// RPI_DelayMicro +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_DigitalIn.sci b/macros/Hardware/RasberryPi/RPI_DigitalIn.sci new file mode 100644 index 00000000..781c49c8 --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_DigitalIn.sci @@ -0,0 +1,43 @@ +// 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 = RPI_DigitalIn(pin) +// Function to read current state on digital pins. +// +// Calling Sequence +// state = RPI_DigitalIn(pin) +// +// Parameters +// pin : pin of RPi to be used +// state : current state of the pin (0 -> LOW, 1 -> HIGH) +// +// Description +// This fucntion is used for reading the current state on gpio pins of RPi. 'RPI_DigitalSetup' function must be called before this for setting up pin as input. 'pin' must be specified from list given. 'state' specifies the input state (0 -> Low, 1-> High) +// Examples +// RPI_DigitalIn(RPI_GPIO_P1_03) //Reads the state of pin 3 of header P1. +// +// See also +// RPI_DigitalSetup RPI_DigitalOut +// +// +// Authors +// Siddhesh Wani +// +// ----------------------------------------------------------------- +//Pins of header P1 which can be used as GPIO +supported_pins = [3,5,7,8,10,11,12,13,15,16,18,19,21,22,23,24,26,27,28,29,... + 31,31,33,35,36,37,38,40]; + +PinIsGPIO = members(pin, supported_pins); //Check if input pin supports GPIO + +//If given pin does not support GPIO functionality, raise the error +if(PinIsGPIO == 0) + error(9999, 'SCI2CERROR: Given pin number doesnot support GPIO functionality.'); +end +state = 1; +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_DigitalOut.sci b/macros/Hardware/RasberryPi/RPI_DigitalOut.sci new file mode 100644 index 00000000..dde3c934 --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_DigitalOut.sci @@ -0,0 +1,44 @@ +// 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 RPI_DigitalOut(pin, state) +// Function to output desired state on digital pins. +// +// Calling Sequence +// RPI_DigitalOut(pin, state) +// +// Parameters +// pin : pin of RPi to be used +// state : desired state of the pin (0 -> LOW, 1 -> HIGH) +// +// Description +// This fucntion is used for outputting the desired state on gpio pins of RPi. 'RPI_DigitalSetup' function must be called before this for setting up pin as output. 'pin' must be specified from list given. 'state' specifies the output state (0 -> Low, 1-> High) +// Examples +// RPI_DigitalOut(RPI_GPIO_P1_03,0) //Changes the state of pin 3 of header P1 as 'Low'. +// +// See also +// RPI_DigitalSetup RPI_DigitalIn +// +// +// Authors +// Siddhesh Wani +// +// ----------------------------------------------------------------- +//Pins of header P1 which can be used as GPIO +supported_pins = [3,5,7,8,10,11,12,13,15,16,18,19,21,22,23,24,26,27,28,29,... + 31,31,33,35,36,37,38,40]; + +PinIsGPIO = members(pin, supported_pins); //Check if output pin supports GPIO + +//If given pin does not support GPIO functionality, raise the error +if(PinIsGPIO == 0) + error(9999, 'SCI2CERROR: Given pin number doesnot support GPIO functionality.'); +end +state = 1; + +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci b/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci new file mode 100644 index 00000000..01d6e07d --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci @@ -0,0 +1,36 @@ +function RPI_DigitalSetup(pin, direction) +// Function to setup digital pins. +// +// Calling Sequence +// RPI_DigitalSetup(pin,direction) +// +// Parameters +// pin : pin of RPi to be used +// direction : direction to be set for pin +// 0 -> INPUT, 1 -> OUTPUT, 2->PWM Output +// +// Description +// There are few pins available on RPi as Gpio or digital io. These pins can be used as digital output or input. Pin name must be provided from list provided. Please refer '' for complete list of pins. Direction can be 0 or 1 depending upon desired function (Input/output) +// Examples +// RPI_DigitalSetup(3,0) //Sets pin 3 of header P1 as input +// +// See also +// RPI_DigitalIn RPI_DigitalOut +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- +//Pins of header P1 which can be used as GPIO +supported_pins = [3,5,7,8,10,11,12,13,15,16,18,19,21,22,23,24,26,27,28,29,... + 31,31,33,35,36,37,38,40]; + +PinIsGPIO = members(pin, supported_pins); //Check if input pin supports GPIO + +//If given pin does not support GPIO functionality, raise the error +if(PinIsGPIO == 0) + error(9999, 'SCI2CERROR: Given pin number doesnot support GPIO functionality.'); +end +state = 1; + +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_GetMicros.sci b/macros/Hardware/RasberryPi/RPI_GetMicros.sci new file mode 100644 index 00000000..6c4db57a --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_GetMicros.sci @@ -0,0 +1,39 @@ +// 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 Micros = RPI_GetMicros() +// Function to get time in Microsecond since first setup function called. +// +// Calling Sequence +// Micros = RPI_GetMicros() +// +// Parameters +// Micros: time in Microseconds since first setup function called +// +// Description +// This function can be used to get time since first setup function called. +// Note: To use this function atleast one setup function must be called. +// +// Examples +// start = RPI_GetMicros() +// RPI_DelayMicro(1000) //This will delay the execution of next code by 100 ms. +// end = RPI_GetMicros() +// delay = end- start //This should be approximately 1000 us. +// +// See also +// RPI_GetMillis RPI_DelayMilli RPI_DelayMicro +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +Micros = 0; +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_GetMillis.sci b/macros/Hardware/RasberryPi/RPI_GetMillis.sci new file mode 100644 index 00000000..c034a705 --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_GetMillis.sci @@ -0,0 +1,39 @@ +// 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 Millis = RPI_GetMillis() +// Function to get time in millisecond since first setup function called. +// +// Calling Sequence +// Millis = RPI_GetMillis() +// +// Parameters +// Millis: time in milliseconds since first setup function called +// +// Description +// This function can be used to get time since first setup function called. +// Note: To use this function atleast one setup function must be called. +// +// Examples +// start = RPI_GetMillis() +// RPI_DelayMilli(100) //This will delay the execution of next code by 100 ms. +// end = RPI_GetMillis() +// delay = end- start //This should be approximately 100ms. +// +// See also +// RPI_GetMicros RPI_DelayMilli RPI_DelayMicro +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +Millis = 0; +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci b/macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci new file mode 100644 index 00000000..8448d364 --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_HardPWMSetClock.sci @@ -0,0 +1,35 @@ +// 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 RPI_HardPWMSetClock(clock_divisor) +// Function to set PWM clock. PWM clock frequency is 19.2MHz, which can be reduced +// using suitable clock_divisor (1 to 2048, powers of 2) +// +// Calling Sequence +// RPI_HardPWMSetClock(clock_divisor) +// +// Parameters +// clock_divisor: Value can be from 1 to 2048, powers of 2. +// Description +// This function decides pwm clock. +// PWM frequency = (PWM Clock frequency/Clock divisor/range) +// PWM clock frequency = 19.2 MHz +// clock divisor is setup using RPI_HardPWMSetClock +// range is setup using RPI_HardPWMSetRange +// Examples +// +// See also +// RPI_HardPWMSetWrite RPI_HardPWMSetRange +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci b/macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci new file mode 100644 index 00000000..57b82601 --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_HardPWMSetMode.sci @@ -0,0 +1,32 @@ +// 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 RPI_HardPWMSetMode(pwm_mode) +// Function to set PWM mode. Two modes are available - balanced and mark/space +// +// Calling Sequence +// RPI_HardPWMSetMode(pwm_mode) +// +// Parameters +// pwm_mode: decides pwm mode +// 0 -> balanced +// 1 -> mark/space +// Description +// This function decides pwm mode +// Examples +// +// See also +// RPI_HardPWMSetWrite RPI_HardPWMSetRange +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci b/macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci new file mode 100644 index 00000000..c2075e2d --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_HardPWMSetRange.sci @@ -0,0 +1,35 @@ +// 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 RPI_HardPWMSetRange(range_val) +// Function to set range value for PWM. Range value along with clock divisor +// decides pwm frequency. Range value must be less than 1024 +// +// Calling Sequence +// RPI_HardPWMSetRange(range_val) +// +// Parameters +// range_val: range for pwm +// Description +// This function decides range for pwm. +// PWM frequency = (PWM Clock frequency/Clock divisor/range) +// PWM clock frequency = 19.2 MHz +// clock divisor is setup using RPI_HardPWMSetClock +// range is setup using RPI_HardPWMSetRange +// Examples +// +// See also +// RPI_HardPWMSetClock RPI_HardPWMWrite +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci b/macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci new file mode 100644 index 00000000..dba5e674 --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_HardPWMWrite.sci @@ -0,0 +1,39 @@ +// 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 RPI_HardPWMWrite(pin,value) +// Function to change pwm duty on specified pin. Hardware PWM is available +// only on pin 12. So, only '12' should be provided as pin +// +// Calling Sequence +// RPI_HardPWMWrite(12,512) //Value must be smaller than the range set +// using RPI_HARDPWMSetRange +// +// Parameters +// pin: pin no on which pwm value is to be changed. Currently only 12 is allowed +// value: pwm value for given pin. This must be less than range value set +// Description +// This function changes pwm duty on specified pin. As for RPi, only one pin +// (pin 12) is available for hardware PWM. +// PWM frequency = (PWM Clock frequency/Clock divisor/range) +// PWM clock frequency = 19.2 MHz +// clock divisor is setup using RPI_HardPWMSetClock +// range is setup using RPI_HardPWMSetRange +// Actual PWM duty = value/range +// Examples +// +// See also +// RPI_HardPWMSetClock RPI_HardPWMSetRange +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_PinISR.sci b/macros/Hardware/RasberryPi/RPI_PinISR.sci new file mode 100644 index 00000000..c2354c1f --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_PinISR.sci @@ -0,0 +1,56 @@ +// 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 RPI_PinISR(pin, edgetype, fn) +// Function to assign a function to be run when an interrupt occurs on +// specified pin. +// +// Calling Sequence +// RPI_PinISR(pin, edgetype, fn) +// +// Parameters +// pin : pin whose interrupt is to be configured +// edgetype: edge on which interrupt is to be monitored +// 1 -> Falling egde +// 2 -> Rising egde +// 3 -> Both egde +// fn: name of the function to be executed on interrupt occurance +// Description +// This functions monitors interrupt on specified pin for specified edge, +// When that interrupt occurs, function specified by 'fn' is executed. +// Examples +// RPI_PinISR(12, 0, Pin12ISR) //executes 'Pin12ISR' on falling edge on +// pin 12 +// See also +// RPI_ThreadCreate RPI_DigitalSetup +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +//Pins of header P1 which can be used as GPIO +supported_pins = [3,5,7,8,10,11,12,13,15,16,18,19,21,22,23,24,26,27,28,29,... + 31,31,33,35,36,37,38,40]; + +PinIsGPIO = members(pin, supported_pins); //Check if input pin supports GPIO + +//If given pin does not support GPIO functionality, raise the error +if(PinIsGPIO == 0) + error(9999, 'SCI2CERROR: Given pin number doesnot support GPIO functionality.'); +end +EdgeTypeSupported = members(edgetype,[1 2 3]); + +if(EdgeTypeSupported == 0) + error(9999, 'SCI2CERROR: Given edgetype is incorrect. Please specify correct edgetype from [1,2,3]') +end + +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_SerialClose.sci b/macros/Hardware/RasberryPi/RPI_SerialClose.sci new file mode 100644 index 00000000..f27dd432 --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_SerialClose.sci @@ -0,0 +1,33 @@ +// 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 RPI_SerialClose(fd) +// Function to close serial port specified by file descriptor. +// +// Calling Sequence +// RPI_SerialClose(fd) +// +// Parameters +// fd : file descriptor for opened port +// Description +// This functions closes the specified serial port +// Examples +// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' +// RPI_SerialClose(serial1) +// See also +// RPI_SerialOpen RPI_SerialSendChar +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_SerialFlush.sci b/macros/Hardware/RasberryPi/RPI_SerialFlush.sci new file mode 100644 index 00000000..9bab386f --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_SerialFlush.sci @@ -0,0 +1,34 @@ +// 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 data = RPI_SerialGetChar(fd) +// Function to read data from specified serial port +// +// Calling Sequence +// RPI_SerialGetCharfd) +// +// Parameters +// fd: file descriptor returned when serial port was opened +// Description +// This functions reads character form specified port. In case no +// character is available, -1 is returned after 10 sec. +// Examples +// serial = RPI_SetupSerial("/dev/ttyAMA0", 9600); +// RPI_SerialFlush(serial); +// bytes = RPI_SerialDataAvail(serial); +// +// See also +// RPI_SetupSerial RPI_SendData +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci b/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci new file mode 100644 index 00000000..a26e5b97 --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci @@ -0,0 +1,36 @@ +// 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 data = RPI_SerialGetChar(fd) +// Function to read data from specified serial port +// +// Calling Sequence +// RPI_SerialGetChar(fd) +// +// Parameters +// fd: file descriptor returned when serial port was opened +// Description +// This functions reads character form specified port. In case no +// character is available, -1 is returned after 10 sec. +// Examples +// serial = RPI_SetupSerial("/dev/ttyAMA0", 9600); +// bytes = RPI_SerialDataAvail(serial); +// if(bytes>0) +// data = RPI_SerialGetChar(serial) //Reads single character +// end +// See also +// RPI_SetupSerial RPI_SendData +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +data = 0; +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci b/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci new file mode 100644 index 00000000..769b21d2 --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci @@ -0,0 +1,37 @@ +// 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 RPI_SerialSendChar(fd, data) +// Function to send 8-bit char through serial port. +// +// Calling Sequence +// RPI_SerialSendChar(fd, data) +// +// Parameters +// fd : file descriptor for opened port +// data: 8-bit character data to be sent +// Description +// This functions sends input 8-bit character data on specified serial port +// Examples +// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' +// RPI_SerialSendChar(serial1, 'H'); +// RPI_SerialSendChar(serial1, 'i'); +// RPI_SerialClose(serial1); +// +// See also +// RPI_SerialOpen RPI_SerialClose +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_SerialSendData.sci b/macros/Hardware/RasberryPi/RPI_SerialSendData.sci new file mode 100644 index 00000000..c05852b1 --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_SerialSendData.sci @@ -0,0 +1,38 @@ +// 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 RPI_SerialSendData(fd, data) +// Function to send data through serial port. Data can be of any datatype and +// can be scalar or matrix +// +// Calling Sequence +// RPI_SerialSendData(fd, data) +// +// Parameters +// fd : file descriptor for opened port +// data: data to be sent +// Description +// This functions sends input data on specified serial port +// Examples +// A = [2 3; 4 5] +// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' +// RPI_SerialSendData(serial1, A); +// RPI_SerialClose(serial1); +// +// See also +// RPI_SerialOpen RPI_SerialClose +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +endfunction diff --git a/macros/Hardware/RasberryPi/RPI_SerialSetup.sci b/macros/Hardware/RasberryPi/RPI_SerialSetup.sci new file mode 100644 index 00000000..0f266610 --- /dev/null +++ b/macros/Hardware/RasberryPi/RPI_SerialSetup.sci @@ -0,0 +1,36 @@ +// 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 fd = RPI_SerialSetup(port, baudrate) +// Function to setup serial port. +// +// Calling Sequence +// RPI_SerialSetup(port, baudrate) +// +// Parameters +// port : port of RPi to be used (eg. ) +// direction : direction to be set for pin (0 -> INPUT, 1 -> OUTPUT) +// fd : file descriptor for opened port, -1 for error +// Description +// This functions opens the specified serial port and returns file descriptor +// for the same +// Examples +// serial1 = RPI_SerialSetup('/dev/ttyAMA0',9600) //opens port 'USBtty0' +// +// See also +// RPI_SerialClose RPI_SerialSendChar +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +fd = 0; +endfunction diff --git a/macros/Hardware/RasberryPi/buildmacros.sce b/macros/Hardware/RasberryPi/buildmacros.sce new file mode 100644 index 00000000..2954a424 --- /dev/null +++ b/macros/Hardware/RasberryPi/buildmacros.sce @@ -0,0 +1,4 @@ + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/Hardware/RasberryPi/lib b/macros/Hardware/RasberryPi/lib new file mode 100644 index 00000000..c238317e Binary files /dev/null and b/macros/Hardware/RasberryPi/lib differ diff --git a/macros/Hardware/RasberryPi/names b/macros/Hardware/RasberryPi/names new file mode 100644 index 00000000..fa647761 --- /dev/null +++ b/macros/Hardware/RasberryPi/names @@ -0,0 +1,21 @@ +GetRPISupportFunctions +IsRPISupportFunction +RPI_DelayMicro +RPI_DelayMilli +RPI_DigitalIn +RPI_DigitalOut +RPI_DigitalSetup +RPI_GetMicros +RPI_GetMillis +RPI_HardPWMSetClock +RPI_HardPWMSetMode +RPI_HardPWMSetRange +RPI_HardPWMWrite +RPI_PinISR +RPI_SerialClose +RPI_SerialFlush +RPI_SerialGetChar +RPI_SerialSendChar +RPI_SerialSendData +RPI_SerialSetup +u16RPISerialDataAvail diff --git a/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci b/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci new file mode 100644 index 00000000..6eb29a1c --- /dev/null +++ b/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci @@ -0,0 +1,37 @@ +// 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 bytes = RPI_SerialDataAvail(fd) +// Function to get number of data bytes available on serial port specified by +// file descriptor +// Calling Sequence +// RPI_SerialDataAvail(fd) +// +// Parameters +// fd : file descriptor for already opened serial port +// Description +// This functions returns number of characters available to read, +// otherwise reads -1 in case of error. This function can be used to check +// new data is available on serial port +// Examples +// serial = RPI_SerialOpen("/dev/ttyAMA0", 9600); +// charsToRead = RPI_SerialDataAvail(serial); +// See also +// RPI_SerialOpen RPI_SerialGetChar +// +// +// Authors +// Siddhesh Wani +// ----------------------------------------------------------------- + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. + +bytes = 0; + +endfunction \ No newline at end of file -- cgit From bd03b38be0918837e147e969c6bb2014900009db Mon Sep 17 00:00:00 2001 From: Brijeshcr Date: Sat, 8 Jul 2017 20:18:17 +0530 Subject: Revert "SCi2cDeps updated, Windows compatibility resolved" --- macros/Hardware/AVR/AVRADCSetup.sci | 20 --------------- macros/Hardware/AVR/AVRDigitalIn.sci | 20 --------------- macros/Hardware/AVR/AVRDigitalOut.sci | 15 ------------ macros/Hardware/AVR/AVRDigitalPortSetup.sci | 16 ------------ macros/Hardware/AVR/AVRDigitalSetup.sci | 17 ------------- macros/Hardware/AVR/AVRGetTimerValue.sci | 14 ----------- macros/Hardware/AVR/AVRPWM0SetDuty.sci | 17 ------------- macros/Hardware/AVR/AVRPWM0Setup.sci | 35 -------------------------- macros/Hardware/AVR/AVRPWM1SetDuty.sci | 25 ------------------- macros/Hardware/AVR/AVRPWM1Setup.sci | 38 ----------------------------- macros/Hardware/AVR/AVRPWM2SetDuty.sci | 14 ----------- macros/Hardware/AVR/AVRPWM2Setup.sci | 32 ------------------------ macros/Hardware/AVR/AVRReadADC.sci | 19 --------------- macros/Hardware/AVR/AVRSleep.sci | 4 --- macros/Hardware/AVR/AVRTimerSetup.sci | 29 ---------------------- macros/Hardware/AVR/AVRUARTReceive.sci | 14 ----------- macros/Hardware/AVR/AVRUARTSetup.sci | 31 ----------------------- macros/Hardware/AVR/AVRUARTTransmit.sci | 19 --------------- 18 files changed, 379 deletions(-) (limited to 'macros/Hardware') diff --git a/macros/Hardware/AVR/AVRADCSetup.sci b/macros/Hardware/AVR/AVRADCSetup.sci index 5299058c..603873b3 100644 --- a/macros/Hardware/AVR/AVRADCSetup.sci +++ b/macros/Hardware/AVR/AVRADCSetup.sci @@ -17,7 +17,6 @@ function AVRADCSetup(prescaler,adc_ref) // Parameters // prescaler: prescaler to be used for generating ADC clock (0-7) // adc_ref : reference voltage to be used for ADC conversion -<<<<<<< HEAD // // Description // 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^prescaler). Select appropriate prescaler depending on MCU clock. 'adc_ref' selects one of the available reference voltage sources available. @@ -31,34 +30,15 @@ function AVRADCSetup(prescaler,adc_ref) // // This is curretly dummy function. It provides no functionality but is required for providing support for generating C code for AVR. // -======= -// 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. 'prescaler' is -// needed for deciding ADC clock. ADC clock should be between 50KHz and 200KHz -// 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 ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // Examples // AVRADCSetup(128,0) // See also // AVRReadADC // // Authors -<<<<<<< HEAD // Siddhesh Wani // Ashish Kamble // -======= -// 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. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(prescaler>=8) disp("Error : Invalid input argument ''prescaler'' in AVRADCSetup function."); diff --git a/macros/Hardware/AVR/AVRDigitalIn.sci b/macros/Hardware/AVR/AVRDigitalIn.sci index 421a4f63..7addd663 100644 --- a/macros/Hardware/AVR/AVRDigitalIn.sci +++ b/macros/Hardware/AVR/AVRDigitalIn.sci @@ -18,11 +18,6 @@ function state = AVRDigitalIn(port,pin) // Parameters // port : port of microcontroller to be used // pin : pin of port (mentioned above) to be used -<<<<<<< HEAD -======= -// Returns -// state : state of an input pin (HIGH\LOW) ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // // Description // Each AVR microcontroller has pins which can be configured as digital @@ -30,7 +25,6 @@ function state = AVRDigitalIn(port,pin) // User has to select one of these port and which pin of that port as // digital input. // -<<<<<<< HEAD // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. // @@ -43,20 +37,6 @@ function state = AVRDigitalIn(port,pin) // Siddhesh Wani // Ashish Kamble // -======= -// Examples -// pinA0 = AVRDigitalIn(1,0) //To read state on pin 0 of port A -// -// See also -// AVRDigitalOut AVRDigitalSetup -// -// -// 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. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if((port==0)|(port>=5)) then disp("Error : Inavalid input argument ''port'' in AVRDigitalIn function."); diff --git a/macros/Hardware/AVR/AVRDigitalOut.sci b/macros/Hardware/AVR/AVRDigitalOut.sci index a80aff0f..0efc927b 100644 --- a/macros/Hardware/AVR/AVRDigitalOut.sci +++ b/macros/Hardware/AVR/AVRDigitalOut.sci @@ -26,7 +26,6 @@ function AVRDigitalOut(port,pin,state) // digital output. Also, desired output state must be specified as // 'HIGH' or 'LOW'. // -<<<<<<< HEAD // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. // @@ -39,20 +38,6 @@ function AVRDigitalOut(port,pin,state) // Siddhesh Wani // Ashish Kamble // -======= -// Examples -// AVRDigitalOut('A',0,HIGH) -// -// See also -// AVRDigitalIn -// -// -// 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. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if((port==0)|(port>=8)) then disp("Error : Inavalid input argument ''port'' in AVRDigitalOut function."); diff --git a/macros/Hardware/AVR/AVRDigitalPortSetup.sci b/macros/Hardware/AVR/AVRDigitalPortSetup.sci index 26bec8db..65e8494a 100644 --- a/macros/Hardware/AVR/AVRDigitalPortSetup.sci +++ b/macros/Hardware/AVR/AVRDigitalPortSetup.sci @@ -15,11 +15,7 @@ function AVRDigitalPortSetup(port,direction) // AVRDigitalPortSetup(port,direction) // // Parameters -<<<<<<< HEAD // port : port of microcontroller to be used(1 for PORTA, 2 for PORTB,...) -======= -// port : port of microcontroller to be used(1 for PORTA, 2 for PORTB,...) ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // direction : direction to be set for pin (0 for INPUT, 1 for OUTPUT) // // Description @@ -29,31 +25,19 @@ function AVRDigitalPortSetup(port,direction) // used as digital output/input. Also, desired direction must be specified as // 'INPUT' or 'OUTPUT'. // -<<<<<<< HEAD // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. // -======= ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // Examples // AVRDigitalPortSetup(1,0); //This function will make PortA as input port // // See also // AVRDigitalIn AVRDigitalOut // -<<<<<<< HEAD // Authors // Siddhesh Wani // Ashish Kamble // -======= -// -// 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. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if((port==0)|(port>=5)) then disp("Error : Invalid input argument ''port'' in AVRDigitalPortSetup function."); diff --git a/macros/Hardware/AVR/AVRDigitalSetup.sci b/macros/Hardware/AVR/AVRDigitalSetup.sci index 8e4efc7e..ed6cf306 100644 --- a/macros/Hardware/AVR/AVRDigitalSetup.sci +++ b/macros/Hardware/AVR/AVRDigitalSetup.sci @@ -15,13 +15,8 @@ function AVRDigitalSetup(port,pin,direction) // AVRDigitalSetup(port,pin,direction) // // Parameters -<<<<<<< HEAD // port : port of microcontroller to be used // pin : pin of port (mentioned above) to be used -======= -// port : port of microcontroller to be used -// pin : pin of port (mentioned above) to be used ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // direction : direction to be set for pin (INPUT\OUTPUT) // // Description @@ -31,31 +26,19 @@ function AVRDigitalSetup(port,pin,direction) // used as digital output/input. Also, desired direction must be specified as // 'INPUT' or 'OUTPUT'. // -<<<<<<< HEAD // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. // -======= ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // Examples // AVRDigitalSetup('A',0,OUTPUT) // // See also // AVRDigitalIn AVRDigitalOut // -<<<<<<< HEAD // Authors // Siddhesh Wani // Ashish Kamble // -======= -// -// 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. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if((port==0)|(port>=5)) then disp("Error : Invalid input argument ''port'' in AVRDigitalSetup function."); diff --git a/macros/Hardware/AVR/AVRGetTimerValue.sci b/macros/Hardware/AVR/AVRGetTimerValue.sci index 0b501448..05919b38 100644 --- a/macros/Hardware/AVR/AVRGetTimerValue.sci +++ b/macros/Hardware/AVR/AVRGetTimerValue.sci @@ -18,7 +18,6 @@ function count = AVRGetTimerValue(timer) // 2 for timer2 // // Description -<<<<<<< HEAD // This function returns the count value of a desired timer.By knowing the count value certain interrupt action can be taken. // // Timer can take the following values @@ -33,25 +32,12 @@ function count = AVRGetTimerValue(timer) // // Examples // AVRGetTimerValue(0); //returns present count of the TCNT0 counter -======= -// This function returns the count value of a desired timer.By knowing the count value -// certain interrupt action can be taken. -// -// Examples -// AVRGetTimerValue(0); //returns present count of the TCNT0 counter -// ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // See also // AVRTimerSetup // // Authors // Ashish Kamble // -<<<<<<< HEAD -======= -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for AVR. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(timer>=3) then disp("Error : Invalid input argument ''timer'' in AVRGetTimerValue function."); diff --git a/macros/Hardware/AVR/AVRPWM0SetDuty.sci b/macros/Hardware/AVR/AVRPWM0SetDuty.sci index f1faebef..c3815d10 100644 --- a/macros/Hardware/AVR/AVRPWM0SetDuty.sci +++ b/macros/Hardware/AVR/AVRPWM0SetDuty.sci @@ -9,7 +9,6 @@ // Email: toolbox@scilab.in function AVRPWM0SetDuty(duty) -<<<<<<< HEAD //Function to Set Duty cycle of PWM Output generated by Timer0 at OC0 pin. // //Parameters @@ -22,17 +21,6 @@ function AVRPWM0SetDuty(duty) // This is curretly dummy function. It provides no functionality but is required for providing support for generating C code for AVR. // //Examples -======= -//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 ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // AVRPWM0SetDuty(50); //Produces 2.5V at OC0 pin // AVRPWM0SetDuty(0); //Produces 0V at OC0 pin //See also @@ -41,11 +29,6 @@ function AVRPWM0SetDuty(duty) //Authors // Ashish Kamble // -<<<<<<< HEAD -======= -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for AVR. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(duty>100) then disp("Error : Invalid input argument ''duty'' in AVRPWM0SetDuty function."); diff --git a/macros/Hardware/AVR/AVRPWM0Setup.sci b/macros/Hardware/AVR/AVRPWM0Setup.sci index 19d91a2a..c391f71e 100644 --- a/macros/Hardware/AVR/AVRPWM0Setup.sci +++ b/macros/Hardware/AVR/AVRPWM0Setup.sci @@ -10,20 +10,16 @@ function AVRPWM0Setup(waveform_mode,output_mode) //Function to Setup OC0 pin for required PWM mode -<<<<<<< HEAD // //Parameters // waveform_mode: integer, from 0 to 2 // output_mode: integer, from 0 to 1 (or 2) depending on the waveform_mode // -======= ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //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. // -<<<<<<< HEAD // waveform_mode can take values- // // 0 -> for Phase correct PWM Mode @@ -50,43 +46,12 @@ function AVRPWM0Setup(waveform_mode,output_mode) // //Examples // AVRPWM0Setup(2,0); //This function will select CTC waveform mode and will clear OC0 on compare match -======= -//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 ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //See also // AVRPWM0SetDuty // //Authors // Ashish Kamble // -<<<<<<< HEAD -======= -//This is curretly dummy function. It provides no functionality but is required -//for providing support for generating C code for AVR. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(waveform_mode>=3) then disp("Error : Invalid input argument ''waveform_mode'' in AVRPWM0Setup function."); diff --git a/macros/Hardware/AVR/AVRPWM1SetDuty.sci b/macros/Hardware/AVR/AVRPWM1SetDuty.sci index 6b3e21f0..fd6e7baf 100644 --- a/macros/Hardware/AVR/AVRPWM1SetDuty.sci +++ b/macros/Hardware/AVR/AVRPWM1SetDuty.sci @@ -11,53 +11,28 @@ function AVRPWM1SetDuty(output_pin,duty,Top_Value) //Function to Set Duty cycle of PWM Output generated by Timer1 at OC1A or OC1B pin. //Parameters -<<<<<<< HEAD // ouput_pin: integer, 0 (for OC1A) or 1 (for OC1B) // // 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) -======= -// 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) ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // //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. // -<<<<<<< HEAD // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. // //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. -======= -//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. -// ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //See also // AVRPWM1Setup // //Authors // Ashish Kamble // -<<<<<<< HEAD -======= -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for AVR. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(output_pin>=2) then disp("Error : Invalid input argument ''output_pin'' in AVRPWM1SetDuty function."); diff --git a/macros/Hardware/AVR/AVRPWM1Setup.sci b/macros/Hardware/AVR/AVRPWM1Setup.sci index feb40bd6..fbd96ce3 100644 --- a/macros/Hardware/AVR/AVRPWM1Setup.sci +++ b/macros/Hardware/AVR/AVRPWM1Setup.sci @@ -10,21 +10,17 @@ function AVRPWM1Setup(waveform_mode,output_mode,output_pin) //Function to Setup OC1A or OC1B pin for required PWM mode -<<<<<<< HEAD // //Parameters // waveform_mode: integer, from 0 to 2 // output_mode: integer, from 0 to 1 (or 2) depending on the waveform_mode // output_pin: 0 (for OC1A) or 1 for (OC1B) // -======= ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //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. // -<<<<<<< HEAD // waveform_mode can take values- // // 0 -> for Phase correct PWM Mode @@ -48,35 +44,6 @@ function AVRPWM1Setup(waveform_mode,output_mode,output_pin) // // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. -======= -//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 ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // //Example // AVRPWM1Setup(2,0,0); //This function will select CTC mode and will clear OC1A or OC1B @@ -88,11 +55,6 @@ function AVRPWM1Setup(waveform_mode,output_mode,output_pin) //Authors // Ashish Kamble // -<<<<<<< HEAD -======= -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for AVR. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(waveform_mode>=3) then disp("Error : Invalid input argument ''waveform_mode'' in AVRPWM1Setup function."); diff --git a/macros/Hardware/AVR/AVRPWM2SetDuty.sci b/macros/Hardware/AVR/AVRPWM2SetDuty.sci index 75ae8599..81d1761e 100644 --- a/macros/Hardware/AVR/AVRPWM2SetDuty.sci +++ b/macros/Hardware/AVR/AVRPWM2SetDuty.sci @@ -10,26 +10,17 @@ function AVRPWM2SetDuty(duty) //Function to Set Duty cycle of PWM Output generated by Timer2 at OC2 pin. -<<<<<<< HEAD // //Parameters // duty : It holds an integer value from 0 to 100 which sets the percentage of time for which signal is active. // -======= ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //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. // -<<<<<<< HEAD // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. -======= -//Parameters -// duty : It holds an integer value from 0 to 100 which sets the percentage -// of time for which signal is active. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // //Example // AVRPWM2SetDuty(50); //Produces 2.5V at OC2 pin @@ -41,11 +32,6 @@ function AVRPWM2SetDuty(duty) //Authors // Ashish Kamble // -<<<<<<< HEAD -======= -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for AVR. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(duty>100) then disp("Error : Invalid input argument ''duty'' in AVRPWM2SetDuty function."); diff --git a/macros/Hardware/AVR/AVRPWM2Setup.sci b/macros/Hardware/AVR/AVRPWM2Setup.sci index c76f3f35..11d9b019 100644 --- a/macros/Hardware/AVR/AVRPWM2Setup.sci +++ b/macros/Hardware/AVR/AVRPWM2Setup.sci @@ -10,20 +10,16 @@ function AVRPWM2Setup(waveform_mode,output_mode) //Function to Setup OC2 pin for required PWM mode -<<<<<<< HEAD // //Parameters // waveform_mode: integer, from 0 to 2 // output_mode: integer, from 0 to 1 (or 2) depending on the waveform_mode // -======= ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //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. // -<<<<<<< HEAD // waveform_mode can take values- // // 0 -> for Phase correct PWM Mode @@ -48,29 +44,6 @@ function AVRPWM2Setup(waveform_mode,output_mode) // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. // -======= -//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 -// ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //Example // AVRPWM2Setup(2,0); //This function will select CTC waveform mode and will clear OC2 on // compare match @@ -80,11 +53,6 @@ function AVRPWM2Setup(waveform_mode,output_mode) //Authors // Ashish Kamble // -<<<<<<< HEAD -======= -//This is curretly dummy function. It provides no functionality but is required -//for providing support for generating C code for AVR. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(waveform_mode>=3) then disp("Error : Invalid input argument ''waveform_mode'' in AVRPWM2Setup function."); diff --git a/macros/Hardware/AVR/AVRReadADC.sci b/macros/Hardware/AVR/AVRReadADC.sci index aa94c58d..71cafa7e 100644 --- a/macros/Hardware/AVR/AVRReadADC.sci +++ b/macros/Hardware/AVR/AVRReadADC.sci @@ -15,15 +15,7 @@ function adc_result = AVRReadADC(channel) // u8AVRReadADCs(channel) // // Parameters -<<<<<<< HEAD // channel : Select which channel is to be read. Values from 0-7 select one of the pins ADC0-ADC7. For other possible channel values refer datasheet -======= -// channel : Select which channel is to be read. Values from 0-7 select one -// of the pins ADC0-ADC7. For other possible channel values refer -// datasheet -// Returns-> -// result : Digital value for the voltage present on channel selected ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // // Description // This function returns digital value for present on adc pins. 'channel' @@ -32,7 +24,6 @@ function adc_result = AVRReadADC(channel) // voltages between some pins. For channel values for those options, please // refer datasheet. // -<<<<<<< HEAD // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. // @@ -42,16 +33,6 @@ function adc_result = AVRReadADC(channel) // Siddhesh Wani // Ashish Kamble // -======= -// Examples -// adc_result = u8AVRReadADC(0) //Read ADC0 -// -// 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. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(channel>=8) then disp("Error : Inavlid input argument ''channel'' in AVRReadADC function."); diff --git a/macros/Hardware/AVR/AVRSleep.sci b/macros/Hardware/AVR/AVRSleep.sci index 005fe4ed..eec6e5a2 100644 --- a/macros/Hardware/AVR/AVRSleep.sci +++ b/macros/Hardware/AVR/AVRSleep.sci @@ -1,5 +1,4 @@ function AVRSleep(delay) -<<<<<<< HEAD // Function to pause the execution for the given time. // // Parameter @@ -18,8 +17,5 @@ function AVRSleep(delay) // Authors // Jorawar Singh // -======= - ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 endfunction diff --git a/macros/Hardware/AVR/AVRTimerSetup.sci b/macros/Hardware/AVR/AVRTimerSetup.sci index c4c4535e..55fd55fa 100644 --- a/macros/Hardware/AVR/AVRTimerSetup.sci +++ b/macros/Hardware/AVR/AVRTimerSetup.sci @@ -10,21 +10,17 @@ function AVRTimerSetup(timer,prescaler,clock_source) //Function to setup Timers in ATmega16 -<<<<<<< HEAD // //Parameters: // timer : integer, from 0 to 2 // prescaler : integer. // clock_source : integer, 0 (for internal) or 1 (for external) // -======= ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //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. // -<<<<<<< HEAD // timer can take values- // // 0 -> for timer0 @@ -46,37 +42,12 @@ function AVRTimerSetup(timer,prescaler,clock_source) // //Example // AVRTimerSetup(0,64,0); //This function will select timer0 with timer running as per internal clock source and prescaled by 64. -======= -//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. -// ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //See also // AVRGetTimerValues // //Authors // Ashish Kamble // -<<<<<<< HEAD -======= -//This is curretly dummy function. It provides no functionality but is required -//for providing support for generating C code for AVR. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(timer>=3) then disp("Error : Invalid input argument ''timer'' in AVRTimerSetup function."); diff --git a/macros/Hardware/AVR/AVRUARTReceive.sci b/macros/Hardware/AVR/AVRUARTReceive.sci index f7502e23..7fdf6f05 100644 --- a/macros/Hardware/AVR/AVRUARTReceive.sci +++ b/macros/Hardware/AVR/AVRUARTReceive.sci @@ -10,25 +10,16 @@ function received = AVRUARTReceive() // Function to Receive Char value send to ATmega16 using UART or USART. -<<<<<<< HEAD // -======= ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // Description // This function Receives Char as 8 bit value.This value is stored in UDR at receiving // end. // -<<<<<<< HEAD // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. // //Examples // state = AVRUARTReceive(); //This function will Receive char and return the entire value -======= -//Examples -// state = AVRUARTReceive(); //This function will Receive char and return the entire value -// ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //See also // AVRUARTSetup // AVRUARTTransmit @@ -36,10 +27,5 @@ function received = AVRUARTReceive() // Authors // Ashish Kamble // -<<<<<<< HEAD -======= -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for AVR. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 received = 0; // received has been initialised to avoid runtime error. endfunction diff --git a/macros/Hardware/AVR/AVRUARTSetup.sci b/macros/Hardware/AVR/AVRUARTSetup.sci index 896674b3..6ecf2a07 100644 --- a/macros/Hardware/AVR/AVRUARTSetup.sci +++ b/macros/Hardware/AVR/AVRUARTSetup.sci @@ -10,7 +10,6 @@ function AVRUARTSetup(mode, baudrate, stopbits, parity) // Function to Setup Serial Communication i.e UART or USART in ATmega16. -<<<<<<< HEAD // // Parameters // mode : integer, from 0 to 2 @@ -39,31 +38,6 @@ function AVRUARTSetup(mode, baudrate, stopbits, parity) // This is curretly dummy function. It provides no functionality but is required // for providing support for generating C code for AVR. // -======= -// Description -// 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 . -// -// stopbits : -// 0 for one stopbit -// 1 for two stopbits -// -// parity : -// 0 for parity disabled -// 1 for even parity -// 2 for odd parity -// ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //Examples // AVRUARTSetup(0,9600,0,0); //This function will enable UART Communication for ATmega16 // with 9600 as baudrate,one stop bit and parity disabled @@ -74,12 +48,7 @@ function AVRUARTSetup(mode, baudrate, stopbits, parity) // Authors // Ashish Kamble // -<<<<<<< HEAD -======= -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for AVR. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(mode>=3) then disp("Error : Invalid input argument ''mode'' in AVRUARTSetup function."); end diff --git a/macros/Hardware/AVR/AVRUARTTransmit.sci b/macros/Hardware/AVR/AVRUARTTransmit.sci index 150b9fe9..695c708d 100644 --- a/macros/Hardware/AVR/AVRUARTTransmit.sci +++ b/macros/Hardware/AVR/AVRUARTTransmit.sci @@ -10,7 +10,6 @@ function AVRUARTTransmit(data) // Function to Transmit data using UART or USART. -<<<<<<< HEAD // // Parameter // data : The data to be transmitted can be a Char,String,Unsigned Int,Signed Int. @@ -24,19 +23,6 @@ function AVRUARTTransmit(data) // //Examples // AVRUARTTransmit("This is example"); //This function will transmit the entered string. -======= -// 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. -// ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //See also // AVRUARTSetup // AVRUARTReceive @@ -44,9 +30,4 @@ function AVRUARTTransmit(data) // Authors // Ashish Kamble // -<<<<<<< HEAD -======= -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for AVR. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 endfunction -- cgit