summaryrefslogtreecommitdiff
path: root/macros/Hardware
diff options
context:
space:
mode:
Diffstat (limited to 'macros/Hardware')
-rw-r--r--macros/Hardware/AVR/AVRADCSetup.sci32
-rw-r--r--macros/Hardware/AVR/AVRDigitalOut.binbin0 -> 3760 bytes
-rw-r--r--macros/Hardware/AVR/AVRDigitalOut.sci32
-rw-r--r--macros/Hardware/AVR/AVRDigitalSetup.binbin0 -> 3932 bytes
-rw-r--r--macros/Hardware/AVR/AVRDigitalSetup.sci32
-rw-r--r--macros/Hardware/AVR/AVRReadADC.sci31
-rw-r--r--macros/Hardware/AVR/GetAVRSupportFunctions.binbin0 -> 1256 bytes
-rw-r--r--macros/Hardware/AVR/GetAVRSupportFunctions.sci16
-rw-r--r--macros/Hardware/AVR/GetPeripheral.binbin0 -> 2364 bytes
-rw-r--r--macros/Hardware/AVR/GetPeripheral.sci21
-rw-r--r--macros/Hardware/AVR/InsertPeripheralInList.binbin0 -> 1928 bytes
-rw-r--r--macros/Hardware/AVR/InsertPeripheralInList.sci17
-rw-r--r--macros/Hardware/AVR/IsAVRSupportFunction.binbin0 -> 2712 bytes
-rw-r--r--macros/Hardware/AVR/IsAVRSupportFunction.sci22
-rw-r--r--macros/Hardware/AVR/buildmacros.sce15
-rw-r--r--macros/Hardware/AVR/libbin0 -> 728 bytes
-rw-r--r--macros/Hardware/AVR/names6
-rw-r--r--macros/Hardware/buildmacros.sce19
18 files changed, 243 insertions, 0 deletions
diff --git a/macros/Hardware/AVR/AVRADCSetup.sci b/macros/Hardware/AVR/AVRADCSetup.sci
new file mode 100644
index 0000000..d9897fc
--- /dev/null
+++ b/macros/Hardware/AVR/AVRADCSetup.sci
@@ -0,0 +1,32 @@
+function AVRADCSetup(prescalar,adc_ref)
+// Function to initialise ADC of AVR
+//
+// Calling Sequence
+// AVRSetupADC(uint8 prescalar, uint8 adc_ref)
+//
+// Parameters
+// prescalar: prescalar to be used for generating ADC clock (0-7)
+// adc_ref : reference voltage to be used for ADC conversion
+// 0 -> Voltage on VREF pin
+// 1 -> Voltage on AVCC pin
+// 2 -> Internal 2.56 reference voltage
+//
+// Description
+// This function initialises ADc of AVR with given parameters. 'prescalar' is
+// needed for deciding ADC clock. ADC clock should be between 50KHz and 200KHz
+// and it given as (MCU clock/2^prescalar). Select appropriate prescalar depending
+// on MCU clock. 'adc_ref' selects one of the available reference voltage sources
+// available
+// Examples
+// AVRADCSetup(128,0)
+
+// See also
+// AVRReadADC
+//
+// Authors
+// Siddhesh Wani
+//
+
+// This is curretly dummy function. It provides no functionality but is required
+// for providing support for generating C code for AVR.
+endfunction
diff --git a/macros/Hardware/AVR/AVRDigitalOut.bin b/macros/Hardware/AVR/AVRDigitalOut.bin
new file mode 100644
index 0000000..7a09b0d
--- /dev/null
+++ b/macros/Hardware/AVR/AVRDigitalOut.bin
Binary files differ
diff --git a/macros/Hardware/AVR/AVRDigitalOut.sci b/macros/Hardware/AVR/AVRDigitalOut.sci
new file mode 100644
index 0000000..f17c8a0
--- /dev/null
+++ b/macros/Hardware/AVR/AVRDigitalOut.sci
@@ -0,0 +1,32 @@
+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
+//
+
+// 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/AVRDigitalSetup.bin b/macros/Hardware/AVR/AVRDigitalSetup.bin
new file mode 100644
index 0000000..98a592e
--- /dev/null
+++ b/macros/Hardware/AVR/AVRDigitalSetup.bin
Binary files differ
diff --git a/macros/Hardware/AVR/AVRDigitalSetup.sci b/macros/Hardware/AVR/AVRDigitalSetup.sci
new file mode 100644
index 0000000..3de56c2
--- /dev/null
+++ b/macros/Hardware/AVR/AVRDigitalSetup.sci
@@ -0,0 +1,32 @@
+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
+//
+
+// This is curretly dummy function. It provides no functionality but is required
+// for providing support for generating C code for AVR.
+endfunction
diff --git a/macros/Hardware/AVR/AVRReadADC.sci b/macros/Hardware/AVR/AVRReadADC.sci
new file mode 100644
index 0000000..f9dfdac
--- /dev/null
+++ b/macros/Hardware/AVR/AVRReadADC.sci
@@ -0,0 +1,31 @@
+function 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
+//
+
+
+// This is curretly dummy function. It provides no functionality but is required
+// for providing support for generating C code for AVR.
+endfunction
diff --git a/macros/Hardware/AVR/GetAVRSupportFunctions.bin b/macros/Hardware/AVR/GetAVRSupportFunctions.bin
new file mode 100644
index 0000000..eed8be3
--- /dev/null
+++ b/macros/Hardware/AVR/GetAVRSupportFunctions.bin
Binary files differ
diff --git a/macros/Hardware/AVR/GetAVRSupportFunctions.sci b/macros/Hardware/AVR/GetAVRSupportFunctions.sci
new file mode 100644
index 0000000..50a913f
--- /dev/null
+++ b/macros/Hardware/AVR/GetAVRSupportFunctions.sci
@@ -0,0 +1,16 @@
+function AVRSupportFunctions = GetAVRSupportFunctions()
+// -----------------------------------------------------------------
+// Get list of AVR peripherals supported
+//
+// Input data:
+// None
+//
+// Output data:
+// None
+//
+// Author: Siddhesh Wani
+// -----------------------------------------------------------------
+
+AVRSupportFunctions = ["AVRDigitalOut"];
+
+endfunction
diff --git a/macros/Hardware/AVR/GetPeripheral.bin b/macros/Hardware/AVR/GetPeripheral.bin
new file mode 100644
index 0000000..b496bbb
--- /dev/null
+++ b/macros/Hardware/AVR/GetPeripheral.bin
Binary files differ
diff --git a/macros/Hardware/AVR/GetPeripheral.sci b/macros/Hardware/AVR/GetPeripheral.sci
new file mode 100644
index 0000000..73e9f19
--- /dev/null
+++ b/macros/Hardware/AVR/GetPeripheral.sci
@@ -0,0 +1,21 @@
+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.bin b/macros/Hardware/AVR/InsertPeripheralInList.bin
new file mode 100644
index 0000000..c49f4e0
--- /dev/null
+++ b/macros/Hardware/AVR/InsertPeripheralInList.bin
Binary files differ
diff --git a/macros/Hardware/AVR/InsertPeripheralInList.sci b/macros/Hardware/AVR/InsertPeripheralInList.sci
new file mode 100644
index 0000000..bafc593
--- /dev/null
+++ b/macros/Hardware/AVR/InsertPeripheralInList.sci
@@ -0,0 +1,17 @@
+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.bin b/macros/Hardware/AVR/IsAVRSupportFunction.bin
new file mode 100644
index 0000000..e238230
--- /dev/null
+++ b/macros/Hardware/AVR/IsAVRSupportFunction.bin
Binary files differ
diff --git a/macros/Hardware/AVR/IsAVRSupportFunction.sci b/macros/Hardware/AVR/IsAVRSupportFunction.sci
new file mode 100644
index 0000000..a4cbbc8
--- /dev/null
+++ b/macros/Hardware/AVR/IsAVRSupportFunction.sci
@@ -0,0 +1,22 @@
+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 0000000..60fd284
--- /dev/null
+++ b/macros/Hardware/AVR/buildmacros.sce
@@ -0,0 +1,15 @@
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET
+//
+// 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
+//
+//
+
+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 0000000..097a89f
--- /dev/null
+++ b/macros/Hardware/AVR/lib
Binary files differ
diff --git a/macros/Hardware/AVR/names b/macros/Hardware/AVR/names
new file mode 100644
index 0000000..4b941e9
--- /dev/null
+++ b/macros/Hardware/AVR/names
@@ -0,0 +1,6 @@
+AVRDigitalOut
+AVRDigitalSetup
+GetAVRSupportFunctions
+GetPeripheral
+InsertPeripheralInList
+IsAVRSupportFunction
diff --git a/macros/Hardware/buildmacros.sce b/macros/Hardware/buildmacros.sce
new file mode 100644
index 0000000..88f0fb2
--- /dev/null
+++ b/macros/Hardware/buildmacros.sce
@@ -0,0 +1,19 @@
+// This file is released into the public domain
+
+Directories = [ "AVR" ];
+
+
+current_path_buildmacros = get_absolute_file_path("buildmacros.sce");
+
+for K=1:size(Directories,"*")
+ myfile = current_path_buildmacros + filesep() + Directories(K) + filesep() + "buildmacros.sce";
+ if isfile(myfile) then
+ exec(myfile);
+ end
+end
+
+clear current_path_buildmacros;
+
+tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce'));
+
+clear tbx_build_macros;