diff options
author | siddhu8990 | 2015-11-28 11:01:40 +0530 |
---|---|---|
committer | siddhu8990 | 2015-11-28 11:01:40 +0530 |
commit | 128638e88ce6d8414c9e1061faa96008be9bcda5 (patch) | |
tree | c38d4dbbed3ee4f3e71f263693d408e8bee519bc /2.3-1/macros/Hardware/AVR | |
parent | 3bcc8ce62560f36eaaab0e064b169b0118f354f3 (diff) | |
download | Scilab2C-128638e88ce6d8414c9e1061faa96008be9bcda5.tar.gz Scilab2C-128638e88ce6d8414c9e1061faa96008be9bcda5.tar.bz2 Scilab2C-128638e88ce6d8414c9e1061faa96008be9bcda5.zip |
Intermediate commit aith support added for AVR (GPIO,ADC). Does not support other targets.
Diffstat (limited to '2.3-1/macros/Hardware/AVR')
17 files changed, 224 insertions, 0 deletions
diff --git a/2.3-1/macros/Hardware/AVR/AVRADCSetup.sci b/2.3-1/macros/Hardware/AVR/AVRADCSetup.sci new file mode 100644 index 00000000..d9897fc3 --- /dev/null +++ b/2.3-1/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/2.3-1/macros/Hardware/AVR/AVRDigitalOut.bin b/2.3-1/macros/Hardware/AVR/AVRDigitalOut.bin Binary files differnew file mode 100644 index 00000000..7a09b0d8 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/AVRDigitalOut.bin diff --git a/2.3-1/macros/Hardware/AVR/AVRDigitalOut.sci b/2.3-1/macros/Hardware/AVR/AVRDigitalOut.sci new file mode 100644 index 00000000..f17c8a07 --- /dev/null +++ b/2.3-1/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/2.3-1/macros/Hardware/AVR/AVRDigitalSetup.bin b/2.3-1/macros/Hardware/AVR/AVRDigitalSetup.bin Binary files differnew file mode 100644 index 00000000..98a592e3 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/AVRDigitalSetup.bin diff --git a/2.3-1/macros/Hardware/AVR/AVRDigitalSetup.sci b/2.3-1/macros/Hardware/AVR/AVRDigitalSetup.sci new file mode 100644 index 00000000..3de56c21 --- /dev/null +++ b/2.3-1/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/2.3-1/macros/Hardware/AVR/AVRReadADC.sci b/2.3-1/macros/Hardware/AVR/AVRReadADC.sci new file mode 100644 index 00000000..f9dfdac0 --- /dev/null +++ b/2.3-1/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/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.bin b/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.bin Binary files differnew file mode 100644 index 00000000..eed8be3b --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.bin diff --git a/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.sci b/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.sci new file mode 100644 index 00000000..50a913fa --- /dev/null +++ b/2.3-1/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/2.3-1/macros/Hardware/AVR/GetPeripheral.bin b/2.3-1/macros/Hardware/AVR/GetPeripheral.bin Binary files differnew file mode 100644 index 00000000..b496bbb0 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/GetPeripheral.bin diff --git a/2.3-1/macros/Hardware/AVR/GetPeripheral.sci b/2.3-1/macros/Hardware/AVR/GetPeripheral.sci new file mode 100644 index 00000000..73e9f19e --- /dev/null +++ b/2.3-1/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/2.3-1/macros/Hardware/AVR/InsertPeripheralInList.bin b/2.3-1/macros/Hardware/AVR/InsertPeripheralInList.bin Binary files differnew file mode 100644 index 00000000..c49f4e04 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/InsertPeripheralInList.bin diff --git a/2.3-1/macros/Hardware/AVR/InsertPeripheralInList.sci b/2.3-1/macros/Hardware/AVR/InsertPeripheralInList.sci new file mode 100644 index 00000000..bafc5935 --- /dev/null +++ b/2.3-1/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/2.3-1/macros/Hardware/AVR/IsAVRSupportFunction.bin b/2.3-1/macros/Hardware/AVR/IsAVRSupportFunction.bin Binary files differnew file mode 100644 index 00000000..e2382308 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/IsAVRSupportFunction.bin diff --git a/2.3-1/macros/Hardware/AVR/IsAVRSupportFunction.sci b/2.3-1/macros/Hardware/AVR/IsAVRSupportFunction.sci new file mode 100644 index 00000000..a4cbbc88 --- /dev/null +++ b/2.3-1/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/2.3-1/macros/Hardware/AVR/buildmacros.sce b/2.3-1/macros/Hardware/AVR/buildmacros.sce new file mode 100644 index 00000000..60fd2843 --- /dev/null +++ b/2.3-1/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/2.3-1/macros/Hardware/AVR/lib b/2.3-1/macros/Hardware/AVR/lib Binary files differnew file mode 100644 index 00000000..097a89f0 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/lib diff --git a/2.3-1/macros/Hardware/AVR/names b/2.3-1/macros/Hardware/AVR/names new file mode 100644 index 00000000..4b941e9b --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/names @@ -0,0 +1,6 @@ +AVRDigitalOut +AVRDigitalSetup +GetAVRSupportFunctions +GetPeripheral +InsertPeripheralInList +IsAVRSupportFunction |