diff options
author | Brijeshcr | 2017-07-10 12:41:21 +0530 |
---|---|---|
committer | GitHub | 2017-07-10 12:41:21 +0530 |
commit | 2e9eadc75e51483c41a30544496b4e05c0cf7c41 (patch) | |
tree | 603cb29022e575db10ab26fbb75a5cc5bdf01ad8 /2.3-1/src/c | |
parent | 26ab8620e89571314bc1a828bd9aca3d288eaede (diff) | |
parent | 09d11751736a5812ebfc22cd488f51de02e5375a (diff) | |
download | Scilab2C-2e9eadc75e51483c41a30544496b4e05c0cf7c41.tar.gz Scilab2C-2e9eadc75e51483c41a30544496b4e05c0cf7c41.tar.bz2 Scilab2C-2e9eadc75e51483c41a30544496b4e05c0cf7c41.zip |
Merge pull request #14 from yash1112/master
Arduino toolbox error Resolved
Diffstat (limited to '2.3-1/src/c')
22 files changed, 233 insertions, 16 deletions
diff --git a/2.3-1/src/c/scilab-arduino/cmd_analog_in_volt/u8cmd_analog_in_volts.c b/2.3-1/src/c/scilab-arduino/cmd_analog_in_volt/u8cmd_analog_in_volts.c index 7018df2c..f961719d 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_analog_in_volt/u8cmd_analog_in_volts.c +++ b/2.3-1/src/c/scilab-arduino/cmd_analog_in_volt/u8cmd_analog_in_volts.c @@ -15,8 +15,8 @@ float u8cmd_analog_in_volts(uint8 board_no, uint8 pin) { - float a; - a = ((5*(float)analogRead(pin))/1023); + float a; //declaration of variable + a = ((5*(float)analogRead(pin))/1023); //recieved 10 bit input from analog pin is convert to voltage(0 - 50 return(a); } diff --git a/2.3-1/src/c/scilab-arduino/cmd_analog_out_volt/u8cmd_analog_out_volts.c b/2.3-1/src/c/scilab-arduino/cmd_analog_out_volt/u8cmd_analog_out_volts.c index 2dd82e41..1d76b601 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_analog_out_volt/u8cmd_analog_out_volts.c +++ b/2.3-1/src/c/scilab-arduino/cmd_analog_out_volt/u8cmd_analog_out_volts.c @@ -15,8 +15,8 @@ void u8cmd_analog_out_volts(uint8 board_no, uint8 pin, float value) { - int a; - a = ((value*255)/5); - analogWrite(pin,a); + int a; //declaring variable + a = ((value*255)/5); //converting given voltage to duty cycle value (0 - 255) + analogWrite(pin,a); //passing pin no. and duty cycle value } diff --git a/2.3-1/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c b/2.3-1/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c index 349bcb17..d56d12d7 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c +++ b/2.3-1/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c @@ -15,15 +15,15 @@ void u8cmd_dcmotor_releases(uint8 board_no, uint8 motor_no) { - if (dcm_mode[motor_no] == 3) + if (dcm_mode[motor_no] == 3) //for IC accepting analog value { - analogWrite(dcm_pin_1[motor_no],0); + analogWrite(dcm_pin_1[motor_no],0); //passing LOW to IC pins to stop the motor analogWrite(dcm_pin_2[motor_no],0); } - else + else //for IC accepting digital value { digitalWrite(dcm_pin_1[motor_no],LOW); - digitalWrite(dcm_pin_2[motor_no],LOW); + digitalWrite(dcm_pin_2[motor_no],LOW); //passing LOW to IC pins to stop the motor } } diff --git a/2.3-1/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp b/2.3-1/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp index adc1a6e5..eb9ec102 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp +++ b/2.3-1/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp @@ -1,10 +1,23 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +//This function establishes I2C communication between arduino and given device + #include "cmd_i2c_dev.h" #include "Arduino.h" #include "Wire.h" - uint8 u8cmd_i2c_devs(uint8 address) { - Wire.begin(); - return((uint8)address); + Wire.begin(); //To initiate connection + return((uint8)address); //Returns address to create a device object } diff --git a/2.3-1/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp b/2.3-1/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp index 8f02a87e..24d36dea 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp +++ b/2.3-1/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp @@ -1,3 +1,17 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +//This function reads data from I2C bus. #include "cmd_i2c_read.h" #include "Arduino.h" #include "Wire.h" diff --git a/2.3-1/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp b/2.3-1/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp index 0a2ec2ed..fd07eb6b 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp +++ b/2.3-1/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp @@ -1,3 +1,17 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +//this function reads data from the device register with given address #include "cmd_i2c_read_register.h" #include "Arduino.h" #include "Wire.h" diff --git a/2.3-1/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp b/2.3-1/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp index 0239097a..b7772255 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp +++ b/2.3-1/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp @@ -1,3 +1,16 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +//This function writes data to the connected device #include "cmd_i2c_write.h" #include "Arduino.h" #include "Wire.h" diff --git a/2.3-1/src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp b/2.3-1/src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp index 63cc7c7a..9e3c11c5 100644 --- a/2.3-1/src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp +++ b/2.3-1/src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp @@ -1,3 +1,17 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +//This function writes to the register of the device #include "cmd_i2c_write_register.h" #include "Arduino.h" #include "Wire.h" diff --git a/2.3-1/src/c/scilab-arduino/default_files/sci2c_arduino.ino b/2.3-1/src/c/scilab-arduino/default_files/sci2c_arduino.ino index df28950c..1d4465b7 100644 --- a/2.3-1/src/c/scilab-arduino/default_files/sci2c_arduino.ino +++ b/2.3-1/src/c/scilab-arduino/default_files/sci2c_arduino.ino @@ -11,8 +11,8 @@ */ #include "Arduino.h" -#include <loop_arduino.h> -#include <setup_arduino.h> +#include "loop_arduino.h" +#include "setup_arduino.h" void setup() { diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_dev.h b/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_dev.h index 861a8e7b..382c2b3e 100644 --- a/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_dev.h +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_dev.h @@ -1,3 +1,15 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + #ifndef __CMD_I2C_DEV_H__ #define __CMD_I2C_DEV_H__ diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_read.h b/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_read.h index 791bdd38..e33ede3c 100644 --- a/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_read.h +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_read.h @@ -1,3 +1,15 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + #ifndef __CMD_I2C_READ_H__ #define __CMD_I2C_READ_H__ diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_read_register.h b/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_read_register.h index ea203adf..50fba935 100644 --- a/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_read_register.h +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_read_register.h @@ -1,3 +1,15 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + #ifndef __CMD_I2C_READ_REGISTER_H__ #define __CMD_I2C_READ_REGISTER_H__ diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_write.h b/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_write.h index 6a57222b..128f1af8 100644 --- a/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_write.h +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_write.h @@ -1,3 +1,15 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + #ifndef __CMD_I2C_WRITE_H__ #define __CMD_I2C_WRITE_H__ diff --git a/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_write_register.h b/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_write_register.h index ff1b9ec0..7fac4cbb 100644 --- a/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_write_register.h +++ b/2.3-1/src/c/scilab-arduino/includes/cmd_i2c_write_register.h @@ -1,3 +1,15 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + #ifndef __CMD_I2C_WRITE_REGISTER_H__ #define __CMD_I2C_WRITE_REGISTER_H__ diff --git a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h index c4d93d74..85f3e3cb 100644 --- a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h +++ b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h @@ -1,3 +1,15 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + #ifndef __INT_CMD_I2C_DEV_H__ #define __INT_CMD_I2C_DEV_H__ diff --git a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h index b0633a07..6ffd7ec7 100644 --- a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h +++ b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h @@ -1,3 +1,15 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + #ifndef __INT_CMD_I2C_READ_H__ #define __INT_CMD_I2C_READ_H__ diff --git a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h index 5f4c5298..e848b69b 100644 --- a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h +++ b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h @@ -1,3 +1,15 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + #ifndef __INT_CMD_I2C_READ_REGISTER_H__ #define __INT_CMD_I2C_READ_REGISTER_H__ diff --git a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h index a7705a89..3a015933 100644 --- a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h +++ b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h @@ -1,3 +1,15 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + #ifndef __INT_CMD_I2C_WRITE_H__ #define __INT_CMD_I2C_WRITE_H__ diff --git a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h index 35c0527e..78a3382b 100644 --- a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h +++ b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h @@ -1,3 +1,15 @@ +/* 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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + #ifndef __INT_CMD_I2C_WRITE_REGISTER_H__ #define __INT_CMD_I2C_WRITE_REGISTER_H__ diff --git a/2.3-1/src/c/type/doubleComplex.h b/2.3-1/src/c/type/doubleComplex.h index 4be0d7d3..15bc2684 100644 --- a/2.3-1/src/c/type/doubleComplex.h +++ b/2.3-1/src/c/type/doubleComplex.h @@ -45,6 +45,21 @@ typedef struct double_complex doubleComplex; /* ** } */ +#elif defined(ARDUINO) +/* +** Hand made Double Complex definition +** { +*/ +struct double_complex +{ + double real; + double imag; +}; + +typedef struct double_complex doubleComplex; +/* +** } +*/ #else /* ** Standard C99 Complex @@ -57,7 +72,6 @@ typedef double complex doubleComplex; ** } */ #endif - #ifdef __cplusplus extern "C" { #endif diff --git a/2.3-1/src/c/type/floatComplex.h b/2.3-1/src/c/type/floatComplex.h index fe35ca48..ba725c95 100644 --- a/2.3-1/src/c/type/floatComplex.h +++ b/2.3-1/src/c/type/floatComplex.h @@ -44,6 +44,21 @@ struct float_complex typedef struct float_complex floatComplex; /* ** } +*/
+#elif defined(ARDUINO)
+/* +** Hand made Float Complex definition +** { +*/ +struct float_complex +{ + float real; + float imag; +}; + +typedef struct float_complex floatComplex; +/* +** } */ #else /* diff --git a/2.3-1/src/c/type/types.h b/2.3-1/src/c/type/types.h index a76bf303..ee5c8992 100644 --- a/2.3-1/src/c/type/types.h +++ b/2.3-1/src/c/type/types.h @@ -4,7 +4,7 @@ /*****************************************************************************/ /* TYPE DEFINITIONS */ /*****************************************************************************/ -typedef unsigned char boolean; +/*typedef unsigned char boolean;*/ typedef unsigned char uint8; typedef unsigned short uint16; |