diff options
Diffstat (limited to '2.3-1')
130 files changed, 3014 insertions, 280 deletions
diff --git a/2.3-1/includes/sci2clib.h b/2.3-1/includes/sci2clib.h index 8484deb3..db3a58ea 100644 --- a/2.3-1/includes/sci2clib.h +++ b/2.3-1/includes/sci2clib.h @@ -441,9 +441,16 @@ /*RPi*/ #ifdef RPi1 +#include "wiringPi.h" #include "int_RPIPeripheralDigital.h" #include "RPIPeripheralDigital.h" -#include "int_RPIPeripheralUtil.h" -#include "RPIPeripheralUtil.h" +#include "int_RPIPeripheralTiming.h" +#include "RPIPeripheralTiming.h" +#include "int_RPIPeripheralSerial.h" +#include "RPIPeripheralSerial.h" +#include "int_RPIPeripheralThreading.h" +#include "RPIPeripheralThreading.h" +#include "int_RPIPeripheralPinISR.h" +#include "RPIPeripheralPinISR.h" #endif #endif /* !__SCI2CLIB_H__ */ diff --git a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin Binary files differindex 82599f35..4da57752 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin +++ b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin diff --git a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci index eb1d1f42..de5ae807 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci +++ b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci @@ -108,11 +108,6 @@ global STACKDEDUG PrintStringInfo(' ',ReportFileName,'both','y'); error(9999, 'SCI2CERROR: Unexpected number of output arguments for global function.'); end - //elseif(IsAVRSupportFunction(ASTFunName)) - //Get the peripheral from function name and input arguements, insert it in - //list of used peripherals. - // PeripheralUsed=GetPeripheral(ASTFunName,InArg); - // InsertPeripheralInList(PeripheralUsed,PeripheralInitListFile); end // #RNU_RES_B @@ -194,23 +189,30 @@ global STACKDEDUG FileInfo.GlobalVarFileName); end else - //If a function is passed as input argument, Change the scope of function name from variable to string, - //as it is passed as string to C function. Also enter this function in conversion list also. if(ASTFunName == 'ode') + //Differnt handling of ode function is required as one of its input + // is a name of a function if NInArg == 4 - //InArg(4).Scope = 'String'; ODEFunName = InArg(4).Name; InArg(4).Name = 'odefn'+ InArg(4).Name //To differentiate functions containing differential equations, //'odefn' is added at the beginning of the function name. - SharedInfo.ODElist($+1) = InArg(4).Name; + SharedInfo.Includelist($+1) = InArg(4).Name; //Add ode function in list. this will be used to add corresponding //header file in main function. elseif NInArg == 5 ODEFunName = InArg(5).Name; InArg(5).Name = 'odefn'+ InArg(5).Name - SharedInfo.ODElist($+1) = InArg(5).Name; + SharedInfo.Includelist($+1) = InArg(5).Name; end + elseif(ASTFunName == 'RPI_ThreadCreate') + PI_thread_FunName = InArg(1).Name; + InArg(1).Name = 'PI_thread_'+PI_thread_FunName; + SharedInfo.Includelist($+1) = InArg(1).Name; + elseif(ASTFunName == 'RPI_PinISR') + PI_ISR_FunName = InArg(3).Name; + InArg(3).Name = 'ISR_'+PI_ISR_FunName; + SharedInfo.Includelist($+1) = InArg(3).Name; end [InArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo,ASTFunName); @@ -513,6 +515,18 @@ global STACKDEDUG //ODE_CFunName = C_GenerateFunName(ODEFunName,ODE_InArg,2,ODE_OutArg,1); GenCFunDatFiles(ODEFunName,%t,FunTypeAnnot,['IN(2).SZ(1)' 'IN(2).SZ(2)'],ODE_InArg,2,ODE_OutArg,1,ODE_CFunName,LibTypeInfo,FunInfoDatDir); SharedInfo = FL_UpdateToBeConv(ODEFunName,ODE_CFunName,%t,FunTypeAnnot,FunSizeAnnot,ODE_InArg,2,ODE_OutArg,1,FileInfo,SharedInfo); + elseif ASTFunName == 'RPI_ThreadCreate' then + temp_InArg = InArg; + temp_InArg(1).Name = "" + PI_thread_CFunName = C_GenerateFunName(InArg(1).Name,temp_InArg,0,%t,0); + GenCFunDatFiles(PI_thread_FunName,%t,[],%t,temp_InArg,0,%t,0,PI_thread_CFunName,LibTypeInfo,FunInfoDatDir); + SharedInfo = FL_UpdateToBeConv(PI_thread_FunName,PI_thread_CFunName,%t,FunTypeAnnot,[],%t,0,%t,0,FileInfo,SharedInfo); + elseif ASTFunName == 'RPI_PinISR' then + temp_InArg = InArg; + temp_InArg(1).Name = "" + PI_ISR_CFunName = C_GenerateFunName(InArg(3).Name,temp_InArg,0,%t,0); + GenCFunDatFiles(PI_ISR_FunName,%t,[],%t,temp_InArg,0,%t,0,PI_ISR_CFunName,LibTypeInfo,FunInfoDatDir); + SharedInfo = FL_UpdateToBeConv(PI_ISR_FunName,PI_ISR_CFunName,%t,FunTypeAnnot,[],%t,0,%t,0,FileInfo,SharedInfo); end endfunction diff --git a/2.3-1/macros/ASTManagement/AST_HandleHeader.bin b/2.3-1/macros/ASTManagement/AST_HandleHeader.bin Binary files differindex 67e0296a..078d21b0 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleHeader.bin +++ b/2.3-1/macros/ASTManagement/AST_HandleHeader.bin diff --git a/2.3-1/macros/ASTManagement/AST_HandleHeader.sci b/2.3-1/macros/ASTManagement/AST_HandleHeader.sci index 41dcd06c..98875a3b 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleHeader.sci +++ b/2.3-1/macros/ASTManagement/AST_HandleHeader.sci @@ -120,8 +120,13 @@ end // --- Check coherence between In/Out names and In/Out Arg structure loaded. --- // ----------------------------------------------------------------------------- //#RNU_RES_E -if (length(SharedInfo.CurrentFunInfo.InArg(1).Name) > 0) - NInArgDat = size(SharedInfo.CurrentFunInfo.InArg,1); +if (~isempty(SharedInfo.CurrentFunInfo.InArg)) + + if (length(SharedInfo.CurrentFunInfo.InArg(1).Name) > 0) + NInArgDat = size(SharedInfo.CurrentFunInfo.InArg,1); + else + NInArgDat = 0; + end else NInArgDat = 0; end diff --git a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin Binary files differindex 44c534e5..499d63a2 100644 --- a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin +++ b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin diff --git a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci index 1f3c6b58..d1fc7e61 100644 --- a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci +++ b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci @@ -76,10 +76,10 @@ PrintStringInfo('#include ""'+tmphdrname+tmphdrext+'""',... //If current file is main C file, include header files corresponding to ODE //functions, if any. if(SharedInfo.NextSCIFunName == SharedInfo.SCIMainFunName) - if(size(SharedInfo.ODElist) <> 0) //check if list is empty + if(size(SharedInfo.Includelist) <> 0) //check if list is empty //If not empty, add those header files here. - for cntlist = 1:size(SharedInfo.ODElist) - PrintStringInfo('#include ""'+SharedInfo.ODElist(cntlist)+'.h""',... + for cntlist = 1:size(SharedInfo.Includelist) + PrintStringInfo('#include ""'+SharedInfo.Includelist(cntlist)+'.h""',... FinalCFileName,'file','y'); end diff --git a/2.3-1/macros/CCodeGeneration/C_Funcall.bin b/2.3-1/macros/CCodeGeneration/C_Funcall.bin Binary files differindex 23b9e6f4..fdfb38dd 100644 --- a/2.3-1/macros/CCodeGeneration/C_Funcall.bin +++ b/2.3-1/macros/CCodeGeneration/C_Funcall.bin diff --git a/2.3-1/macros/CCodeGeneration/C_Funcall.sci b/2.3-1/macros/CCodeGeneration/C_Funcall.sci index 22a27709..248b826f 100644 --- a/2.3-1/macros/CCodeGeneration/C_Funcall.sci +++ b/2.3-1/macros/CCodeGeneration/C_Funcall.sci @@ -174,85 +174,52 @@ end // --- Generate the C call. --- // ---------------------------- CCall =''; -if (FunInfo.CFunctionName == SharedInfo.CMainFunName) - if (FlagCall == 1) - error(9999, 'main function called in a source code!'); - else - CCall =CCall+'int '; - end -elseif (mtlb_strcmp(part(CFunName,1:5),'odefn') == %T) - //Return type of function containing ODEs must be int. - CCall = CCall + 'int '; -else - if (PosFirstOutScalar >= 1) +if(mtlb_strcmp(part(CFunName,1:9),'PI_thread') == %T) +//Functions that are to be ru in separate thread in case of RPi target, +//need to have specific name which is PI_THREAD(functionname) + +CCall = CCall + 'PI_THREAD('+CFunName+')' +else + + if (FunInfo.CFunctionName == SharedInfo.CMainFunName) if (FlagCall == 1) - CCall = CCall+OutArg(PosFirstOutScalar).Name+' = '; + error(9999, 'main function called in a source code!'); else - CCall = CCall+C_Type(OutArg(PosFirstOutScalar).Type)+' '; + CCall =CCall+'int '; end + elseif ((mtlb_strcmp(part(CFunName,1:5),'odefn') == %T)) + //Return type of function containing ODEs must be int. + CCall = CCall + 'int '; else - if (FlagCall == 0) - CCall = CCall+'void '; + if (PosFirstOutScalar >= 1) + if (FlagCall == 1) + CCall = CCall+OutArg(PosFirstOutScalar).Name+' = '; + else + CCall = CCall+C_Type(OutArg(PosFirstOutScalar).Type)+' '; + end + else + if (FlagCall == 0) + CCall = CCall+'void '; + end end end -end - -// FIXME : Wrap library function call with prefixed name -//if CFunName == "main" - CCall = CCall + CFunName + "("; -//else -// CCall = CCall+"SCI2C("+CFunName+")("; -//end + // FIXME : Wrap library function call with prefixed name -// #RNU_RES_B -PrintStringInfo(' C call after output scalar args check: '+CCall,ReportFileName,'file','y'); -// #RNU_RES_E -clear counterin -if(mtlb_strcmp(part(CFunName,1:5),'odefn') == %F) - for counterin = 1:NInArg - - if (InArg(counterin).Type == 'g' & InArg(counterin).Scope == 'String') - TmpInArgName = '""'+InArg(counterin).Name+'""'; - elseif (InArg(counterin).Type == 'z' & (InArg(counterin).Scope == 'Number')) - TmpInArgName = 'DoubleComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')'; - elseif (InArg(counterin).Type == 'c' & (InArg(counterin).Scope == 'Number')) - TmpInArgName = 'FloatComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')'; - else - TmpInArgName = InArg(counterin).Name; - end - - TmpInArgType = C_Type(InArg(counterin).Type); + //if CFunName == "main" + CCall = CCall + CFunName + "("; + //else + // CCall = CCall+"SCI2C("+CFunName+")("; + //end - //if (FunctionName == 'OpEqual') - // TmpInArgSizeVar = '__'+OutArg(counterin).Name+'Size'; - // else - TmpInArgSizeVar = '__'+InArg(counterin).Name+'Size'; - //end + // #RNU_RES_B + PrintStringInfo(' C call after output scalar args check: '+CCall,ReportFileName,'file','y'); + // #RNU_RES_E + clear counterin + if(mtlb_strcmp(part(CFunName,1:5),'odefn') == %F) + for counterin = 1:NInArg - if (InArg(counterin).Dimension == 0) - if (FlagCall == 0) - CCall = CCall+TmpInArgType+' '; - end - CCall = CCall+TmpInArgName+','; - else - if (FlagCall == 0) - CCall = CCall+TmpInArgType+'* '+TmpInArgName+', int* __'+TmpInArgName+'Size,'; - else - CCall = CCall+TmpInArgName+', '+TmpInArgSizeVar+','; - end - end - end -else - //If current function contains 'odefn' at the beginning, then it contains - //differnetial equations and its function call need to be differnt than - //other function call. GSL library being used for solving ODEs, requires - //function containing odes in specific format which is differnt than generated - //above. - for counterin = 1:NInArg - - //if((NInArg == 4 & counterin <> 3) | (NInArg == 5 & counterin <> 4)) //Skip third argument if (InArg(counterin).Type == 'g' & InArg(counterin).Scope == 'String') TmpInArgName = '""'+InArg(counterin).Name+'""'; elseif (InArg(counterin).Type == 'z' & (InArg(counterin).Scope == 'Number')) @@ -278,93 +245,135 @@ else CCall = CCall+TmpInArgName+','; else if (FlagCall == 0) - CCall = CCall+TmpInArgType+'* '+TmpInArgName+', ';//int* __'+TmpInArgName+'Size,'; + CCall = CCall+TmpInArgType+'* '+TmpInArgName+', int* __'+TmpInArgName+'Size,'; else - CCall = CCall+TmpInArgName+', ';//+TmpInArgSizeVar+','; + CCall = CCall+TmpInArgName+', '+TmpInArgSizeVar+','; end end - //end - end - -end - -// #RNU_RES_B -PrintStringInfo(' C call after input args analysis: '+CCall,ReportFileName,'file','y'); -// #RNU_RES_E -for counterout = 1:NOutArg - TmpOutArgName = OutArg(counterout).Name; - TmpOutArgType = C_Type(OutArg(counterout).Type); - if (counterout == PosFirstOutScalar) - if (FlagCall == 0) - // #RNU_RES_B - // --- Write in the declaration file the returned output scalar (if any). --- - // #RNU_RES_E - outscalardeclaration = TmpOutArgType+' '+TmpOutArgName+';'; - // #RNU_RES_B - PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); - // #RNU_RES_E - PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CDeclarationFileName,'file','y'); - PrintStringInfo(' ',CDeclarationFileName,'file','y'); end else - if (OutArg(counterout).Dimension == 0) + //If current function contains 'odefn' at the beginning, then it contains + //differnetial equations and its function call need to be differnt than + //other function call. GSL library being used for solving ODEs, requires + //function containing odes in specific format which is differnt than generated + //above. + for counterin = 1:NInArg + + //if((NInArg == 4 & counterin <> 3) | (NInArg == 5 & counterin <> 4)) //Skip third argument + if (InArg(counterin).Type == 'g' & InArg(counterin).Scope == 'String') + TmpInArgName = '""'+InArg(counterin).Name+'""'; + elseif (InArg(counterin).Type == 'z' & (InArg(counterin).Scope == 'Number')) + TmpInArgName = 'DoubleComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')'; + elseif (InArg(counterin).Type == 'c' & (InArg(counterin).Scope == 'Number')) + TmpInArgName = 'FloatComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')'; + else + TmpInArgName = InArg(counterin).Name; + end + + TmpInArgType = C_Type(InArg(counterin).Type); + + //if (FunctionName == 'OpEqual') + // TmpInArgSizeVar = '__'+OutArg(counterin).Name+'Size'; + // else + TmpInArgSizeVar = '__'+InArg(counterin).Name+'Size'; + //end + + if (InArg(counterin).Dimension == 0) + if (FlagCall == 0) + CCall = CCall+TmpInArgType+' '; + end + CCall = CCall+TmpInArgName+','; + else + if (FlagCall == 0) + CCall = CCall+TmpInArgType+'* '+TmpInArgName+', ';//int* __'+TmpInArgName+'Size,'; + else + CCall = CCall+TmpInArgName+', ';//+TmpInArgSizeVar+','; + end + end + //end + end + + end + + // #RNU_RES_B + PrintStringInfo(' C call after input args analysis: '+CCall,ReportFileName,'file','y'); + // #RNU_RES_E + for counterout = 1:NOutArg + TmpOutArgName = OutArg(counterout).Name; + TmpOutArgType = C_Type(OutArg(counterout).Type); + if (counterout == PosFirstOutScalar) if (FlagCall == 0) + // #RNU_RES_B // --- Write in the declaration file the returned output scalar (if any). --- + // #RNU_RES_E outscalardeclaration = TmpOutArgType+' '+TmpOutArgName+';'; + // #RNU_RES_B PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); + // #RNU_RES_E PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CDeclarationFileName,'file','y'); PrintStringInfo(' ',CDeclarationFileName,'file','y'); - CCall = CCall+TmpOutArgType+'* __ptr'+TmpOutArgName+', '; - else - CCall = CCall+'&'+TmpOutArgName+', ';//NUT: verifica se ci vuole l'& end else - if (FlagCall == 0) - CCall = CCall+TmpOutArgType+'* '+TmpOutArgName+','; - if (OutArg(counterout).FindLike == 1) - CCall = CCall+'int* __'+TmpOutArgName+'Size'+','; + if (OutArg(counterout).Dimension == 0) + if (FlagCall == 0) + // --- Write in the declaration file the returned output scalar (if any). --- + outscalardeclaration = TmpOutArgType+' '+TmpOutArgName+';'; + PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CDeclarationFileName,'file','y'); + PrintStringInfo(' ',CDeclarationFileName,'file','y'); + CCall = CCall+TmpOutArgType+'* __ptr'+TmpOutArgName+', '; + else + CCall = CCall+'&'+TmpOutArgName+', ';//NUT: verifica se ci vuole l'& end - // #RNU_RES_B - //NUT prova a sostituire le variabili strutture con variabili dichiarate all'inizio del codice. - // --- Declare the size of the output arguments. --- - // #RNU_RES_E - outscalardeclaration = 'int __'+TmpOutArgName+'Size[2];'; - PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); - PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CDeclarationFileName,'file','y'); - outscalardeclaration = '__'+TmpOutArgName+'Size[0] = '+(OutArg(counterout).Size(1))+';'; - PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); - PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CInitVarsFileName,'file','y'); - outscalardeclaration = '__'+TmpOutArgName+'Size[1] = '+(OutArg(counterout).Size(2))+';'; - PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); - PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CInitVarsFileName,'file','y'); - PrintStringInfo(' ',CInitVarsFileName,'file','y'); else - CCall = CCall+OutArg(counterout).Name+','; - if (OutArg(counterout).FindLike == 1) - CCall = CCall+'(int* ) __'+TmpOutArgName+'Size'+','; + if (FlagCall == 0) + CCall = CCall+TmpOutArgType+'* '+TmpOutArgName+','; + if (OutArg(counterout).FindLike == 1) + CCall = CCall+'int* __'+TmpOutArgName+'Size'+','; + end + // #RNU_RES_B + //NUT prova a sostituire le variabili strutture con variabili dichiarate all'inizio del codice. + // --- Declare the size of the output arguments. --- + // #RNU_RES_E + outscalardeclaration = 'int __'+TmpOutArgName+'Size[2];'; + PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CDeclarationFileName,'file','y'); + outscalardeclaration = '__'+TmpOutArgName+'Size[0] = '+(OutArg(counterout).Size(1))+';'; + PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CInitVarsFileName,'file','y'); + outscalardeclaration = '__'+TmpOutArgName+'Size[1] = '+(OutArg(counterout).Size(2))+';'; + PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CInitVarsFileName,'file','y'); + PrintStringInfo(' ',CInitVarsFileName,'file','y'); + else + CCall = CCall+OutArg(counterout).Name+','; + if (OutArg(counterout).FindLike == 1) + CCall = CCall+'(int* ) __'+TmpOutArgName+'Size'+','; + end end end end end -end -PrintStringInfo(' C call after output args analysis: '+CCall,ReportFileName,'file','y'); -// Remove the last " " and "," -if (part(CCall,length(CCall):length(CCall)) == ' ') - CCall = part(CCall,1:length(CCall)-1); -end -if (part(CCall,length(CCall):length(CCall)) == ',') - CCall = part(CCall,1:length(CCall)-1); -end + PrintStringInfo(' C call after output args analysis: '+CCall,ReportFileName,'file','y'); + // Remove the last " " and "," + if (part(CCall,length(CCall):length(CCall)) == ' ') + CCall = part(CCall,1:length(CCall)-1); + end + if (part(CCall,length(CCall):length(CCall)) == ',') + CCall = part(CCall,1:length(CCall)-1); + end -//__ysize is added to input arguments at last to comply with form required by GSL -if(mtlb_strcmp(part(CFunName,1:5),'odefn') == %T) - CCall = CCall + ', int* '+TmpInArgSizeVar; -end + //__ysize is added to input arguments at last to comply with form required by GSL + if(mtlb_strcmp(part(CFunName,1:5),'odefn') == %T) + CCall = CCall + ', int* '+TmpInArgSizeVar; + end -CCall = CCall+')'; -if (FlagCall == 1) - CCall = CCall+';'; -end + CCall = CCall+')'; + if (FlagCall == 1) + CCall = CCall+';'; + end + +end //NUT: la parte di generazione della C call va inserita in una funzione a parte. //NUT: tale funzione deve avere anche uno switch che consenta di generare differenti versioni //NUT: delle chiamate C in accordo con la libreria disponibile, fermo restando che diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin Binary files differindex 8486a3b2..1b723f16 100644 --- a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin +++ b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci index d87fb9c1..a1373ded 100644 --- a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci +++ b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci @@ -24,10 +24,13 @@ function CFunName = C_GenerateFunName(FunctionName,InArg,NInArg,OutArg,NOutArg) SCI2CNInArgCheck(argn(2),5,5); CFunName = ''; if((IsAVRSupportFunction(FunctionName)) | (IsRPISupportFunction(FunctionName)) | ... - (mtlb_strcmp(part(FunctionName,1:5),'odefn') == %T)) + (mtlb_strcmp(part(FunctionName,1:5),'odefn') == %T) |... + (mtlb_strcmp(part(FunctionName,1:9),'PI_thread') == %T)| ... + (mtlb_strcmp(part(FunctionName,1:4),'ISR_') == %T)) //If current function is an AVR or RPi function, then function name can be just //plain function name without any input/output arguments types - +//Slimilarly for functions conataining ode functions and functions to be called in +//separate thread in RPi CFunName = CFunName+FunctionName; else diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin Binary files differindex 4b3546e9..5a095f46 100644 --- a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin +++ b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci index b1c1e71e..29e8a084 100644 --- a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci +++ b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci @@ -70,14 +70,16 @@ else end PrintStringInfo('CFLAGS = -Wall -pedantic -g -I $(HSRCDIR) -I $(ISRCDIR) -L $(LIBDIR)',FileInfo.MakefileFilename,'file','y','y'); if (target == 'RPi') - PrintStringInfo('LDFLAGS = -llapack -lrefblas -lgfortran -lm -lbcm2835',FileInfo.MakefileFilename,'file','y','y'); + PrintStringInfo('LDFLAGS = -llapack -lrefblas -lgfortran -lm -lwiringPi',FileInfo.MakefileFilename,'file','y','y'); else PrintStringInfo('LDFLAGS = -lblas -llapack -lm ',FileInfo.MakefileFilename,'file','y','y'); end end //If ode function is used, add libgsl. -if(size(SharedInfo.ODElist) <> 0) +if(size(SharedInfo.Includelist) <> 0) + if((mtlb_strcmp(part(SharedInfo.Includelist(1),1:5),'odefn') == %T)) PrintStringInfo('LDFLAGS += -lgsl',FileInfo.MakefileFilename,'file','y','y'); + end end // Binary definition @@ -95,8 +97,10 @@ for i = 1:(nbSources(1) - 1) [tmppath,tmpfile,tmpext] = fileparts(allSources(i)); if(~isempty(strstr(allSources(i),'ode'))) - if(size(SharedInfo.ODElist) <> 0) - PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext+' \\', FileInfo.MakefileFilename,'file','y','y'); + if(size(SharedInfo.Includelist) <> 0) + if((mtlb_strcmp(part(SharedInfo.Includelist(1),1:5),'odefn') == %T)) + PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext+' \\', FileInfo.MakefileFilename,'file','y','y'); + end end else PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext+' \\', FileInfo.MakefileFilename,'file','y','y'); diff --git a/2.3-1/macros/CCodeGeneration/C_Type.bin b/2.3-1/macros/CCodeGeneration/C_Type.bin Binary files differindex 18e0a1b2..f9bad339 100644 --- a/2.3-1/macros/CCodeGeneration/C_Type.bin +++ b/2.3-1/macros/CCodeGeneration/C_Type.bin diff --git a/2.3-1/macros/CCodeGeneration/C_Type.sci b/2.3-1/macros/CCodeGeneration/C_Type.sci index 6e9a295c..3c56b719 100644 --- a/2.3-1/macros/CCodeGeneration/C_Type.sci +++ b/2.3-1/macros/CCodeGeneration/C_Type.sci @@ -43,6 +43,10 @@ elseif (ArgType == 'u16') OutC_Type = 'uint16'; elseif (ArgType == 'i16') OutC_Type = 'int16'; +elseif (ArgType == 'u32') + OutC_Type = 'uint32'; +elseif (ArgType == 'i32') + OutC_Type = 'int32'; elseif (ArgType == 'fn') //This type introduced for ODE function, // as it's one of the inout argument is name of the other function OutC_Type = ''; diff --git a/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.bin b/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.bin Binary files differindex a818143f..084ab085 100644 --- a/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.bin +++ b/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.bin diff --git a/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.sci b/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.sci index 43288958..2c69f46e 100644 --- a/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.sci +++ b/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.sci @@ -146,9 +146,9 @@ PrintStringInfo('** --- C code. ---',CPass2FileName,'file','y'); PrintStringInfo('** ---------------',CPass2FileName,'file','y'); PrintStringInfo('*/',CPass2FileName,'file','y'); -if(SharedInfo.Target == "RPi") - //Add bcm2835_init() function as it is required - PrintStringInfo('bcm2835_init();',CPass2FileName,'file','y'); +if((SharedInfo.Target == "RPi") & (nxtscifunname == SharedInfo.SCIMainFunName)) + //Add wiringPiSetup() function as it is required + PrintStringInfo('wiringPiSetup();',CPass2FileName,'file','y'); end // --- Copy the remaining part of V1 in V2. --- while (~meof(CPass1V1FileFid)) diff --git a/2.3-1/macros/FunctionAnnotation/FA_GetOutArgInfo.bin b/2.3-1/macros/FunctionAnnotation/FA_GetOutArgInfo.bin Binary files differindex 7102319d..2b75b7a3 100644 --- a/2.3-1/macros/FunctionAnnotation/FA_GetOutArgInfo.bin +++ b/2.3-1/macros/FunctionAnnotation/FA_GetOutArgInfo.bin diff --git a/2.3-1/macros/FunctionAnnotation/FA_GetOutArgInfo.sci b/2.3-1/macros/FunctionAnnotation/FA_GetOutArgInfo.sci index 314c0f28..d9696c8b 100644 --- a/2.3-1/macros/FunctionAnnotation/FA_GetOutArgInfo.sci +++ b/2.3-1/macros/FunctionAnnotation/FA_GetOutArgInfo.sci @@ -69,6 +69,7 @@ for counterin = 1:NInArg flagfindlike = -1;
end
end
+
for counterout = 1:NOutArg
if(FunTypeAnnot == 'FA_TP_USER')
diff --git a/2.3-1/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin b/2.3-1/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin Binary files differindex 545334ac..960068e0 100644 --- a/2.3-1/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin +++ b/2.3-1/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin diff --git a/2.3-1/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci b/2.3-1/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci index 61bb6c0d..fe4edb1c 100644 --- a/2.3-1/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci +++ b/2.3-1/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci @@ -16,6 +16,20 @@ RPiSupportFunctions = [ "RPI_DigitalOut" "RPI_DigitalSetup" "RPI_DelayMilli" - "RPI_DelayMicro"]; + "RPI_DelayMicro" + "RPI_GetMillis" + "RPI_GetMicros" + "RPI_SerialSetup" + "RPI_SerialClose" + "RPI_SerialSendChar" + "RPI_SerialFlush" + "RPI_SerialGetChar" + "RPI_ThreadCreate" + "RPI_PinISR" + ]; + +//Note: "RPI_SerialSendData" is removed since distinction between input data +//types is required + endfunction diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.bin b/2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.bin Binary files differnew file mode 100644 index 00000000..3e6c08fa --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.bin diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci new file mode 100644 index 00000000..7f825efd --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_GetMicros.sci @@ -0,0 +1,31 @@ +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/2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.bin b/2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.bin Binary files differnew file mode 100644 index 00000000..b9143650 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.bin diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci new file mode 100644 index 00000000..b83f5fea --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_GetMillis.sci @@ -0,0 +1,31 @@ +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/2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.bin b/2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.bin Binary files differnew file mode 100644 index 00000000..a6c0bd98 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.bin diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci new file mode 100644 index 00000000..2de7d9e8 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_PinISR.sci @@ -0,0 +1,47 @@ +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] + +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/2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.bin b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.bin Binary files differnew file mode 100644 index 00000000..dce972dc --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.bin diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.sci new file mode 100644 index 00000000..0d393f39 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialClose.sci @@ -0,0 +1,25 @@ +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/2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.bin b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.bin Binary files differnew file mode 100644 index 00000000..2a3704d0 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.bin diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.sci new file mode 100644 index 00000000..ffef70b4 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialFlush.sci @@ -0,0 +1,26 @@ +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/2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.bin b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.bin Binary files differnew file mode 100644 index 00000000..9e6dd09a --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.bin diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci new file mode 100644 index 00000000..ce17ea89 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialGetChar.sci @@ -0,0 +1,28 @@ +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); +// 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/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.bin b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.bin Binary files differnew file mode 100644 index 00000000..7614ebcb --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.bin diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci new file mode 100644 index 00000000..82051d66 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendChar.sci @@ -0,0 +1,29 @@ +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/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.bin b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.bin Binary files differnew file mode 100644 index 00000000..a3524a6c --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.bin diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.sci new file mode 100644 index 00000000..6bfe80d1 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSendData.sci @@ -0,0 +1,30 @@ +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/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.bin b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.bin Binary files differnew file mode 100644 index 00000000..0128c27b --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.bin diff --git a/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.sci b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.sci new file mode 100644 index 00000000..25a70a38 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/RPI_SerialSetup.sci @@ -0,0 +1,28 @@ +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/2.3-1/macros/Hardware/RasberryPi/lib b/2.3-1/macros/Hardware/RasberryPi/lib Binary files differindex 10317441..40a6b049 100644 --- a/2.3-1/macros/Hardware/RasberryPi/lib +++ b/2.3-1/macros/Hardware/RasberryPi/lib diff --git a/2.3-1/macros/Hardware/RasberryPi/names b/2.3-1/macros/Hardware/RasberryPi/names index 138ac2a5..a97a189a 100644 --- a/2.3-1/macros/Hardware/RasberryPi/names +++ b/2.3-1/macros/Hardware/RasberryPi/names @@ -5,3 +5,13 @@ RPI_DelayMilli RPI_DigitalIn RPI_DigitalOut RPI_DigitalSetup +RPI_GetMicros +RPI_GetMillis +RPI_PinISR +RPI_SerialClose +RPI_SerialFlush +RPI_SerialGetChar +RPI_SerialSendChar +RPI_SerialSendData +RPI_SerialSetup +u16RPISerialDataAvail diff --git a/2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.bin b/2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.bin Binary files differnew file mode 100644 index 00000000..3789bd6c --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.bin diff --git a/2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci b/2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci new file mode 100644 index 00000000..5a291569 --- /dev/null +++ b/2.3-1/macros/Hardware/RasberryPi/u16RPISerialDataAvail.sci @@ -0,0 +1,29 @@ +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 diff --git a/2.3-1/macros/SymbolTable/ST_GetInArgInfo.bin b/2.3-1/macros/SymbolTable/ST_GetInArgInfo.bin Binary files differindex bb7119ad..1c5fe7c4 100644 --- a/2.3-1/macros/SymbolTable/ST_GetInArgInfo.bin +++ b/2.3-1/macros/SymbolTable/ST_GetInArgInfo.bin diff --git a/2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci b/2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci index 72e96dd9..03b067a1 100644 --- a/2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci +++ b/2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci @@ -154,7 +154,27 @@ for cntinarg = 1:NInArg UpdatedInArg(cntinarg).Scope = 'Temp';
ST_InsOutArg(UpdatedInArg(cntinarg),1,FileInfo,SharedInfo,'all');
end
- else
+ elseif (ASTFunName == 'RPI_ThreadCreate')
+ UpdatedInArg(cntinarg).Name = tmpname; // Change the name.
+ UpdatedInArg(cntinarg).Type = 'fn'; //it is a function name
+ UpdatedInArg(cntinarg).Size(1) = '1';
+ UpdatedInArg(cntinarg).Size(2) = '1'; //+1 = (\0)
+ UpdatedInArg(cntinarg).Value = '&'+tmpname;
+ UpdatedInArg(cntinarg).FindLike = 0;
+ UpdatedInArg(cntinarg).Dimension = 0; //NUT: in future releases you can set this field to 1.
+ UpdatedInArg(cntinarg).Scope = 'Temp';
+ ST_InsOutArg(UpdatedInArg(cntinarg),1,FileInfo,SharedInfo,'all');
+ elseif (ASTFunName == 'RPI_PinISR')
+ UpdatedInArg(cntinarg).Name = tmpname; // Change the name.
+ UpdatedInArg(cntinarg).Type = 'fn'; //it is a function name
+ UpdatedInArg(cntinarg).Size(1) = '1';
+ UpdatedInArg(cntinarg).Size(2) = '1'; //+1 = (\0)
+ UpdatedInArg(cntinarg).Value = '&'+tmpname;
+ UpdatedInArg(cntinarg).FindLike = 0;
+ UpdatedInArg(cntinarg).Dimension = 0; //NUT: in future releases you can set this field to 1.
+ UpdatedInArg(cntinarg).Scope = 'Temp';
+ ST_InsOutArg(UpdatedInArg(cntinarg),1,FileInfo,SharedInfo,'all');
+ else
PrintStringInfo(' ',ReportFileName,'both','y');
PrintStringInfo('SCI2CERROR: Unknown symbol ""'+tmpname+'"".',ReportFileName,'both','y');
PrintStringInfo('SCI2CERROR: Be sure to initialize every symbol you are using.',ReportFileName,'both','y');
diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin Binary files differindex 6da0f761..f9c8482d 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 1e0d67a5..72652e0f 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -4785,7 +4785,7 @@ PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); // --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-//PrintStringInfo('d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+
PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -4810,7 +4810,7 @@ PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); // --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-//PrintStringInfo('d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+
PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -4835,7 +4835,7 @@ PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); // --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-//PrintStringInfo('d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+
PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -4850,6 +4850,208 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
//------------------------------------
+//---- Class RPI_GetMilli ----------
+//------------------------------------
+ClassName = 'RPI_GetMilli';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 0',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u32''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'RPI_GetMillis';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+FunctionName = 'RPI_GetMicros';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class RPI_SetupSerial ----------
+//------------------------------------
+ClassName = 'RPI_SetupSerial';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'RPI_SerialSetup';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class RPI_SetupClose ----------
+//------------------------------------
+ClassName = 'RPI_SetupClose';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'RPI_SerialClose';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'RPI_SerialFlush';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class RPI_SerialSendData ----------
+//------------------------------------
+ClassName = 'RPI_SerialSendData';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+PrintStringInfo('u80u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80i80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80u160'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80i160'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80s0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+PrintStringInfo('u80u82'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80i82'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80u162'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80i162'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80s2'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80d2'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80g2'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'RPI_SerialSendData';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class RPI_SerialDataAvail ----------
+//------------------------------------
+ClassName = 'RPI_SerialDataAvail';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''i16''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'RPI_SerialDataAvail';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'RPI_SerialGetChar';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+//------------------------------------
+//---- Class RPI_ThreadCreate ----------
+//------------------------------------
+ClassName = 'RPI_ThreadCreate';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u16''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'RPI_ThreadCreate';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class RPI_PinISR --------------
+//------------------------------------
+ClassName = 'RPI_PinISR';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 3',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''i16''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'RPI_PinISR';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
//---- Class ODE ---------------------
//------------------------------------
ClassName = 'ODE';
diff --git a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin Binary files differindex c7182880..f0955c33 100644 --- a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin +++ b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci index bee68d19..2aeec080 100644 --- a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci +++ b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci @@ -128,7 +128,7 @@ SharedInfo.ResizeApproach = 'NO_RESIZE'; // 'NO_RESIZE', 'RESIZE_ALL', 'RESIZE_T SharedInfo.Target = Target; // Specifies code generation target.
-SharedInfo.ODElist = list(); //Maintains list of ode functions being used in code
- // to add their header files to main function.
+SharedInfo.Includelist = list(); //Maintains list of functions being used in code
+ // to add their header files to main function.
endfunction
diff --git a/2.3-1/macros/findDeps/getAllHeaders.bin b/2.3-1/macros/findDeps/getAllHeaders.bin Binary files differindex d44f5f20..b7773ac6 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.bin +++ b/2.3-1/macros/findDeps/getAllHeaders.bin diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index be130355..71b8b206 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -169,9 +169,13 @@ function allHeaders = getAllHeaders(Target) ]; RPi_headers = [ - "includes/bcm2835.h" + "src/c/hardware/rasberrypi/libraries/wiringPi/wiringPi.h" + "src/c/hardware/rasberrypi/libraries/wiringPi/wiringSerial.h" "src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h" - "src/c/hardware/rasberrypi/includes/RPIPeripheralUtil.h" + "src/c/hardware/rasberrypi/includes/RPIPeripheralTiming.h" + "src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h" + "src/c/hardware/rasberrypi/includes/RPIPeripheralThreading.h" + "src/c/hardware/rasberrypi/includes/RPIPeripheralPinISR.h" ]; if Target == "StandAlone" diff --git a/2.3-1/macros/findDeps/getAllInterfaces.bin b/2.3-1/macros/findDeps/getAllInterfaces.bin Binary files differindex 63157953..3558d2c5 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.bin +++ b/2.3-1/macros/findDeps/getAllInterfaces.bin diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci index 69288318..9d86180f 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -163,9 +163,11 @@ function allInterfaces = getAllInterfaces(Target) RPI_interfaces = [ "src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralDigital.h" - "src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralUtil.h" - -]; + "src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralTiming.h" + "src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h" + "src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralThreading.h" + "src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinISR.h" + ]; if Target == "StandAlone" allInterfaces = Standalone_interfaces; diff --git a/2.3-1/macros/findDeps/getAllLibraries.bin b/2.3-1/macros/findDeps/getAllLibraries.bin Binary files differindex 8157de90..7828cd21 100644 --- a/2.3-1/macros/findDeps/getAllLibraries.bin +++ b/2.3-1/macros/findDeps/getAllLibraries.bin diff --git a/2.3-1/macros/findDeps/getAllLibraries.sci b/2.3-1/macros/findDeps/getAllLibraries.sci index 57cc9dac..7741caf5 100644 --- a/2.3-1/macros/findDeps/getAllLibraries.sci +++ b/2.3-1/macros/findDeps/getAllLibraries.sci @@ -3,7 +3,7 @@ function allLibraries = getAllLibraries(Target) //Library files required for "RasberryPi" target RPi_libs = [ - "src/c/hardware/rasberrypi/libraries/libbcm2835.a" + "src/c/hardware/rasberrypi/libraries/wiringPi/libwiringPi.so" "src/c/hardware/rasberrypi/libraries/libcblas.a" "src/c/hardware/rasberrypi/libraries/librefblas.a" "src/c/hardware/rasberrypi/libraries/liblapack.a" diff --git a/2.3-1/macros/findDeps/getAllSources.bin b/2.3-1/macros/findDeps/getAllSources.bin Binary files differindex 2fcad7e5..5f60ac96 100644 --- a/2.3-1/macros/findDeps/getAllSources.bin +++ b/2.3-1/macros/findDeps/getAllSources.bin diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci index 050c0d65..84975fcb 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -1005,10 +1005,32 @@ function allSources = getAllSources(Target) "src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c" "src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c" "src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c" - "src/c/hardware/rasberrypi/util/u16RPIDelayMillis.c" - "src/c/hardware/rasberrypi/util/u16RPIDelayMicros.c" - -]; + "src/c/hardware/rasberrypi/timing/u16RPIDelayMillis.c" + "src/c/hardware/rasberrypi/timing/u16RPIDelayMicros.c" + "src/c/hardware/rasberrypi/timing/u32RPIGetMillis.c" + "src/c/hardware/rasberrypi/timing/u32RPIGetMicros.c" + "src/c/hardware/rasberrypi/serial/u8RPISerialSetups.c" + "src/c/hardware/rasberrypi/serial/u8RPISerialCloses.c" + "src/c/hardware/rasberrypi/serial/u8RPISerialSendChars.c" + "src/c/hardware/rasberrypi/serial/u8RPISerialSendDatas.c" + "src/c/hardware/rasberrypi/serial/i8RPISerialSendDatas.c" + "src/c/hardware/rasberrypi/serial/u16RPISerialSendDatas.c" + "src/c/hardware/rasberrypi/serial/i16RPISerialSendDatas.c" + "src/c/hardware/rasberrypi/serial/u8RPISerialSendDataa.c" + "src/c/hardware/rasberrypi/serial/i8RPISerialSendDataa.c" + "src/c/hardware/rasberrypi/serial/u16RPISerialSendDataa.c" + "src/c/hardware/rasberrypi/serial/i16RPISerialSendDataa.c" + "src/c/hardware/rasberrypi/serial/sRPISerialSendDatas.c" + "src/c/hardware/rasberrypi/serial/dRPISerialSendDatas.c" + "src/c/hardware/rasberrypi/serial/sRPISerialSendDataa.c" + "src/c/hardware/rasberrypi/serial/dRPISerialSendDataa.c" + "src/c/hardware/rasberrypi/serial/gRPISerialSendDatas.c" + "src/c/hardware/rasberrypi/serial/i16RPISerialDataAvails.c" + "src/c/hardware/rasberrypi/serial/i16RPISerialGetChars.c" + "src/c/hardware/rasberrypi/serial/u8RPISerialFlushs.c" + "src/c/hardware/rasberrypi/threading/u16RPIThreadCreates.c" + "src/c/hardware/rasberrypi/ISR/i16RPIPinISRs.c" + ]; if Target == "StandAlone" allSources = Standalone_files; diff --git a/2.3-1/macros/runsci2c.bin b/2.3-1/macros/runsci2c.bin Binary files differindex 47f5ccd9..e3770d0e 100644 --- a/2.3-1/macros/runsci2c.bin +++ b/2.3-1/macros/runsci2c.bin diff --git a/2.3-1/macros/runsci2c.sci b/2.3-1/macros/runsci2c.sci index 7dae72ae..5efca907 100644 --- a/2.3-1/macros/runsci2c.sci +++ b/2.3-1/macros/runsci2c.sci @@ -116,8 +116,10 @@ for i = 1:size(allSources, "*") //disp("Copying "+allSources(i)+" in "+SCI2COutputPath+"/src/c/");
//Copy ode related functions only if 'ode' function is used.
if(~isempty(strstr(allSources(i),'ode')))
- if(size(SharedInfo.ODElist) <> 0)
- copyfile(allSources(i), SCI2COutputPath+"/src/c/");
+ if(size(SharedInfo.Includelist) <> 0)
+ if((mtlb_strcmp(part(SharedInfo.Includelist(1),1:5),'odefn') == %T))
+ copyfile(allSources(i), SCI2COutputPath+"/src/c/");
+ end
end
else
copyfile(allSources(i), SCI2COutputPath+"/src/c/");
diff --git a/2.3-1/macros/scilab2c.bin b/2.3-1/macros/scilab2c.bin Binary files differindex 270d1d5f..43191d55 100644 --- a/2.3-1/macros/scilab2c.bin +++ b/2.3-1/macros/scilab2c.bin diff --git a/2.3-1/macros/scilab2c.sci b/2.3-1/macros/scilab2c.sci index 19b1f2b4..8bdb667c 100644 --- a/2.3-1/macros/scilab2c.sci +++ b/2.3-1/macros/scilab2c.sci @@ -12,7 +12,6 @@ function scilab2c(varargin) [lhs, rhs] = argn(); - select rhs // // scilab2c() @@ -144,7 +143,7 @@ error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), // --- LAUNCH USER SCI CODE TO TEST IT BEFORE TRANSLATING IT!!! --- // If Target choosen is 'Standalone' then only execute the code, otherwise directly start conversion. - if ((Target == "StandAlone") | (Target == "RPi")) + if ((Target == "StandAlone"))// | (Target == "RPi")) runscicode(UserScilabMainFile, UserSciFilesPaths); // --- ASK USER FOR CONTINUATION. --- diff --git a/2.3-1/src/c/hardware/rasberrypi/ISR/i16RPIPinISRs.c b/2.3-1/src/c/hardware/rasberrypi/ISR/i16RPIPinISRs.c new file mode 100644 index 00000000..425fc979 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/ISR/i16RPIPinISRs.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to declare interrupt on pins and corresponding ISRs */ + +#include "types.h" +#include "RPIPeripheralPinISR.h" +#include "RPIPeripheralDigital.h" + +int16 i16RPIPinISRs(uint8 pin, uint8 edgetype, void (*ISRFunction)) +{ + int status; + status = wiringPiISR((int)phy_pin[pin-1], (int) edgetype, ISRFunction); + return status; +} + diff --git a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c index d9ff093f..7b84350f 100644 --- a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c +++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalIns.c @@ -19,6 +19,6 @@ uint8 u8RPIDigitalIns(uint8 pin) { uint8 state = 0; - state = bcm2835_gpio_lev(phy_pin[pin-1]); + state = digitalRead(phy_pin[pin-1]); return (state); } diff --git a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c index 97c6a034..d40263f2 100644 --- a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c +++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c @@ -16,11 +16,11 @@ #include "types.h" #include "RPIPeripheralDigital.h" -/*pin is reduced by one as arrayiindex starts from 0 and pin no starts from 1*/ +/*pin is reduced by one as array index starts from 0 and pin no starts from 1*/ uint8 u8RPIDigitalOuts(uint8 pin, uint8 state) { if (state == 0) //low output - bcm2835_gpio_clr(phy_pin[pin-1]); + digitalWrite(phy_pin[pin-1], LOW); if (state == 1) //high output - bcm2835_gpio_set(phy_pin[pin-1]); + digitalWrite(phy_pin[pin-1], HIGH); } diff --git a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c index 79668b16..163f0c87 100644 --- a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c +++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c @@ -12,28 +12,29 @@ /* Function to setup digital pins direction = 1 -> output + direction = 0 -> input */ #include "types.h" #include "RPIPeripheralDigital.h" -/*This array maps pin numbers on RPi board, with actual physical pin numbers -on processor, required by BCM2835 library*/ -int phy_pin[] = {0, 0, 2, 0, 3, 0, 4, 14, 0, 15, /*Pin 1 to 10*/ - 17, 18, 27, 0, 22, 23, 0, 24, 10, 0, /*Pin 11 to 20*/ - 9, 25, 11, 8, 0, 7 }; /*Pin 21 to 26*/ +/*This array maps pin numbers on RPi board, with pin numbers corrsponding +to WiringPi library*/ +int phy_pin[] = {17, 17, 8, 17, 9, 17, 7, 15, 17, 16, /*Pin 1 to 10*/ + 0, 1, 2, 17, 3, 4, 17, 5, 12, 17, /*Pin 11 to 20*/ + 13, 6, 14, 10, 17, 11 }; /*Pin 21 to 26*/ /*pin is reduced by one as arrayiindex starts from 0 and pin no starts from 1*/ uint8 u8RPIDigitalSetups(uint8 pin, uint8 direction) { if(direction == 1) //Pin to be used as output { - bcm2835_gpio_fsel(phy_pin[pin-1], BCM2835_GPIO_FSEL_OUTP); + pinMode(phy_pin[pin-1], OUTPUT); } else { - bcm2835_gpio_fsel(phy_pin[pin-1], BCM2835_GPIO_FSEL_INPT); + pinMode(phy_pin[pin-1], INPUT); } return 0; diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h index e56366c3..60561cca 100644 --- a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralDigital.h @@ -21,7 +21,7 @@ extern "C" { #include "types.h" -#include "bcm2835.h" +#include "wiringPi.h" extern int phy_pin[]; diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralPinISR.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralPinISR.h new file mode 100644 index 00000000..de05f908 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralPinISR.h @@ -0,0 +1,26 @@ + /* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALPINISR_H__ +#define __RPIPERIPHERALPINISR_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +int16 i16RPIPinISRs(uint8 pin, uint8 edgetype, void (*ISRFunction)); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALPINISR_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h new file mode 100644 index 00000000..199caf9f --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralSerial.h @@ -0,0 +1,49 @@ + /* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALSERIAL_H__ +#define __RPIPERIPHERALSERIAL_H__ + +#include "types.h" +#include "wiringSerial.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int u8RPISerialSetups(char* port, int baudrate); +uint8 u8RPISerialCloses(int fd); + +uint8 u8RPISerialSendChars(int fd, uint8 data); +uint8 u8RPISerialSendDatas(int fd, uint8 data); +uint8 i8RPISerialSendDatas(int fd, int8 data); +uint8 u16RPISerialSendDatas(int fd, uint16 data); +uint8 i16RPISerialSendDatas(int fd, int16 data); +uint8 sRPISerialSendDatas(int fd, float data); +uint8 dRPISerialSendDatas(int fd, double data); +uint8 u8RPISerialSendDataa(int fd, uint8* data, int size); +uint8 i8RPISerialSendDataa(int fd, int8* data, int size); +uint8 u16RPISerialSendDataa(int fd, uint16* data, int size); +uint8 i16RPISerialSendDataa(int fd, int16* data, int size); +uint8 sRPISerialSendDataa(int fd, float* data, int size); +uint8 dRPISerialSendDataa(int fd, double* data, int size); +uint8 gRPISerialSendDatas(int fd, uint8* data, int size); + +int16 i16RPISerialDataAvails(int fd); +int16 i16RPISerialGetChars(int fd); + +uint8 u8RPISerialFlushs(int fd); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALSERIAL_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralThreading.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralThreading.h new file mode 100644 index 00000000..4c5d3a55 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralThreading.h @@ -0,0 +1,28 @@ + /* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __RPIPERIPHERALTHREADING_H__ +#define __RPIPERIPHERALTHREADING_H__ + +#include "types.h" +#include "wiringPi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint16 RPIThreadCreate(void (*threadFunction)); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__RPIPERIPHERALTHREADING_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralUtil.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralTiming.h index 0b20ad66..d1ca027e 100644 --- a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralUtil.h +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralTiming.h @@ -12,21 +12,23 @@ /* This file declares functions and constants related to rasberrypi*/ -#ifndef __RPIPERIPHERALUTIL_H__ -#define __RPIPERIPHERALUTIL_H__ +#ifndef __RPIPERIPHERALTIMING_H__ +#define __RPIPERIPHERALTIMING_H__ #ifdef __cplusplus extern "C" { #endif #include "types.h" -#include "bcm2835.h" +#include "wiringPi.h" uint8 u16RPIDelayMillis(uint16 time); uint8 u16RPIDelayMicros(uint16 time); +uint32 u32RPIGetMillis(); +uint32 u32RPIGetMicros(); #ifdef __cplusplus } /* extern "C" */ #endif -#endif /*__RPIPERIPHERALUTIL_H__*/ +#endif /*__RPIPERIPHERALTIMING_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinISR.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinISR.h new file mode 100644 index 00000000..b2c1ed16 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralPinISR.h @@ -0,0 +1,25 @@ + /* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_RPIPERIPHERALPINISR_H__ +#define __INT_RPIPERIPHERALPINISR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPI_PinISR(pin,edge,funname) i16RPIPinISRs((uint8)pin,(uint8)edge,funname) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_RPIPERIPHERALPINISR_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h new file mode 100644 index 00000000..570e9441 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralSerial.h @@ -0,0 +1,47 @@ + /* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_RPIPERIPHERALSERIAL_H__ +#define __INT_RPIPERIPHERALSERIAL_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPI_SerialSetup(port,size,baudrate) u8RPISerialSetups(port,baudrate) +#define RPI_SerialClose(fd) u8RPISerialCloses(fd) + +#define u80u80RPI_SerialSendDatau80(fd,data) u8RPISerialSendDatas(fd,data) +#define u80i80RPI_SerialSendDatau80(fd,data) i8RPISerialSendDatas(fd,data) +#define u80u160RPI_SerialSendDatau80(fd,data) u16RPISerialSendDatas(fd,data) +#define u80i160RPI_SerialSendDatau80(fd,data) i16RPISerialSendDatas(fd,data) +#define u80s0RPI_SerialSendDatau80(fd,data) sRPISerialSendDatas(fd,data) +#define u80d0RPI_SerialSendDatau80(fd,data) dRPISerialSendDatas(fd,data) + +#define u80u82RPI_SerialSendDatau80(fd,data,size) u8RPISerialSendDataa(fd,data,size[0]*size[1]); +#define u80i82RPI_SerialSendDatau80(fd,data,size) i8RPISerialSendDataa(fd,data,size[0]*size[1]); +#define u80u162RPI_SerialSendDatau80(fd,data,size) u16RPISerialSendDataa(fd,data,size[0]*size[1]); +#define u80i162RPI_SerialSendDatau80(fd,data,size) i16RPISerialSendDataa(fd,data,size[0]*size[1]); +#define u80s2RPI_SerialSendDatau80(fd,data,size) sRPISerialSendDataa(fd,data,size[0]*size[1]); +#define u80d2RPI_SerialSendDatau80(fd,data,size) dRPISerialSendDataa(fd,data,size[0]*size[1]); +#define u80g2RPI_SerialSendDatau80(fd,data,size) gRPISerialSendDatas(fd,data,size[0]*size[1]); + +#define RPI_SerialDataAvail(fd) i16RPISerialDataAvails(fd) +#define RPI_SerialGetChar(fd) i16RPISerialGetChars(fd) +#define RPI_SerialFlush(fd) u8RPISerialFlushs(fd) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_RPIPERIPHERALSERIAL_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralThreading.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralThreading.h new file mode 100644 index 00000000..68ed6e0e --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralThreading.h @@ -0,0 +1,25 @@ + /* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_RPIPERIPHERALTHREADING_H__ +#define __INT_RPIPERIPHERALTHREADING_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPI_ThreadCreate(fn) RPIThreadCreate(fn); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_RPIPERIPHERALTHREADING_H__*/ diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralUtil.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralTiming.h index c53db3ba..1a704655 100644 --- a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralUtil.h +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralTiming.h @@ -11,21 +11,24 @@ */ -#ifndef __INT_RPIPERIPHERALUTIL_H__ -#define __INT_RPIPERIPHERALUTIL_H__ +#ifndef __INT_RPIPERIPHERALTIMING_H__ +#define __INT_RPIPERIPHERALTIMING_H__ #include "types.h" -#include "RPIPeripheralUtil.h" +#include "RPIPeripheralTiming.h" #ifdef __cplusplus extern "C" { #endif -#define RPI_DelayMicro(in1) u16RPIDelayMicros((uint16) in1); -#define RPI_DelayMilli(in1) u16RPIDelayMillis((uint16) in1); +#define RPI_DelayMicro(in1) u16RPIDelayMicros((uint16) in1) +#define RPI_DelayMilli(in1) u16RPIDelayMillis((uint16) in1) +#define RPI_GetMicro() u32RPIGetMicros() +#define RPI_GetMillis() u32RPIGetMillis() + #ifdef __cplusplus } /* extern "C" */ #endif -#endif /* !__RPIPERIPHERALUTIL_H__ */ +#endif /* !__RPIPERIPHERALTIMING_H__ */ diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/ads1115.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/ads1115.h new file mode 100644 index 00000000..5c91735c --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/ads1115.h @@ -0,0 +1,55 @@ +/* + * ads1115.c: + * Extend wiringPi with the ADS1115 I2C 16-bit ADC + * Copyright (c) 2016 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +// Constants for some of the internal functions + +// Gain + +#define ADS1115_GAIN_6 0 +#define ADS1115_GAIN_4 1 +#define ADS1115_GAIN_2 2 +#define ADS1115_GAIN_1 3 +#define ADS1115_GAIN_HALF 4 +#define ADS1115_GAIN_QUARTER 5 + +// Data rate + +#define ADS1115_DR_8 0 +#define ADS1115_DR_16 1 +#define ADS1115_DR_32 2 +#define ADS1115_DR_64 3 +#define ADS1115_DR_128 4 +#define ADS1115_DR_250 5 +#define ADS1115_DR_475 6 +#define ADS1115_DR_860 7 + +#ifdef __cplusplus +extern "C" { +#endif + +extern int ads1115Setup (int pinBase, int i2cAddress) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/drcSerial.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/drcSerial.h new file mode 100644 index 00000000..29e988e1 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/drcSerial.h @@ -0,0 +1,33 @@ +/* + * drcSerial.h: + * Extend wiringPi with the DRC Serial protocol (e.g. to Arduino) + * Copyright (c) 2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int drcSetupSerial (const int pinBase, const int numPins, const char *device, const int baud) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/libwiringPi.so b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/libwiringPi.so Binary files differnew file mode 100644 index 00000000..da4a81e1 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/libwiringPi.so diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/max31855.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/max31855.h new file mode 100644 index 00000000..385c4bd3 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/max31855.h @@ -0,0 +1,33 @@ +/* + * max31855.c: + * Extend wiringPi with the MAX31855 SPI Thermocouple driver + * Copyright (c) 2012-2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int max31855Setup (int pinBase, int spiChannel) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/max5322.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/max5322.h new file mode 100644 index 00000000..a217cf88 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/max5322.h @@ -0,0 +1,33 @@ +/* + * max5322.h: + * Extend wiringPi with the MAX5322 SPI Digital to Analog convertor + * Copyright (c) 2012-2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int max5322Setup (int pinBase, int spiChannel) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23008.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23008.h new file mode 100644 index 00000000..e9299a8c --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23008.h @@ -0,0 +1,33 @@ +/* + * 23008.h: + * Extend wiringPi with the MCP 23008 I2C GPIO expander chip + * Copyright (c) 2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int mcp23008Setup (const int pinBase, const int i2cAddress) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23016.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23016.h new file mode 100644 index 00000000..f9b5cc54 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23016.h @@ -0,0 +1,33 @@ +/* + * mcp23016.h: + * Extend wiringPi with the MCP 23016 I2C GPIO expander chip + * Copyright (c) 2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int mcp23016Setup (const int pinBase, const int i2cAddress) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23016reg.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23016reg.h new file mode 100644 index 00000000..9aea92d5 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23016reg.h @@ -0,0 +1,48 @@ +/* + * mcp23016: + * Copyright (c) 2012-2013 Gordon Henderson + * + * Header file for code using the MCP23016 GPIO expander + * chip. + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +// MCP23016 Registers + +#define MCP23016_GP0 0x00 +#define MCP23016_GP1 0x01 +#define MCP23016_OLAT0 0x02 +#define MCP23016_OLAT1 0x03 +#define MCP23016_IPOL0 0x04 +#define MCP23016_IPOL1 0x05 +#define MCP23016_IODIR0 0x06 +#define MCP23016_IODIR1 0x07 +#define MCP23016_INTCAP0 0x08 +#define MCP23016_INTCAP1 0x09 +#define MCP23016_IOCON0 0x0A +#define MCP23016_IOCON1 0x0B + +// Bits in the IOCON register + +#define IOCON_IARES 0x01 + +// Default initialisation mode + +#define IOCON_INIT 0 diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23017.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23017.h new file mode 100644 index 00000000..79b4d7b3 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23017.h @@ -0,0 +1,33 @@ +/* + * 23017.h: + * Extend wiringPi with the MCP 23017 I2C GPIO expander chip + * Copyright (c) 2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int mcp23017Setup (const int pinBase, const int i2cAddress) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23s08.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23s08.h new file mode 100644 index 00000000..ebf93d19 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23s08.h @@ -0,0 +1,33 @@ +/* + * 23s08.h: + * Extend wiringPi with the MCP 23s08 SPI GPIO expander chip + * Copyright (c) 2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int mcp23s08Setup (const int pinBase, const int spiPort, const int devId) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23s17.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23s17.h new file mode 100644 index 00000000..3b2a8088 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23s17.h @@ -0,0 +1,33 @@ +/* + * 23s17.h: + * Extend wiringPi with the MCP 23s17 SPI GPIO expander chip + * Copyright (c) 2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int mcp23s17Setup (int pinBase, int spiPort, int devId) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23x08.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23x08.h new file mode 100644 index 00000000..c4e6b272 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23x08.h @@ -0,0 +1,73 @@ +/* + * mcp23x17: + * Copyright (c) 2012-2013 Gordon Henderson + * + * Header file for code using the MCP23x17 GPIO expander chip. + * This comes in 2 flavours: MCP23017 which has an I2C interface, + * an the MXP23S17 which has an SPI interface. + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + + +// MCP23x17 Registers + +#define IODIRA 0x00 +#define IPOLA 0x02 +#define GPINTENA 0x04 +#define DEFVALA 0x06 +#define INTCONA 0x08 +#define IOCON 0x0A +#define GPPUA 0x0C +#define INTFA 0x0E +#define INTCAPA 0x10 +#define GPIOA 0x12 +#define OLATA 0x14 + +#define IODIRB 0x01 +#define IPOLB 0x03 +#define GPINTENB 0x05 +#define DEFVALB 0x07 +#define INTCONB 0x09 +#define IOCONB 0x0B +#define GPPUB 0x0D +#define INTFB 0x0F +#define INTCAPB 0x11 +#define GPIOB 0x13 +#define OLATB 0x15 + +// Bits in the IOCON register + +#define IOCON_UNUSED 0x01 +#define IOCON_INTPOL 0x02 +#define IOCON_ODR 0x04 +#define IOCON_HAEN 0x08 +#define IOCON_DISSLW 0x10 +#define IOCON_SEQOP 0x20 +#define IOCON_MIRROR 0x40 +#define IOCON_BANK_MODE 0x80 + +// Default initialisation mode + +#define IOCON_INIT (IOCON_SEQOP) + +// SPI Command codes + +#define CMD_WRITE 0x40 +#define CMD_READ 0x41 diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23x0817.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23x0817.h new file mode 100644 index 00000000..58bc0382 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp23x0817.h @@ -0,0 +1,87 @@ +/* + * mcp23xxx: + * Copyright (c) 2012-2013 Gordon Henderson + * + * Header file for code using the MCP23x08 and 17 GPIO expander + * chips. + * This comes in 2 flavours: MCP230xx (08/17) which has an I2C + * interface, and the MXP23Sxx (08/17) which has an SPI interface. + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +// MCP23x08 Registers + +#define MCP23x08_IODIR 0x00 +#define MCP23x08_IPOL 0x01 +#define MCP23x08_GPINTEN 0x02 +#define MCP23x08_DEFVAL 0x03 +#define MCP23x08_INTCON 0x04 +#define MCP23x08_IOCON 0x05 +#define MCP23x08_GPPU 0x06 +#define MCP23x08_INTF 0x07 +#define MCP23x08_INTCAP 0x08 +#define MCP23x08_GPIO 0x09 +#define MCP23x08_OLAT 0x0A + +// MCP23x17 Registers + +#define MCP23x17_IODIRA 0x00 +#define MCP23x17_IPOLA 0x02 +#define MCP23x17_GPINTENA 0x04 +#define MCP23x17_DEFVALA 0x06 +#define MCP23x17_INTCONA 0x08 +#define MCP23x17_IOCON 0x0A +#define MCP23x17_GPPUA 0x0C +#define MCP23x17_INTFA 0x0E +#define MCP23x17_INTCAPA 0x10 +#define MCP23x17_GPIOA 0x12 +#define MCP23x17_OLATA 0x14 + +#define MCP23x17_IODIRB 0x01 +#define MCP23x17_IPOLB 0x03 +#define MCP23x17_GPINTENB 0x05 +#define MCP23x17_DEFVALB 0x07 +#define MCP23x17_INTCONB 0x09 +#define MCP23x17_IOCONB 0x0B +#define MCP23x17_GPPUB 0x0D +#define MCP23x17_INTFB 0x0F +#define MCP23x17_INTCAPB 0x11 +#define MCP23x17_GPIOB 0x13 +#define MCP23x17_OLATB 0x15 + +// Bits in the IOCON register + +#define IOCON_UNUSED 0x01 +#define IOCON_INTPOL 0x02 +#define IOCON_ODR 0x04 +#define IOCON_HAEN 0x08 +#define IOCON_DISSLW 0x10 +#define IOCON_SEQOP 0x20 +#define IOCON_MIRROR 0x40 +#define IOCON_BANK_MODE 0x80 + +// Default initialisation mode + +#define IOCON_INIT (IOCON_SEQOP) + +// SPI Command codes + +#define CMD_WRITE 0x40 +#define CMD_READ 0x41 diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp3002.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp3002.h new file mode 100644 index 00000000..0cd727f3 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp3002.h @@ -0,0 +1,33 @@ +/* + * mcp3002.c: + * Extend wiringPi with the MCP3002 SPI Analog to Digital convertor + * Copyright (c) 2012-2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int mcp3002Setup (int pinBase, int spiChannel) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp3004.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp3004.h new file mode 100644 index 00000000..a07c0bf0 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp3004.h @@ -0,0 +1,33 @@ +/* + * mcp3004.c: + * Extend wiringPi with the MCP3004 SPI Analog to Digital convertor + * Copyright (c) 2012-2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int mcp3004Setup (int pinBase, int spiChannel) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp3422.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp3422.h new file mode 100644 index 00000000..72647d45 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp3422.h @@ -0,0 +1,43 @@ +/* + * mcp3422.h: + * Extend wiringPi with the MCP3422/3/4 I2C ADC chip + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#define MCP3422_SR_240 0 +#define MCP3422_SR_60 1 +#define MCP3422_SR_15 2 +#define MCP3422_SR_3_75 3 + +#define MCP3422_GAIN_1 0 +#define MCP3422_GAIN_2 1 +#define MCP3422_GAIN_4 2 +#define MCP3422_GAIN_8 3 + + +#ifdef __cplusplus +extern "C" { +#endif + +extern int mcp3422Setup (int pinBase, int i2cAddress, int sampleRate, int gain) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp4802.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp4802.h new file mode 100644 index 00000000..effa0246 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/mcp4802.h @@ -0,0 +1,33 @@ +/* + * mcp4802.c: + * Extend wiringPi with the MCP4802 SPI Digital to Analog convertor + * Copyright (c) 2012-2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int mcp4802Setup (int pinBase, int spiChannel) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/pcf8574.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/pcf8574.h new file mode 100644 index 00000000..8e2d8181 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/pcf8574.h @@ -0,0 +1,33 @@ +/* + * pcf8574.h: + * Extend wiringPi with the PCF8574 I2C GPIO expander chip + * Copyright (c) 2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int pcf8574Setup (const int pinBase, const int i2cAddress) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/pcf8591.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/pcf8591.h new file mode 100644 index 00000000..6b44ccf9 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/pcf8591.h @@ -0,0 +1,33 @@ +/* + * pcf8591.h: + * Extend wiringPi with the PCF8591 I2C GPIO Analog expander chip + * Copyright (c) 2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int pcf8591Setup (const int pinBase, const int i2cAddress) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/sn3218.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/sn3218.h new file mode 100644 index 00000000..580d5f96 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/sn3218.h @@ -0,0 +1,33 @@ +/* + * sn3218.c: + * Extend wiringPi with the SN3218 I2C LED driver board. + * Copyright (c) 2012-2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int sn3218Setup (int pinBase) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/softPwm.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/softPwm.h new file mode 100644 index 00000000..0351da5d --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/softPwm.h @@ -0,0 +1,35 @@ +/* + * softPwm.h: + * Provide 2 channels of software driven PWM. + * Copyright (c) 2012 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int softPwmCreate (int pin, int value, int range) ; +extern void softPwmWrite (int pin, int value) ; +extern void softPwmStop (int pin) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/softServo.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/softServo.h new file mode 100644 index 00000000..794cf552 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/softServo.h @@ -0,0 +1,35 @@ +/* + * softServo.h: + * Provide N channels of software driven PWM suitable for RC + * servo motors. + * Copyright (c) 2012 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern void softServoWrite (int pin, int value) ; +extern int softServoSetup (int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/softTone.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/softTone.h new file mode 100644 index 00000000..a93c5af3 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/softTone.h @@ -0,0 +1,39 @@ +/* + * softTone.c: + * For that authentic retro sound... + * Er... A little experiment to produce tones out of a Pi using + * one (or 2) GPIO pins and a piezeo "speaker" element. + * (Or a high impedance speaker, but don'y blame me if you blow-up + * the GPIO pins!) + * Copyright (c) 2012 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int softToneCreate (int pin) ; +extern void softToneStop (int pin) ; +extern void softToneWrite (int pin, int freq) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/sr595.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/sr595.h new file mode 100644 index 00000000..4a26dc7c --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/sr595.h @@ -0,0 +1,34 @@ +/* + * sr595.h: + * Extend wiringPi with the 74x595 shift registers. + * Copyright (c) 2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int sr595Setup (const int pinBase, const int numPins, + const int dataPin, const int clockPin, const int latchPin) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringPi.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringPi.h new file mode 100644 index 00000000..e11a0bef --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringPi.h @@ -0,0 +1,234 @@ +/* + * wiringPi.h: + * Arduino like Wiring library for the Raspberry Pi. + * Copyright (c) 2012-2016 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with wiringPi. If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifndef __WIRING_PI_H__ +#define __WIRING_PI_H__ + +// C doesn't have true/false by default and I can never remember which +// way round they are, so ... + +#ifndef TRUE +# define TRUE (1==1) +# define FALSE (!TRUE) +#endif + +// Handy defines + +// wiringPi modes + +#define WPI_MODE_PINS 0 +#define WPI_MODE_GPIO 1 +#define WPI_MODE_GPIO_SYS 2 +#define WPI_MODE_PHYS 3 +#define WPI_MODE_PIFACE 4 +#define WPI_MODE_UNINITIALISED -1 + +// Pin modes + +#define INPUT 0 +#define OUTPUT 1 +#define PWM_OUTPUT 2 +#define GPIO_CLOCK 3 +#define SOFT_PWM_OUTPUT 4 +#define SOFT_TONE_OUTPUT 5 +#define PWM_TONE_OUTPUT 6 + +#define LOW 0 +#define HIGH 1 + +// Pull up/down/none + +#define PUD_OFF 0 +#define PUD_DOWN 1 +#define PUD_UP 2 + +// PWM + +#define PWM_MODE_MS 0 +#define PWM_MODE_BAL 1 + +// Interrupt levels + +#define INT_EDGE_SETUP 0 +#define INT_EDGE_FALLING 1 +#define INT_EDGE_RISING 2 +#define INT_EDGE_BOTH 3 + +// Pi model types and version numbers +// Intended for the GPIO program Use at your own risk. + +#define PI_MODEL_A 0 +#define PI_MODEL_B 1 +#define PI_MODEL_AP 2 +#define PI_MODEL_BP 3 +#define PI_MODEL_2 4 +#define PI_ALPHA 5 +#define PI_MODEL_CM 6 +#define PI_MODEL_07 7 +#define PI_MODEL_3 8 +#define PI_MODEL_ZERO 9 + +#define PI_VERSION_1 0 +#define PI_VERSION_1_1 1 +#define PI_VERSION_1_2 2 +#define PI_VERSION_2 3 + +#define PI_MAKER_SONY 0 +#define PI_MAKER_EGOMAN 1 +#define PI_MAKER_MBEST 2 +#define PI_MAKER_UNKNOWN 3 + +extern const char *piModelNames [16] ; +extern const char *piRevisionNames [16] ; +extern const char *piMakerNames [16] ; +extern const int piMemorySize [ 8] ; + + +// Intended for the GPIO program Use at your own risk. + +// Threads + +#define PI_THREAD(X) void *X (void *dummy) + +// Failure modes + +#define WPI_FATAL (1==1) +#define WPI_ALMOST (1==2) + + +// wiringPiNodeStruct: +// This describes additional device nodes in the extended wiringPi +// 2.0 scheme of things. +// It's a simple linked list for now, but will hopefully migrate to +// a binary tree for efficiency reasons - but then again, the chances +// of more than 1 or 2 devices being added are fairly slim, so who +// knows.... + +struct wiringPiNodeStruct +{ + int pinBase ; + int pinMax ; + + int fd ; // Node specific + unsigned int data0 ; // ditto + unsigned int data1 ; // ditto + unsigned int data2 ; // ditto + unsigned int data3 ; // ditto + + void (*pinMode) (struct wiringPiNodeStruct *node, int pin, int mode) ; + void (*pullUpDnControl) (struct wiringPiNodeStruct *node, int pin, int mode) ; + int (*digitalRead) (struct wiringPiNodeStruct *node, int pin) ; + void (*digitalWrite) (struct wiringPiNodeStruct *node, int pin, int value) ; + void (*pwmWrite) (struct wiringPiNodeStruct *node, int pin, int value) ; + int (*analogRead) (struct wiringPiNodeStruct *node, int pin) ; + void (*analogWrite) (struct wiringPiNodeStruct *node, int pin, int value) ; + + struct wiringPiNodeStruct *next ; +} ; + +extern struct wiringPiNodeStruct *wiringPiNodes ; + + +// Function prototypes +// c++ wrappers thanks to a comment by Nick Lott +// (and others on the Raspberry Pi forums) + +#ifdef __cplusplus +extern "C" { +#endif + +// Data + +// Internal + +extern int wiringPiFailure (int fatal, const char *message, ...) ; + +// Core wiringPi functions + +extern struct wiringPiNodeStruct *wiringPiFindNode (int pin) ; +extern struct wiringPiNodeStruct *wiringPiNewNode (int pinBase, int numPins) ; + +extern int wiringPiSetup (void) ; +extern int wiringPiSetupSys (void) ; +extern int wiringPiSetupGpio (void) ; +extern int wiringPiSetupPhys (void) ; + +extern void pinModeAlt (int pin, int mode) ; +extern void pinMode (int pin, int mode) ; +extern void pullUpDnControl (int pin, int pud) ; +extern int digitalRead (int pin) ; +extern void digitalWrite (int pin, int value) ; +extern void pwmWrite (int pin, int value) ; +extern int analogRead (int pin) ; +extern void analogWrite (int pin, int value) ; + +// PiFace specifics +// (Deprecated) + +extern int wiringPiSetupPiFace (void) ; +extern int wiringPiSetupPiFaceForGpioProg (void) ; // Don't use this - for gpio program only + +// On-Board Raspberry Pi hardware specific stuff + +extern int piBoardRev (void) ; +extern void piBoardId (int *model, int *rev, int *mem, int *maker, int *overVolted) ; +extern int wpiPinToGpio (int wpiPin) ; +extern int physPinToGpio (int physPin) ; +extern void setPadDrive (int group, int value) ; +extern int getAlt (int pin) ; +extern void pwmToneWrite (int pin, int freq) ; +extern void digitalWriteByte (int value) ; +extern unsigned int digitalReadByte (void) ; +extern void pwmSetMode (int mode) ; +extern void pwmSetRange (unsigned int range) ; +extern void pwmSetClock (int divisor) ; +extern void gpioClockSet (int pin, int freq) ; + +// Interrupts +// (Also Pi hardware specific) + +extern int waitForInterrupt (int pin, int mS) ; +extern int wiringPiISR (int pin, int mode, void (*function)(void)) ; + +// Threads + +extern int piThreadCreate (void *(*fn)(void *)) ; +extern void piLock (int key) ; +extern void piUnlock (int key) ; + +// Schedulling priority + +extern int piHiPri (const int pri) ; + +// Extras from arduino land + +extern void delay (unsigned int howLong) ; +extern void delayMicroseconds (unsigned int howLong) ; +extern unsigned int millis (void) ; +extern unsigned int micros (void) ; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringPiI2C.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringPiI2C.h new file mode 100644 index 00000000..6db8c688 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringPiI2C.h @@ -0,0 +1,42 @@ +/* + * wiringPiI2C.h: + * Simplified I2C access routines + * Copyright (c) 2013 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int wiringPiI2CRead (int fd) ; +extern int wiringPiI2CReadReg8 (int fd, int reg) ; +extern int wiringPiI2CReadReg16 (int fd, int reg) ; + +extern int wiringPiI2CWrite (int fd, int data) ; +extern int wiringPiI2CWriteReg8 (int fd, int reg, int data) ; +extern int wiringPiI2CWriteReg16 (int fd, int reg, int data) ; + +extern int wiringPiI2CSetupInterface (const char *device, int devId) ; +extern int wiringPiI2CSetup (const int devId) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringPiSPI.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringPiSPI.h new file mode 100644 index 00000000..39803219 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringPiSPI.h @@ -0,0 +1,36 @@ +/* + * wiringPiSPI.h: + * Simplified SPI access routines + * Copyright (c) 2012-2015 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with wiringPi. + * If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +int wiringPiSPIGetFd (int channel) ; +int wiringPiSPIDataRW (int channel, unsigned char *data, int len) ; +int wiringPiSPISetupMode (int channel, int speed, int mode) ; +int wiringPiSPISetup (int channel, int speed) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringSerial.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringSerial.h new file mode 100644 index 00000000..430dc731 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringSerial.h @@ -0,0 +1,38 @@ +/* + * wiringSerial.h: + * Handle a serial port + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with wiringPi. If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int serialOpen (const char *device, const int baud) ; +extern void serialClose (const int fd) ; +extern void serialFlush (const int fd) ; +extern void serialPutchar (const int fd, const unsigned char c) ; +extern void serialPuts (const int fd, const char *s) ; +extern void serialPrintf (const int fd, const char *message, ...) ; +extern int serialDataAvail (const int fd) ; +extern int serialGetchar (const int fd) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringShift.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringShift.h new file mode 100644 index 00000000..419ade41 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wiringShift.h @@ -0,0 +1,41 @@ +/* + * wiringShift.h: + * Emulate some of the Arduino wiring functionality. + * + * Copyright (c) 2009-2012 Gordon Henderson. + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with wiringPi. If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + +#define LSBFIRST 0 +#define MSBFIRST 1 + +#ifndef _STDINT_H +# include <stdint.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern uint8_t shiftIn (uint8_t dPin, uint8_t cPin, uint8_t order) ; +extern void shiftOut (uint8_t dPin, uint8_t cPin, uint8_t order, uint8_t val) ; + +#ifdef __cplusplus +} +#endif diff --git a/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wpiExtensions.h b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wpiExtensions.h new file mode 100644 index 00000000..fcaec96e --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/libraries/wiringPi/wpiExtensions.h @@ -0,0 +1,26 @@ +/* + * extensions.h: + * Part of the GPIO program to test, peek, poke and otherwise + * noodle with the GPIO hardware on the Raspberry Pi. + * Copyright (c) 2012-2015 Gordon Henderson + *********************************************************************** + * This file is part of wiringPi: + * https://projects.drogon.net/raspberry-pi/wiringpi/ + * + * wiringPi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wiringPi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with wiringPi. If not, see <http://www.gnu.org/licenses/>. + *********************************************************************** + */ + + +extern int loadWPiExtension (char *progName, char *extensionData, int verbose) ; diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDataa.c b/2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDataa.c new file mode 100644 index 00000000..271a6b1f --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDataa.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send double data array/matrix on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 dRPISerialSendDataa(int fd, double* data, int size) +{ + int count = 0; + + for (count = 0; count < size; count++) + { + dRPISerialSendDatas(fd, data[count]); + } + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDatas.c b/2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDatas.c new file mode 100644 index 00000000..163e9c7d --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/dRPISerialSendDatas.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send double data on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 dRPISerialSendDatas(int fd, double data) +{ + uint8 count; + + union double_bytes{ + double double_data; + unsigned char bytes[sizeof(double)]; + } in_data; + + in_data.double_data = data; + + for(count=0; count<sizeof(double); count++) + { + //Send lsb first + serialPutchar(fd, (uint8) in_data.bytes[count]); + } + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/gRPISerialSendDatas.c b/2.3-1/src/c/hardware/rasberrypi/serial/gRPISerialSendDatas.c new file mode 100644 index 00000000..4ad671a0 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/gRPISerialSendDatas.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send string on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 gRPISerialSendDatas(int fd, uint8* data, int size) +{ + int count = 0; + + while(data[count] != '\0') + { + serialPutchar(fd, data[count]); + } + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialDataAvails.c b/2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialDataAvails.c new file mode 100644 index 00000000..b56a8196 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialDataAvails.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to check for data availability at specified port. Returns no of + bytes to be read */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +int16 i16RPISerialDataAvails(int fd) +{ + int bytes = 0; + bytes = serialDataAvail(fd); + + return bytes; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialGetChars.c b/2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialGetChars.c new file mode 100644 index 00000000..18ca2a7a --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialGetChars.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to read character from spcified serial port (file descriptor). + This function will block execution for 10 secs if no character is available, + and will return -1 in that case*/ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +int16 i16RPISerialGetChars(int fd) +{ + int data = 0; + + data = serialGetchar(fd); + + return data; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialSendDataa.c b/2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialSendDataa.c new file mode 100644 index 00000000..f5b7d71e --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialSendDataa.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send signed 16-bit data array/matrix on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 i16RPISerialSendDataa(int fd, int16* data, int size) +{ + int count = 0; + + for (count = 0; count < size; ++count) + { + i16RPISerialSendDatas(fd, data[count]); + } + + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialSendDatas.c b/2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialSendDatas.c new file mode 100644 index 00000000..861d7d89 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/i16RPISerialSendDatas.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send signed 16-bit byte on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 i16RPISerialSendDatas(int fd, int16 data) +{ + //Send lsb first + serialPutchar(fd, (uint8) data); + serialPutchar(fd, (uint8) (data>>8)); + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDataa.c b/2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDataa.c new file mode 100644 index 00000000..d208a01c --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDataa.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send signed 8-bit byte array/matrix on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 i8RPISerialSendDataa(int fd, int8* data, int size) +{ + int count = 0; + + for (count = 0; count < size; ++count) + { + i8RPISerialSendDatas(fd, data[count]); + } + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDatas.c b/2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDatas.c new file mode 100644 index 00000000..0d130d1d --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/i8RPISerialSendDatas.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send signed 8-bit byte on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 i8RPISerialSendDatas(int fd, int8 data) +{ + serialPutchar(fd, (uint8) data); + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDataa.c b/2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDataa.c new file mode 100644 index 00000000..92fa5a72 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDataa.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send float data array/matrix on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 sRPISerialSendDataa(int fd, float* data, int size) +{ + int count = 0; + + for (count = 0; count < size; ++count) + { + sRPISerialSendDatas(fd, data[count]); + } + + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDatas.c b/2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDatas.c new file mode 100644 index 00000000..a8c34d0e --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/sRPISerialSendDatas.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send float data on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 sRPISerialSendDatas(int fd, float data) +{ + uint8 count; + + union float_bytes{ + float float_data; + unsigned char bytes[sizeof(float)]; + } in_data; + in_data.float_data = data; + + for(count=0; count<sizeof(float); count++) + { + //Send lsb first + serialPutchar(fd, (uint8) in_data.bytes[count]); + } + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u16RPISerialSendDataa.c b/2.3-1/src/c/hardware/rasberrypi/serial/u16RPISerialSendDataa.c new file mode 100644 index 00000000..e979882e --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u16RPISerialSendDataa.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send unsigned 16-bit data array/matrix on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 u16RPISerialSendDataa(int fd, uint16* data, int size) +{ + int count = 0; + + for (count = 0; count < size; ++count) + { + u16RPISerialSendDatas(fd, data[count]); + } + + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u16RPISerialSendDatas.c b/2.3-1/src/c/hardware/rasberrypi/serial/u16RPISerialSendDatas.c new file mode 100644 index 00000000..5b2d0568 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u16RPISerialSendDatas.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send unsigned 16-bit data on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 u16RPISerialSendDatas(int fd, uint16 data) +{ + //Send lsb first + serialPutchar(fd, (uint8) data); + serialPutchar(fd, (uint8) (data>>8)); + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialCloses.c b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialCloses.c new file mode 100644 index 00000000..d5d4e37e --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialCloses.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to close serial port opened. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 u8RPISerialCloses(int fd) +{ + serialClose (fd); + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialFlushs.c b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialFlushs.c new file mode 100644 index 00000000..2df1f37d --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialFlushs.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to discards data serial buffer (received as well as waiting to be sent */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 u8RPISerialFlushs(int fd) +{ + serialFlush(fd); + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendChars.c b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendChars.c new file mode 100644 index 00000000..ca15b21d --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendChars.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send 8-bit char on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 u8RPISerialSendChars(int fd, uint8 data) +{ + serialPutchar(fd, data); + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDataa.c b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDataa.c new file mode 100644 index 00000000..e2fe32f7 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDataa.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send unsigned 8-bit byte array/matrix on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 u8RPISerialSendDataa(int fd, uint8* data, int size) +{ + int count = 0; + + for (count = 0; count < size; ++count) + { + u8RPISerialSendDatas(fd, data[count]); + } + + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDatas.c b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDatas.c new file mode 100644 index 00000000..86d2be5c --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSendDatas.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to send unsigned 8-bit byte on specified serial port. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +uint8 u8RPISerialSendDatas(int fd, uint8 data) +{ + serialPutchar(fd, data); + + return 0; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSetups.c b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSetups.c new file mode 100644 index 00000000..6912279e --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/serial/u8RPISerialSetups.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to setup port with desired baud rate. */ + +#include "types.h" +#include "RPIPeripheralSerial.h" + +int u8RPISerialSetups(char* port, int baudrate) +{ + int fd; + + fd = serialOpen (port, baudrate); + + return fd; +} diff --git a/2.3-1/src/c/hardware/rasberrypi/threading/u16RPIThreadCreates.c b/2.3-1/src/c/hardware/rasberrypi/threading/u16RPIThreadCreates.c new file mode 100644 index 00000000..d94beff4 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/threading/u16RPIThreadCreates.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to create thread for given function */ + +#include "types.h" +#include "RPIPeripheralThreading.h" + +uint16 RPIThreadCreate(void (*threadFunction)) +{ + int status; + status = piThreadCreate (threadFunction); + return status; +} + diff --git a/2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMicros.c b/2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMicros.c new file mode 100644 index 00000000..48418c09 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMicros.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to insert some delay in code execution. */ + +#include "types.h" +#include "RPIPeripheralTiming.h" + +uint8 u16RPIDelayMicros(uint16 time) +{ + delayMicroseconds(time); +} + diff --git a/2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMillis.c b/2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMillis.c new file mode 100644 index 00000000..2dc59bbf --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/timing/u16RPIDelayMillis.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to insert some delay in code execution. */ + + + +#include "types.h" +#include "RPIPeripheralTiming.h" + +uint8 u16RPIDelayMillis(uint16 time) +{ + delay(time); + +} + diff --git a/2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMicros.c b/2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMicros.c new file mode 100644 index 00000000..eb086a9f --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMicros.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to get time in microsecond since first setup function called */ + +#include "types.h" +#include "RPIPeripheralTiming.h" + +uint32 u32RPIGetMicros() +{ + return(micros()); +}
\ No newline at end of file diff --git a/2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMillis.c b/2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMillis.c new file mode 100644 index 00000000..c1189753 --- /dev/null +++ b/2.3-1/src/c/hardware/rasberrypi/timing/u32RPIGetMillis.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to get time in millisecond since first setup function called */ + +#include "types.h" +#include "RPIPeripheralTiming.h" + +uint32 u32RPIGetMillis() +{ + return(millis()); +}
\ No newline at end of file diff --git a/2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMicros.c b/2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMicros.c deleted file mode 100644 index f29635be..00000000 --- a/2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMicros.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should have received as part of this distribution. The terms - are also available at - http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani - Organization: FOSSEE, IIT Bombay - Email: toolbox@scilab.in -*/ - -/* Function to insert some delay in code execution. - - Calling Sequence - u16RPIDelayMicros(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 - u16RPIDelayMicros(100) //This will delay the execution of next code by 100 ms. -*/ - -#include "types.h" -#include "RPIPeripheralUtil.h" - -uint8 u16RPIDelayMicros(uint16 time) -{ - bcm2835_delayMicroseconds(time); -} - diff --git a/2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMillis.c b/2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMillis.c deleted file mode 100644 index f03e8baa..00000000 --- a/2.3-1/src/c/hardware/rasberrypi/util/u16RPIDelayMillis.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should have received as part of this distribution. The terms - are also available at - http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Siddhesh Wani - Organization: FOSSEE, IIT Bombay - Email: toolbox@scilab.in -*/ - -/* Function to insert some delay in code execution. - - Calling Sequence - u16RPIDelayMillis(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.'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 - u16RPIDelayMillis(100) //This will delay the execution of next code by 100 ms. -*/ - -#include "types.h" -#include "RPIPeripheralUtil.h" - -uint8 u16RPIDelayMillis(uint16 time) -{ - bcm2835_delay(time); - -} - |