diff options
Diffstat (limited to '2.3-1/src/c')
16 files changed, 403 insertions, 10 deletions
diff --git a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD128x64.h b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD128x64.h index d541c9fd..93bdf279 100644 --- a/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD128x64.h +++ b/2.3-1/src/c/hardware/rasberrypi/includes/RPIPeripheralLCD128x64.h @@ -22,13 +22,17 @@ extern "C" { int8 RPI_lcd128x64setup(void); void u8RPI_lcd128x64clears(uint8 colour); void u8RPI_lcd128x64Orientations(uint8 orientation); + void u8RPI_lcd128x64setOrigins(uint8 x, uint8 y); + void u8RPI_lcd128x64points(uint8 x, uint8 y, uint8 colour); void u8RPI_lcd128x64lineTos(uint8 x, uint8 y, uint8 colour); + void u8RPI_lcd128x64lines(uint8 x0, uint8 y0, uint8 x1, uint8 y1, uint8 colour); void u8RPI_lcd128x64circles(uint8 x, uint8 y, uint8 r, uint8 colour, uint8 filled); void u8RPI_lcd128x64putchars(uint8 x, uint8 y, uint8 c, uint8 bgCol, uint8 fgCol); void u8RPI_lcd128x64putss(uint8 x, uint8 y, char *str,int size, uint8 bgCol, uint8 fgCol); + void u8RPI_lcd128x64rectangles(uint8 x1, uint8 y1, uint8 x2, uint8 y2, uint8 colour, uint8 filled); void u8RPI_lcd128x64ellipses(uint8 cx, uint8 cy, uint8 xRadius, uint8 yRadius, uint8 colour, uint8 filled); diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD.h index e6dcb7db..803f93e3 100644 --- a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD.h +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD.h @@ -21,18 +21,22 @@ extern "C" { #endif #define u80u80u80u80u80u80u80u80u80u80RPI_lcdCharDef(fd,index,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdCharDefs(fd,index,d0,d1,d2,d3,d4,d5,d6,d7); +#define u80d0d0d0d0d0d0d0d0d0RPI_lcdCharDef(fd,index,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdCharDefs(fd,index,d0,d1,d2,d3,d4,d5,d6,d7); #define d0d0d0d0d0d0d0d0d0d0RPI_lcdCharDef(fd,index,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdCharDefs(fd,index,d0,d1,d2,d3,d4,d5,d6,d7); #define u80RPI_lcdClear(fd) u8RPI_lcdClears(fd); #define d0RPI_lcdClear(fd) u8RPI_lcdClears(fd); #define u80u80RPI_lcdCursorBlink(fd,state) u8RPI_lcdCursorBlinks(fd,state); +#define u80d0RPI_lcdCursorBlink(fd,state) u8RPI_lcdCursorBlinks(fd,state); #define d0d0RPI_lcdCursorBlink(fd,state) u8RPI_lcdCursorBlinks(fd,state); #define u80u80RPI_lcdCursor(fd,state) u8RPI_lcdCursors(fd,state); +#define u80d0RPI_lcdCursor(fd,state) u8RPI_lcdCursors(fd,state); #define d0d0RPI_lcdCursor(fd,state) u8RPI_lcdCursors(fd,state); #define u80u80RPI_lcdDisplay(fd,state) u8RPI_lcdDisplays(fd,state); +#define u80d0RPI_lcdDisplay(fd,state) u8RPI_lcdDisplays(fd,state); #define d0d0RPI_lcdDisplay(fd,state) u8RPI_lcdDisplays(fd,state); #define u80RPI_lcdHome(fd) u8RPI_lcdHomes(fd); @@ -42,12 +46,15 @@ extern "C" { #define d0d0d0d0d0d0d0d0d0d0d0d0d0RPI_lcdIniti80(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7) u8RPI_lcdInits(rows,cols,bits,rs,strb,d0,d1,d2,d3,d4,d5,d6,d7); #define u80u80u80RPI_lcdPosition(fd,row,col) u8RPI_lcdPositions(fd,row,col); +#define u80d0d0RPI_lcdPosition(fd,row,col) u8RPI_lcdPositions(fd,row,col); #define d0d0d0RPI_lcdPosition(fd,row,col) u8RPI_lcdPositions(fd,row,col); #define u80u80RPI_lcdPutchar(fd,char) u8RPI_lcdPutchars(fd,char); +#define u80d0RPI_lcdPutchar(fd,char) u8RPI_lcdPutchars(fd,char); #define d0d0RPI_lcdPutchar(fd,char) u8RPI_lcdPutchars(fd,char); #define u80u80RPI_lcdSendCommand(fd,cmd) u8RPI_lcdSendCommands(fd,cmd); +#define u80d0RPI_lcdSendCommand(fd,cmd) u8RPI_lcdSendCommands(fd,cmd); #define d0d0RPI_lcdSendCommand(fd,cmd) u8RPI_lcdSendCommands(fd,cmd); #define u80g2RPI_lcdPuts(fd,msg,size) u8RPI_lcdPutss(fd,msg,size[1]);; diff --git a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD128x64.h b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD128x64.h index 77cc433c..8bb4b17e 100644 --- a/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD128x64.h +++ b/2.3-1/src/c/hardware/rasberrypi/interfaces/int_RPIPeripheralLCD128x64.h @@ -33,6 +33,7 @@ extern "C" { #define u80u80u80RPI_lcd128x64point(x,y,colour) u8RPI_lcd128x64points(x,y,colour); #define d0d0d0RPI_lcd128x64point(x,y,colour) u8RPI_lcd128x64points(x,y,colour); + #define u80u80u80RPI_lcd128x64lineTo(x,y,colour) u8RPI_lcd128x64lineTos(x,y,colour); #define d0d0d0RPI_lcd128x64lineTo(x,y,colour) u8RPI_lcd128x64lineTos(x,y,colour); diff --git a/2.3-1/src/c/specialFunctions/erfcx/derfcxa.c b/2.3-1/src/c/specialFunctions/erfcx/derfcxa.c new file mode 100644 index 00000000..d2cd7505 --- /dev/null +++ b/2.3-1/src/c/specialFunctions/erfcx/derfcxa.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "erfcx.h" +#include "erfc.h" + +void derfcxa(double* inp1, int sizer, int sizec, double* out) +{ + for (int i = 0; i < sizer*sizec; i++) + { + out[i] = derfcxs(inp1[i]); + } +} + diff --git a/2.3-1/src/c/specialFunctions/erfcx/derfcxs.c b/2.3-1/src/c/specialFunctions/erfcx/derfcxs.c new file mode 100644 index 00000000..ff12b2fb --- /dev/null +++ b/2.3-1/src/c/specialFunctions/erfcx/derfcxs.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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "erfcx.h" +#include "erfc.h" + +double derfcxs(double inp1) +{ + return exp(inp1*inp1)*derfcs(inp1); +} + diff --git a/2.3-1/src/c/specialFunctions/erfcx/serfcxa.c b/2.3-1/src/c/specialFunctions/erfcx/serfcxa.c new file mode 100644 index 00000000..a28c30c7 --- /dev/null +++ b/2.3-1/src/c/specialFunctions/erfcx/serfcxa.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "erfcx.h" +#include "erfc.h" + +void serfcxa(float* inp1, int sizer, int sizec, float* out) +{ + for (int i = 0; i < sizer*sizec; i++) + { + out[i] = serfcxs(inp1[i]); + } +} + diff --git a/2.3-1/src/c/specialFunctions/erfcx/serfcxs.c b/2.3-1/src/c/specialFunctions/erfcx/serfcxs.c new file mode 100644 index 00000000..be31a5a8 --- /dev/null +++ b/2.3-1/src/c/specialFunctions/erfcx/serfcxs.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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "erfcx.h" +#include "erfc.h" + +float serfcxs(float inp1) +{ + return exp(inp1*inp1)*derfcs(inp1); +} + diff --git a/2.3-1/src/c/specialFunctions/erfinv/derfinva.c b/2.3-1/src/c/specialFunctions/erfinv/derfinva.c new file mode 100644 index 00000000..45d119c4 --- /dev/null +++ b/2.3-1/src/c/specialFunctions/erfinv/derfinva.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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "erfinv.h" + +void derfinva(double* inp1, int sizer, int sizec,double* out) +{ + for (int i = 0; i < sizer*sizec; i++) + { + out[i] = derfinvs(inp1[i]); + } +} + diff --git a/2.3-1/src/c/specialFunctions/erfinv/derfinvs.c b/2.3-1/src/c/specialFunctions/erfinv/derfinvs.c new file mode 100644 index 00000000..3f7fe761 --- /dev/null +++ b/2.3-1/src/c/specialFunctions/erfinv/derfinvs.c @@ -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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "erfinv.h" + +# define PI 3.1415927 + +double derfinvs (double inp1) +{ + double a[] = {0.88622692374517353,-1.6601283962374516,0.92661860147244357,-0.14110320437680104}; //Coefficients for the formula to calculate inverse error + double b[] = {-2.13505380615258078,1.46060340345661088,-0.33198239813321595,0.01197270616590528}; //Coefficients for the formula to calculate inverse error + double c[] = {-1.994216456587148,-1.87267416351196,3.60874665878559364,1.82365845766309853}; //Coefficients for the formula to calculate inverse error + double d[] = {3.74146294065960872,1.81848952562894617}; //Coefficients for the formula to calculate inverse error + + if ((inp1 > 1) || (inp1 < -1)) + { + return 0.0/0.0; // returns Nan + } + if ((inp1 >= -0.7) && (inp1 <= 0.7)) + { + double sq = inp1 * inp1; + return (inp1 * (((a[3]*sq+a[2]) * sq+a[1]) * sq+a[0]) / ((((b[3]*sq+b[2]) * sq+b[1]) * sq+b[0]) * sq+1)); //Inverse error formula + } + + else if ((inp1 > 0.7) && (inp1 < 1)) + { + double z = sqrt(-log((1-inp1)/2)); + return ((((c[3]*z+c[2]) * z+c[1]) * z+c[0]) / ((d[1]*z+d[0]) * z+1)); //Inverse error formula + } + + else if ((inp1 > -1) && (inp1 < 0.7)) + { + double z = sqrt(-log((1+inp1)/2)); + return (-(((c[3]*z+c[2]) * z+c[1]) * z+c[0]) / ((d[1]*z+d[0]) * z+1)); //Inverse error formula + } +} + diff --git a/2.3-1/src/c/specialFunctions/erfinv/serfinva.c b/2.3-1/src/c/specialFunctions/erfinv/serfinva.c new file mode 100644 index 00000000..3a14f3c8 --- /dev/null +++ b/2.3-1/src/c/specialFunctions/erfinv/serfinva.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: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "erfinv.h" + +void serfinva(float* inp1, int sizer, int sizec,float* out) +{ + for (int i = 0; i < sizer*sizec; i++) + { + out[i] = serfinvs(inp1[i]); + } +} + diff --git a/2.3-1/src/c/specialFunctions/erfinv/serfinvs.c b/2.3-1/src/c/specialFunctions/erfinv/serfinvs.c new file mode 100644 index 00000000..5436fe39 --- /dev/null +++ b/2.3-1/src/c/specialFunctions/erfinv/serfinvs.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "erfinv.h" + +# define PI 3.1415927 + +float serfinvs (float inp1) +{ + float a[] = {0.88622692374517353,-1.6601283962374516,0.92661860147244357,-0.14110320437680104}; //Coefficients for the formula to calculate inverse error + float b[] = {-2.13505380615258078,1.46060340345661088,-0.33198239813321595,0.01197270616590528}; //Coefficients for the formula to calculate inverse error + float c[] = {-1.994216456587148,-1.87267416351196,3.60874665878559364,1.82365845766309853}; //Coefficients for the formula to calculate inverse error + float d[] = {3.74146294065960872,1.81848952562894617}; //Coefficients for the formula to calculate inverse error + + if ((inp1 > 1) || (inp1 < -1)) + { + double na = 0.0/0.0; + return (float)na; + } + if ((inp1 >= -0.7) && (inp1 <= 0.7)) + { + float sq = inp1 * inp1; + return (inp1 * (((a[3]*sq+a[2]) * sq+a[1]) * sq+a[0]) / ((((b[3]*sq+b[2]) * sq+b[1]) * sq+b[0]) * sq+1)); //Inverse error formula + } + + else if ((inp1 > 0.7) && (inp1 < 1)) + { + float z = sqrt(-log((1-inp1)/2)); + return ((((c[3]*z+c[2]) * z+c[1]) * z+c[0]) / ((d[1]*z+d[0]) * z+1)); //Inverse error formula + } + + else if ((inp1 > -1) && (inp1 < 0.7)) + { + float z = sqrt(-log((1+inp1)/2)); + return (-(((c[3]*z+c[2]) * z+c[1]) * z+c[0]) / ((d[1]*z+d[0]) * z+1)); //Inverse error formula + } +} + diff --git a/2.3-1/src/c/specialFunctions/includes/erfc.h b/2.3-1/src/c/specialFunctions/includes/erfc.h index 77847ab5..509e34e5 100644 --- a/2.3-1/src/c/specialFunctions/includes/erfc.h +++ b/2.3-1/src/c/specialFunctions/includes/erfc.h @@ -1,13 +1,13 @@ -/* - * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET - * - * This file must be used under the terms of the CeCILL. - * This source file is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at - * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - * + /* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in */ #ifndef __ERFC_H__ diff --git a/2.3-1/src/c/specialFunctions/includes/erfcx.h b/2.3-1/src/c/specialFunctions/includes/erfcx.h new file mode 100644 index 00000000..dd1e4420 --- /dev/null +++ b/2.3-1/src/c/specialFunctions/includes/erfcx.h @@ -0,0 +1,37 @@ + /* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ERFCX_H__ +#define __ERFCX_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "uint8.h" +#include "uint16.h" +#include "int16.h" +#include "erfc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double derfcxs(double inp1); +void derfcxa(double* inp1, int sizer, int sizec,double* out); +float serfcxs(float inp1); +void serfcxa(float* inp1, int sizer, int sizec, float* out); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__ERFCX_H__*/ diff --git a/2.3-1/src/c/specialFunctions/includes/erfinv.h b/2.3-1/src/c/specialFunctions/includes/erfinv.h new file mode 100644 index 00000000..5d6210cc --- /dev/null +++ b/2.3-1/src/c/specialFunctions/includes/erfinv.h @@ -0,0 +1,35 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __ERFINV_H__ +#define __ERFINV_H__ +#include "types.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "uint8.h" +#include "uint16.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double derfinvs (double inp1); +float serfinvs (float inp1); +void derfinva(double* inp1, int sizer, int sizec,double* out); +void serfinva(float* inp1, int sizer, int sizec,float* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__ERFINV_H__*/ diff --git a/2.3-1/src/c/specialFunctions/interfaces/int_erfcx.h b/2.3-1/src/c/specialFunctions/interfaces/int_erfcx.h new file mode 100644 index 00000000..89840d48 --- /dev/null +++ b/2.3-1/src/c/specialFunctions/interfaces/int_erfcx.h @@ -0,0 +1,32 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_ERFCX_H__ +#define __INT_ERFCX_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define d0erfcxd0(in1) derfcxs(in1) +#define s0erfcxs0(in1) serfcxs(in1) +#define d2erfcxd2(in1,size,out) derfcxa(in1,size[0],size[1],out) +#define s2erfcs2(in1,size,out) serfca(in1,size[0],size[1],out) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_ERFCX_H__*/ diff --git a/2.3-1/src/c/specialFunctions/interfaces/int_erfinv.h b/2.3-1/src/c/specialFunctions/interfaces/int_erfinv.h new file mode 100644 index 00000000..f19baa12 --- /dev/null +++ b/2.3-1/src/c/specialFunctions/interfaces/int_erfinv.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Brijesh Gupta C R + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#ifndef __INT_ERFINV_H__ +#define __INT_ERFINV_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define d0erfinvd0(in1) derfinvs(in1) +#define s0erfinvs0(in1) serfinvs(in1) +#define d2erfinvd2(in1,size,out) derfinva(in1,size[0],size[1],out) +#define s2erfinvs2(in1,size,out) serfinva(in1,size[0],size[1],out) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_ERFINV_H__*/ |