summaryrefslogtreecommitdiff
path: root/src/c
diff options
context:
space:
mode:
Diffstat (limited to 'src/c')
-rw-r--r--src/c/CACSD/includes/lqr.h2
-rw-r--r--src/c/CACSD/interfaces/int_lqr.h9
-rw-r--r--src/c/CACSD/lqe/dlqea.c2
-rw-r--r--src/c/CACSD/lqr/dlqra.c42
-rw-r--r--src/c/elementaryFunctions/includes/sec.h2
-rw-r--r--src/c/scilab-arduino/cmd_analog_in_volt/u8cmd_analog_in_volts.c22
-rw-r--r--src/c/scilab-arduino/cmd_analog_out_volt/u8cmd_analog_out_volts.c22
-rw-r--r--src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c29
-rw-r--r--src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c1
-rw-r--r--src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c1
-rw-r--r--src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp10
-rw-r--r--src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp18
-rw-r--r--src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp26
-rw-r--r--src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp13
-rw-r--r--src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp16
-rw-r--r--src/c/scilab-arduino/includes/cmd_analog_in_volt.h28
-rw-r--r--src/c/scilab-arduino/includes/cmd_analog_out_volt.h27
-rw-r--r--src/c/scilab-arduino/includes/cmd_dcmotor_release.h30
-rw-r--r--src/c/scilab-arduino/includes/cmd_dcmotor_run.h2
-rw-r--r--src/c/scilab-arduino/includes/cmd_dcmotor_setup.h2
-rw-r--r--src/c/scilab-arduino/includes/cmd_i2c_dev.h16
-rw-r--r--src/c/scilab-arduino/includes/cmd_i2c_read.h16
-rw-r--r--src/c/scilab-arduino/includes/cmd_i2c_read_register.h16
-rw-r--r--src/c/scilab-arduino/includes/cmd_i2c_write.h16
-rw-r--r--src/c/scilab-arduino/includes/cmd_i2c_write_register.h16
-rw-r--r--src/c/scilab-arduino/interfaces/int_cmd_analog_in_volt.h30
-rw-r--r--src/c/scilab-arduino/interfaces/int_cmd_analog_out_volt.h30
-rw-r--r--src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h9
-rw-r--r--src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h17
-rw-r--r--src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h19
-rw-r--r--src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h18
-rw-r--r--src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h20
-rw-r--r--src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h19
-rw-r--r--src/c/scilab-arduino/sleep/u16sleeps.c2
34 files changed, 522 insertions, 26 deletions
diff --git a/src/c/CACSD/includes/lqr.h b/src/c/CACSD/includes/lqr.h
index 062d6e4..5b20ee8 100644
--- a/src/c/CACSD/includes/lqr.h
+++ b/src/c/CACSD/includes/lqr.h
@@ -17,7 +17,7 @@
extern "C" {
#endif
-void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K);
+void dlqra(double* sys, int sys_rows, int sys_cols, double* Q, double* R, double* S, double* X, double* K);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/c/CACSD/interfaces/int_lqr.h b/src/c/CACSD/interfaces/int_lqr.h
index e6f534f..8deba90 100644
--- a/src/c/CACSD/interfaces/int_lqr.h
+++ b/src/c/CACSD/interfaces/int_lqr.h
@@ -16,7 +16,14 @@
extern "C" {
#endif
-#define ss2lqrd2d2(in1,size1,out1,out2) dlqra(in1,size1[0],size1[1],out1,out2);
+#define ss2lqrd2d2(in1,size1,out1,out2) dlqra(in1,size1[0],size1[1],NULL,\
+ NULL,NULL,out1,out2);
+
+#define ss2d2d2lqrd2d2(in1,size1,in2,size2,in3,size3,out1,out2) dlqra(in1,\
+ size1[0],size1[1],in2,in3,NULL,out1,out2);
+
+#define ss2d2d2d2lqrd2d2(in1,size1,in2,size2,in3,size3,in4,size4,out1,out2) \
+ dlqra(in1,size1[0],size1[1],in2,in3,in4,out1,out2);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/c/CACSD/lqe/dlqea.c b/src/c/CACSD/lqe/dlqea.c
index 63f8d62..e0be5b3 100644
--- a/src/c/CACSD/lqe/dlqea.c
+++ b/src/c/CACSD/lqe/dlqea.c
@@ -54,7 +54,7 @@ void dlqea(double* sys, int sys_rows, int sys_cols, double* X, double* K)
/*Calculate LQR gain*/
K_lqr = (double*) malloc(no_of_ip*no_of_st*sizeof(double));
- dlqra(sys_lqr,sys_lqr_rows,sys_lqr_cols,X,K_lqr);
+ dlqra(sys_lqr,sys_lqr_rows,sys_lqr_cols,NULL,NULL,NULL,X,K_lqr);
dtransposea(K_lqr,sys_rows - no_of_st,no_of_st,K);
} \ No newline at end of file
diff --git a/src/c/CACSD/lqr/dlqra.c b/src/c/CACSD/lqr/dlqra.c
index 02ac150..1440c3a 100644
--- a/src/c/CACSD/lqr/dlqra.c
+++ b/src/c/CACSD/lqr/dlqra.c
@@ -22,7 +22,8 @@
#include "schur.h"
#include "matrixDivision.h"
-void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K)
+void dlqra(double* sys, int sys_rows, int sys_cols, double* Q, double* R, \
+ double* S, double* K, double* X)
{
int no_of_states, no_of_inputs, no_of_outputs, dom = 1;
int row,col;
@@ -32,7 +33,7 @@ void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K)
double *A, *B, *C, *D;
double *B_t, *C_t, *D_t;
- double *Q, *R, *S;
+ //double *Q, *R, *S;
double *Ri, *LA, *LE;
double *BRi, *StRi, *S_t;
double *buf1, *buf2, *buf3, *buf4, *buf5, *buf6;
@@ -90,20 +91,29 @@ void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K)
dom = (int)sys[(sys_rows*(sys_cols-2)) + no_of_states];
- Q = (double*) malloc (no_of_states*no_of_states*sizeof(double));
- R = (double*) malloc (no_of_inputs*no_of_inputs*sizeof(double));
- S = (double*) malloc (no_of_inputs*no_of_states*sizeof(double));
-
dtransposea(B,no_of_states,no_of_inputs,B_t);
dtransposea(C,no_of_outputs,no_of_states,C_t);
dtransposea(D,no_of_outputs,no_of_inputs,D_t);
- dmulma(C_t,no_of_states,no_of_outputs,C,no_of_outputs,no_of_states,Q);
- dmulma(D_t,no_of_inputs,no_of_outputs,D,no_of_outputs,no_of_inputs,R);
- dmulma(D_t,no_of_inputs,no_of_outputs,C,no_of_outputs,no_of_states,S);
+ if(Q == NULL)
+ {/*If Q is not provided*/
+ Q = (double*) malloc (no_of_states*no_of_states*sizeof(double));
+ dmulma(C_t,no_of_states,no_of_outputs,C,no_of_outputs,no_of_states,Q);
+ }
+
+ if(R == NULL)
+ {/*If R is not provided*/
+ R = (double*) malloc (no_of_inputs*no_of_inputs*sizeof(double));
+ dmulma(D_t,no_of_inputs,no_of_outputs,D,no_of_outputs,no_of_inputs,R);
+ }
- /*Free up unwanted variables*/
+ if(S == NULL)
+ {/*If Q is not provided*/
+ S = (double*) malloc (no_of_inputs*no_of_states*sizeof(double));
+ dmulma(D_t,no_of_inputs,no_of_outputs,C,no_of_outputs,no_of_states,S);
+ }
+ /*Free up unwanted variables*/
free(C);
free(C_t);
free(D);
@@ -177,8 +187,8 @@ void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K)
/*Freeup umwanted variables*/
free(A);
- free(Q);
- free(R);
+ //free(Q);
+ //free(R);
free(BRi);
free(S_t);
free(StRi);
@@ -278,7 +288,7 @@ void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K)
}
- free(Q);
+ //free(Q);
free(BRi);
free(S_t);
free(StRi);
@@ -316,7 +326,7 @@ void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K)
/*inv(B'XB+R)*/
dmulma(B_t,no_of_inputs,no_of_states,X,no_of_states,no_of_states,buf3);
- dmulma(buf3,no_of_inputs,no_of_states,B_t,no_of_states,no_of_inputs,buf6);
+ dmulma(buf3,no_of_inputs,no_of_states,B,no_of_states,no_of_inputs,buf6);
dadda(buf6,no_of_inputs*no_of_inputs,R,no_of_inputs*no_of_inputs,buf5);
dinverma(buf5,buf6,no_of_inputs);
/*B'XA+S*/
@@ -333,14 +343,14 @@ void dlqra(double* sys, int sys_rows, int sys_cols, double* X, double* K)
free(A);
free(B);
- free(R);
+ //free(R);
free(buf5);
free(buf6);
}
free(B_t);
- free(S);
+ //free(S);
free(wsmall);
free(X12);
free(phi12);
diff --git a/src/c/elementaryFunctions/includes/sec.h b/src/c/elementaryFunctions/includes/sec.h
index 9606158..a04c5f7 100644
--- a/src/c/elementaryFunctions/includes/sec.h
+++ b/src/c/elementaryFunctions/includes/sec.h
@@ -14,7 +14,7 @@
#include "dynlib_elementaryfunctions.h"
#include "floatComplex.h"
#include "doubleComplex.h"
-#include <complex.h>
+//#include <complex.h>
#include "types.h"
#ifdef __cplusplus
diff --git a/src/c/scilab-arduino/cmd_analog_in_volt/u8cmd_analog_in_volts.c b/src/c/scilab-arduino/cmd_analog_in_volt/u8cmd_analog_in_volts.c
new file mode 100644
index 0000000..7018df2
--- /dev/null
+++ b/src/c/scilab-arduino/cmd_analog_in_volt/u8cmd_analog_in_volts.c
@@ -0,0 +1,22 @@
+/* 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
+*/
+
+#include "cmd_analog_in_volt.h"
+#include "Arduino.h"
+
+float u8cmd_analog_in_volts(uint8 board_no, uint8 pin)
+{
+ float a;
+ a = ((5*(float)analogRead(pin))/1023);
+ return(a);
+}
+
diff --git a/src/c/scilab-arduino/cmd_analog_out_volt/u8cmd_analog_out_volts.c b/src/c/scilab-arduino/cmd_analog_out_volt/u8cmd_analog_out_volts.c
new file mode 100644
index 0000000..2dd82e4
--- /dev/null
+++ b/src/c/scilab-arduino/cmd_analog_out_volt/u8cmd_analog_out_volts.c
@@ -0,0 +1,22 @@
+/* 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
+*/
+
+#include "cmd_analog_out_volt.h"
+#include "Arduino.h"
+
+void u8cmd_analog_out_volts(uint8 board_no, uint8 pin, float value)
+{
+ int a;
+ a = ((value*255)/5);
+ analogWrite(pin,a);
+
+}
diff --git a/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c b/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c
new file mode 100644
index 0000000..349bcb1
--- /dev/null
+++ b/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c
@@ -0,0 +1,29 @@
+/* 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
+*/
+
+#include "cmd_dcmotor_release.h"
+#include "Arduino.h"
+
+void u8cmd_dcmotor_releases(uint8 board_no, uint8 motor_no)
+{
+ if (dcm_mode[motor_no] == 3)
+ {
+ analogWrite(dcm_pin_1[motor_no],0);
+ analogWrite(dcm_pin_2[motor_no],0);
+ }
+
+ else
+ {
+ digitalWrite(dcm_pin_1[motor_no],LOW);
+ digitalWrite(dcm_pin_2[motor_no],LOW);
+ }
+}
diff --git a/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c b/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c
index 6e1c2ca..e8fa8b3 100644
--- a/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c
+++ b/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c
@@ -6,6 +6,7 @@
are also available at
http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
Author: Siddhesh Wani
+ Revised by: Yash Pratap Singh Tomar
Organization: FOSSEE, IIT Bombay
Email: toolbox@scilab.in
*/
diff --git a/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c b/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c
index 389f911..0d04e74 100644
--- a/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c
+++ b/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c
@@ -6,6 +6,7 @@
are also available at
http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
Author: Siddhesh Wani
+ Revised by: Yash Pratap Singh Tomar
Organization: FOSSEE, IIT Bombay
Email: toolbox@scilab.in
*/
diff --git a/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp b/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp
new file mode 100644
index 0000000..adc1a6e
--- /dev/null
+++ b/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp
@@ -0,0 +1,10 @@
+#include "cmd_i2c_dev.h"
+#include "Arduino.h"
+#include "Wire.h"
+
+
+uint8 u8cmd_i2c_devs(uint8 address)
+{
+ Wire.begin();
+ return((uint8)address);
+}
diff --git a/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp b/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp
new file mode 100644
index 0000000..8f02a87
--- /dev/null
+++ b/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp
@@ -0,0 +1,18 @@
+#include "cmd_i2c_read.h"
+#include "Arduino.h"
+#include "Wire.h"
+
+float u8cmd_i2c_reads(uint8 address, uint8 bytes)
+{
+
+ float c; //variable declaration to save received data
+
+ // request reading from sensor
+ Wire.requestFrom(address, bytes); // request no. of bytes(given) from slave device with address
+
+ // receive reading from sensor
+ while (Wire.available()) //If data is received
+ c = Wire.read(); //Save received data in variable
+ return(c);
+
+}
diff --git a/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp b/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp
new file mode 100644
index 0000000..0a2ec2e
--- /dev/null
+++ b/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp
@@ -0,0 +1,26 @@
+#include "cmd_i2c_read_register.h"
+#include "Arduino.h"
+#include "Wire.h"
+
+uint16 u8cmd_i2c_read_registers(uint8 address, uint8 reg_adrs)
+{
+ long int reading;
+
+ Wire.beginTransmission(address); // transmit to device address
+ Wire.write(reg_adrs); // sets register pointer to reg_adrs position
+ Wire.endTransmission(); // stop transmitting
+
+ // request reading from sensor
+ Wire.requestFrom(address, 2); // request 2 bytes from slave device with address
+
+ // receive reading from sensor
+ if (2 <= Wire.available()) // if two bytes were received
+ {
+ reading = Wire.read(); // receive high byte (overwrites previous reading)
+ reading = reading << 8; // shift high byte to be high 8 bits
+ reading |= Wire.read(); // receive low byte as lower 8 bits
+ }
+
+ return(reading);
+
+}
diff --git a/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp b/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp
new file mode 100644
index 0000000..0239097
--- /dev/null
+++ b/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp
@@ -0,0 +1,13 @@
+#include "cmd_i2c_write.h"
+#include "Arduino.h"
+#include "Wire.h"
+
+void u8cmd_i2c_writes(uint8 address, uint8 data)
+{
+
+ Wire.beginTransmission(address); //Begins transmission to the device connected to given address
+ Wire.write(data); //sends data to slave device
+ Wire.endTransmission(); //Transmission ends
+
+}
+
diff --git a/src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp b/src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp
new file mode 100644
index 0000000..63cc7c7
--- /dev/null
+++ b/src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp
@@ -0,0 +1,16 @@
+#include "cmd_i2c_write_register.h"
+#include "Arduino.h"
+#include "Wire.h"
+
+void u8cmd_i2c_write_registers(uint8 address, uint8 reg_adrs, uint8 data)
+{
+
+
+ Wire.beginTransmission(address); //Begins transmission to the device connected to given address
+ Wire.write(reg_adrs); //sets register pointer to reg_adrs position
+ Wire.write(data); //writes given data on reg_adrs position
+ Wire.endTransmission(); //Transmission ends
+
+
+}
+
diff --git a/src/c/scilab-arduino/includes/cmd_analog_in_volt.h b/src/c/scilab-arduino/includes/cmd_analog_in_volt.h
new file mode 100644
index 0000000..ec47142
--- /dev/null
+++ b/src/c/scilab-arduino/includes/cmd_analog_in_volt.h
@@ -0,0 +1,28 @@
+/* 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_ANALOG_IN_VOLT_H__
+#define __CMD_ANALOG_IN_VOLT_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+float u8cmd_analog_in_volts(uint8 board_no, uint8 pin);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __CMD_ANALOG_IN_VOLT_H__ */
diff --git a/src/c/scilab-arduino/includes/cmd_analog_out_volt.h b/src/c/scilab-arduino/includes/cmd_analog_out_volt.h
new file mode 100644
index 0000000..51580fb
--- /dev/null
+++ b/src/c/scilab-arduino/includes/cmd_analog_out_volt.h
@@ -0,0 +1,27 @@
+/* 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_ANALOG_OUT_VOLT_H__
+#define __CMD_ANALOG_OUT_VOLT_H__
+
+#include "types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void u8cmd_analog_out_volts(uint8 board_no, uint8 pin, float value);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __CMD_ANALOG_OUT_VOLT_H__ */
diff --git a/src/c/scilab-arduino/includes/cmd_dcmotor_release.h b/src/c/scilab-arduino/includes/cmd_dcmotor_release.h
new file mode 100644
index 0000000..d185fb5
--- /dev/null
+++ b/src/c/scilab-arduino/includes/cmd_dcmotor_release.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: Yash Pratap Singh Tomar
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#ifndef __CMD_DCMOTOR_RELEASE_H__
+#define __CMD_DCMOTOR_RELEASE_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern uint8 dcm_pin_1[4], dcm_pin_2[4], dcm_mode[4];
+
+void u8cmd_dcmotor_releases(uint8 board_no, uint8 motor_no);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __CMD_DCMOTOR_RELEASE_H__ */
diff --git a/src/c/scilab-arduino/includes/cmd_dcmotor_run.h b/src/c/scilab-arduino/includes/cmd_dcmotor_run.h
index 2b69c99..1b5d41c 100644
--- a/src/c/scilab-arduino/includes/cmd_dcmotor_run.h
+++ b/src/c/scilab-arduino/includes/cmd_dcmotor_run.h
@@ -22,7 +22,7 @@ extern "C" {
extern uint8 dcm_pin_1[4], dcm_pin_2[4], dcm_mode[4];
-void u8cmd_dc_motor_runs(uint8 board_no, uint8 motor_no, int16 duty);
+void u8cmd_dcmotor_runs(uint8 board_no, uint8 motor_no, int16 duty);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h b/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h
index cecd465..45854ff 100644
--- a/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h
+++ b/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h
@@ -22,7 +22,7 @@ extern "C" {
extern uint8 dcm_pin_1[4], dcm_pin_2[4], dcm_mode[4];
-void u8cmd_dc_motor_setups(uint8 board_no, uint8 driver_type, uint8 motor_no,\
+void u8cmd_dcmotor_setups(uint8 board_no, uint8 driver_type, uint8 motor_no,\
uint8 pin_1, uint8 pin_2);
#ifdef __cplusplus
diff --git a/src/c/scilab-arduino/includes/cmd_i2c_dev.h b/src/c/scilab-arduino/includes/cmd_i2c_dev.h
new file mode 100644
index 0000000..861a8e7
--- /dev/null
+++ b/src/c/scilab-arduino/includes/cmd_i2c_dev.h
@@ -0,0 +1,16 @@
+#ifndef __CMD_I2C_DEV_H__
+#define __CMD_I2C_DEV_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint8 u8cmd_i2c_devs(uint8 address);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __CMD_I2C_DEV_H__ */
diff --git a/src/c/scilab-arduino/includes/cmd_i2c_read.h b/src/c/scilab-arduino/includes/cmd_i2c_read.h
new file mode 100644
index 0000000..791bdd3
--- /dev/null
+++ b/src/c/scilab-arduino/includes/cmd_i2c_read.h
@@ -0,0 +1,16 @@
+#ifndef __CMD_I2C_READ_H__
+#define __CMD_I2C_READ_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+float u8cmd_i2c_reads(uint8 address, uint8 bytes);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __CMD_I2C_READ_H__ */
diff --git a/src/c/scilab-arduino/includes/cmd_i2c_read_register.h b/src/c/scilab-arduino/includes/cmd_i2c_read_register.h
new file mode 100644
index 0000000..ea203ad
--- /dev/null
+++ b/src/c/scilab-arduino/includes/cmd_i2c_read_register.h
@@ -0,0 +1,16 @@
+#ifndef __CMD_I2C_READ_REGISTER_H__
+#define __CMD_I2C_READ_REGISTER_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint16 u8cmd_i2c_read_registers(uint8 address, uint8 reg_adrs);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __CMD_I2C_READ_REGISTER_H__ */
diff --git a/src/c/scilab-arduino/includes/cmd_i2c_write.h b/src/c/scilab-arduino/includes/cmd_i2c_write.h
new file mode 100644
index 0000000..6a57222
--- /dev/null
+++ b/src/c/scilab-arduino/includes/cmd_i2c_write.h
@@ -0,0 +1,16 @@
+#ifndef __CMD_I2C_WRITE_H__
+#define __CMD_I2C_WRITE_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void u8cmd_i2c_writes(uint8 address, uint8 data);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __CMD_I2C_WRITE_H__ */
diff --git a/src/c/scilab-arduino/includes/cmd_i2c_write_register.h b/src/c/scilab-arduino/includes/cmd_i2c_write_register.h
new file mode 100644
index 0000000..ff1b9ec
--- /dev/null
+++ b/src/c/scilab-arduino/includes/cmd_i2c_write_register.h
@@ -0,0 +1,16 @@
+#ifndef __CMD_I2C_WRITE_REGISTER_H__
+#define __CMD_I2C_WRITE_REGISTER_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void u8cmd_i2c_write_registers(uint8 address, uint8 reg_adrs, uint8 data);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __CMD_I2C_WRITE_REGISTER_H__ */
diff --git a/src/c/scilab-arduino/interfaces/int_cmd_analog_in_volt.h b/src/c/scilab-arduino/interfaces/int_cmd_analog_in_volt.h
new file mode 100644
index 0000000..e8fe65d
--- /dev/null
+++ b/src/c/scilab-arduino/interfaces/int_cmd_analog_in_volt.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: Yash Pratap Singh Tomar
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#ifndef __INT_CMD_ANALOG_IN_VOLT_H__
+#define __INT_CMD_ANALOG_IN_VOLT_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0d0cmd_analog_in_volts0(in1,in2) u8cmd_analog_in_volts((uint8)in1,(uint8)in2)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __INT_CMD_ANALOG_IN_VOLT_H__ */
diff --git a/src/c/scilab-arduino/interfaces/int_cmd_analog_out_volt.h b/src/c/scilab-arduino/interfaces/int_cmd_analog_out_volt.h
new file mode 100644
index 0000000..283f8fa
--- /dev/null
+++ b/src/c/scilab-arduino/interfaces/int_cmd_analog_out_volt.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: Yash Pratap Singh Tomar
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#ifndef __INT_CMD_ANALOG_OUT_VOLT_H__
+#define __INT_CMD_ANALOG_OUT_VOLT_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0d0d0cmd_analog_out_volt(in1,in2,in3) u8cmd_analog_out_volts((uint8)in1,(uint8)in2,(float)in3)
+
+#define d0d0s0cmd_analog_out_volt(in1,in2,in3) u8cmd_analog_out_volts((uint8)in1,(uint8)in2,(float)in3)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __INT_CMD_ANALOG_OUT_VOLT_H__ */
diff --git a/src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h b/src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h
index 61e0d2e..d465ff6 100644
--- a/src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h
+++ b/src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h
@@ -6,6 +6,7 @@
are also available at
http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
Author: Siddhesh Wani
+ Revised by: Yash Pratap Singh Tomar
Organization: FOSSEE, IIT Bombay
Email: toolbox@scilab.in
*/
@@ -20,16 +21,16 @@
extern "C" {
#endif
-#define d0d0d0d0d0cmd_dcmotor_setup(in1,in2,in3,in4,in5)\
- u8cmd_dcmotor_setups((uint8)in1,(uint8)in2,(uint8)in3,\
- (uint8)in4,(uint8)in5)
+#define d0d0d0d0d0cmd_dcmotor_setup(in1,in2,in3,in4,in5) u8cmd_dcmotor_setups((uint8)in1,(uint8)in2,(uint8)in3,(uint8)in4,(uint8)in5)
#define d0d0d0cmd_dcmotor_run(in1,in2,in3) u8cmd_dcmotor_runs((uint8)in1,\
(uint8)in2, (int16)in3);
#define d0d0u160cmd_dcmotor_run(in1,in2,in3) u8cmd_dcmotor_runs((uint8)in1,\
- (uint8)in2, (int16)in3);
+ (uint8)in2, (int16)in3);
+
+#define d0d0cmd_dcmotor_release(in1,in2) u8cmd_dcmotor_releases((uint8)in1,(uint8)in2)
#ifdef __cplusplus
diff --git a/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h
new file mode 100644
index 0000000..c4d93d7
--- /dev/null
+++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h
@@ -0,0 +1,17 @@
+#ifndef __INT_CMD_I2C_DEV_H__
+#define __INT_CMD_I2C_DEV_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0cmd_i2c_devu80(in1) u8cmd_i2c_devs((uint8)in1)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __INT_CMD_I2C_DEV_H__ */
diff --git a/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h
new file mode 100644
index 0000000..b0633a0
--- /dev/null
+++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h
@@ -0,0 +1,19 @@
+#ifndef __INT_CMD_I2C_READ_H__
+#define __INT_CMD_I2C_READ_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0d0cmd_i2c_reads0(in1, in2) u8cmd_i2c_reads((uint8)in1, (uint8)in2)
+
+#define u80d0cmd_i2c_reads0(in1, in2) u8cmd_i2c_reads((uint8)in1, (uint8)in2)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __INT_CMD_I2C_READ_H__ */
diff --git a/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h
new file mode 100644
index 0000000..5f4c529
--- /dev/null
+++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h
@@ -0,0 +1,18 @@
+#ifndef __INT_CMD_I2C_READ_REGISTER_H__
+#define __INT_CMD_I2C_READ_REGISTER_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0d0cmd_i2c_read_registeru160(in1, in2) u8cmd_i2c_read_registers((uint8)in1, (uint8)in2)
+
+#define u80d0cmd_i2c_read_registeru160(in1, in2) u8cmd_i2c_read_registers((uint8)in1, (uint8)in2)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __INT_CMD_I2C_READ_REGISTER_H__ */
diff --git a/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h
new file mode 100644
index 0000000..a7705a8
--- /dev/null
+++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h
@@ -0,0 +1,20 @@
+#ifndef __INT_CMD_I2C_WRITE_H__
+#define __INT_CMD_I2C_WRITE_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0d0cmd_i2c_write(in1, in2) u8cmd_i2c_writes((uint8)in1, (uint8)in2)
+
+#define u80d0cmd_i2c_write(in1, in2) u8cmd_i2c_writes((uint8)in1, (uint8)in2)
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __INT_CMD_I2C_WRITE_H__ */
diff --git a/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h
new file mode 100644
index 0000000..35c0527
--- /dev/null
+++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h
@@ -0,0 +1,19 @@
+#ifndef __INT_CMD_I2C_WRITE_REGISTER_H__
+#define __INT_CMD_I2C_WRITE_REGISTER_H__
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d0d0d0cmd_i2c_write_register(in1, in2, in3) u8cmd_i2c_write_registers((uint8)in1, (uint8)in2, (uint8)in3)
+
+#define u80d0d0cmd_i2c_write_register(in1, in2, in3) u8cmd_i2c_write_registers((uint8)in1, (uint8)in2, (uint8)in3)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __INT_CMD_I2C_WRITE_REGISTER_H__ */
diff --git a/src/c/scilab-arduino/sleep/u16sleeps.c b/src/c/scilab-arduino/sleep/u16sleeps.c
index 88f8a66..3045978 100644
--- a/src/c/scilab-arduino/sleep/u16sleeps.c
+++ b/src/c/scilab-arduino/sleep/u16sleeps.c
@@ -6,11 +6,13 @@
are also available at
http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
Author: Siddhesh Wani
+ Revised by: Yash Pratap Singh Tomar
Organization: FOSSEE, IIT Bombay
Email: toolbox@scilab.in
*/
#include "sleep.h"
+#include "Arduino.h"
void u16sleeps(uint16 delay_ms)
{