From 3f52712f806fbd80d66dfdcaff401e5cf94dcca4 Mon Sep 17 00:00:00 2001 From: yash1112 Date: Fri, 7 Jul 2017 21:20:49 +0530 Subject: sci2c arduino updated --- .../cmd_analog_in/u8cmd_analog_ins.c | 20 +++++++ .../cmd_analog_in_volt/u8cmd_analog_in_volts.c | 22 ++++++++ .../cmd_analog_out/u8cmd_analog_outs.c | 21 +++++++ .../cmd_analog_out_volt/u8cmd_analog_out_volts.c | 22 ++++++++ .../cmd_dcmotor_release/u8cmd_dcmotor_releases.c | 29 ++++++++++ .../cmd_dcmotor_run/u8cmd_dcmotor_runs.c | 60 ++++++++++++++++++++ .../cmd_dcmotor_setup/u8cmd_dcmotor_setups.c | 43 ++++++++++++++ .../cmd_digital_in/u8cmd_digital_ins.c | 20 +++++++ .../cmd_digital_out/u8cmd_digital_outs.c | 22 ++++++++ .../scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp | 23 ++++++++ .../cmd_i2c_read/u8cmd_i2c_reads.cpp | 32 +++++++++++ .../u8cmd_i2c_read_registers.cpp | 40 +++++++++++++ .../cmd_i2c_write/u8cmd_i2c_writes.cpp | 26 +++++++++ .../u8cmd_i2c_write_registers.cpp | 30 ++++++++++ .../cmd_servo_attach/u8cmd_servo_attachs.cpp | 32 +++++++++++ .../cmd_servo_detach/u8cmd_servo_detachs.cpp | 32 +++++++++++ .../cmd_servo_move/u8cmd_servo_moves.cpp | 34 +++++++++++ src/c/scilab-arduino/default_files/Makefile | 10 ++++ .../scilab-arduino/default_files/sci2c_arduino.ino | 26 +++++++++ src/c/scilab-arduino/default_files/setup_arduino.h | 65 ++++++++++++++++++++++ src/c/scilab-arduino/includes/cmd_analog_in.h | 29 ++++++++++ src/c/scilab-arduino/includes/cmd_analog_in_volt.h | 28 ++++++++++ src/c/scilab-arduino/includes/cmd_analog_out.h | 28 ++++++++++ .../scilab-arduino/includes/cmd_analog_out_volt.h | 27 +++++++++ .../scilab-arduino/includes/cmd_dcmotor_release.h | 30 ++++++++++ src/c/scilab-arduino/includes/cmd_dcmotor_run.h | 31 +++++++++++ src/c/scilab-arduino/includes/cmd_dcmotor_setup.h | 32 +++++++++++ src/c/scilab-arduino/includes/cmd_digital_in.h | 29 ++++++++++ src/c/scilab-arduino/includes/cmd_digital_out.h | 29 ++++++++++ src/c/scilab-arduino/includes/cmd_i2c_dev.h | 28 ++++++++++ src/c/scilab-arduino/includes/cmd_i2c_read.h | 28 ++++++++++ .../includes/cmd_i2c_read_register.h | 28 ++++++++++ src/c/scilab-arduino/includes/cmd_i2c_write.h | 28 ++++++++++ .../includes/cmd_i2c_write_register.h | 28 ++++++++++ src/c/scilab-arduino/includes/cmd_servo_attach.h | 31 +++++++++++ src/c/scilab-arduino/includes/cmd_servo_detach.h | 32 +++++++++++ src/c/scilab-arduino/includes/cmd_servo_move.h | 32 +++++++++++ src/c/scilab-arduino/includes/sleep.h | 28 ++++++++++ .../scilab-arduino/interfaces/int_cmd_analog_in.h | 30 ++++++++++ .../interfaces/int_cmd_analog_in_volt.h | 30 ++++++++++ .../scilab-arduino/interfaces/int_cmd_analog_out.h | 33 +++++++++++ .../interfaces/int_cmd_analog_out_volt.h | 30 ++++++++++ src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h | 40 +++++++++++++ .../scilab-arduino/interfaces/int_cmd_digital_in.h | 30 ++++++++++ .../interfaces/int_cmd_digital_out.h | 35 ++++++++++++ src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h | 29 ++++++++++ src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h | 31 +++++++++++ .../interfaces/int_cmd_i2c_read_register.h | 30 ++++++++++ .../scilab-arduino/interfaces/int_cmd_i2c_write.h | 32 +++++++++++ .../interfaces/int_cmd_i2c_write_register.h | 31 +++++++++++ src/c/scilab-arduino/interfaces/int_cmd_servo.h | 35 ++++++++++++ src/c/scilab-arduino/interfaces/int_sleep.h | 29 ++++++++++ src/c/scilab-arduino/sleep/u16sleeps.c | 21 +++++++ 53 files changed, 1601 insertions(+) create mode 100644 src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c create mode 100644 src/c/scilab-arduino/cmd_analog_in_volt/u8cmd_analog_in_volts.c create mode 100644 src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c create mode 100644 src/c/scilab-arduino/cmd_analog_out_volt/u8cmd_analog_out_volts.c create mode 100644 src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c create mode 100644 src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c create mode 100644 src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c create mode 100644 src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c create mode 100644 src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c create mode 100644 src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp create mode 100644 src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp create mode 100644 src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp create mode 100644 src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp create mode 100644 src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp create mode 100644 src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attachs.cpp create mode 100644 src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detachs.cpp create mode 100644 src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_moves.cpp create mode 100644 src/c/scilab-arduino/default_files/Makefile create mode 100644 src/c/scilab-arduino/default_files/sci2c_arduino.ino create mode 100644 src/c/scilab-arduino/default_files/setup_arduino.h create mode 100644 src/c/scilab-arduino/includes/cmd_analog_in.h create mode 100644 src/c/scilab-arduino/includes/cmd_analog_in_volt.h create mode 100644 src/c/scilab-arduino/includes/cmd_analog_out.h create mode 100644 src/c/scilab-arduino/includes/cmd_analog_out_volt.h create mode 100644 src/c/scilab-arduino/includes/cmd_dcmotor_release.h create mode 100644 src/c/scilab-arduino/includes/cmd_dcmotor_run.h create mode 100644 src/c/scilab-arduino/includes/cmd_dcmotor_setup.h create mode 100644 src/c/scilab-arduino/includes/cmd_digital_in.h create mode 100644 src/c/scilab-arduino/includes/cmd_digital_out.h create mode 100644 src/c/scilab-arduino/includes/cmd_i2c_dev.h create mode 100644 src/c/scilab-arduino/includes/cmd_i2c_read.h create mode 100644 src/c/scilab-arduino/includes/cmd_i2c_read_register.h create mode 100644 src/c/scilab-arduino/includes/cmd_i2c_write.h create mode 100644 src/c/scilab-arduino/includes/cmd_i2c_write_register.h create mode 100644 src/c/scilab-arduino/includes/cmd_servo_attach.h create mode 100644 src/c/scilab-arduino/includes/cmd_servo_detach.h create mode 100644 src/c/scilab-arduino/includes/cmd_servo_move.h create mode 100644 src/c/scilab-arduino/includes/sleep.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_analog_in.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_analog_in_volt.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_analog_out.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_analog_out_volt.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_digital_in.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_digital_out.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h create mode 100644 src/c/scilab-arduino/interfaces/int_cmd_servo.h create mode 100644 src/c/scilab-arduino/interfaces/int_sleep.h create mode 100644 src/c/scilab-arduino/sleep/u16sleeps.c (limited to 'src/c/scilab-arduino') diff --git a/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c b/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c new file mode 100644 index 0000000..42005d1 --- /dev/null +++ b/src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c @@ -0,0 +1,20 @@ +/* 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 +*/ + +#include "cmd_analog_in.h" +#include "Arduino.h" + +uint16 u8cmd_analog_ins(uint8 board_no, uint8 pin) +{ + return((uint16)analogRead(pin)); +} + 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..f961719 --- /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; //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/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c b/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c new file mode 100644 index 0000000..a5b8513 --- /dev/null +++ b/src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.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 +*/ + +#include "cmd_analog_out.h" +#include "Arduino.h" + +void u8cmd_analog_outs(uint8 board_no, uint8 pin, uint8 value) +{ + analogWrite(pin,value); + +} + 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..1d76b60 --- /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; //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/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..d56d12d --- /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) //for IC accepting analog value + { + analogWrite(dcm_pin_1[motor_no],0); //passing LOW to IC pins to stop the motor + analogWrite(dcm_pin_2[motor_no],0); + } + + else //for IC accepting digital value + { + digitalWrite(dcm_pin_1[motor_no],LOW); + digitalWrite(dcm_pin_2[motor_no],LOW); //passing LOW to IC pins to stop the motor + } +} 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 new file mode 100644 index 0000000..e8fa8b3 --- /dev/null +++ b/src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c @@ -0,0 +1,60 @@ +/* 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 + Revised by: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_dcmotor_run.h" +#include "Arduino.h" + +void u8cmd_dcmotor_runs(uint8 board_no, uint8 motor_no, int16 duty) +{ + uint8 direction = 1; + if(duty >= 0) + { + direction = 1; + } + else + { + direction = 0; + duty = -duty; + } + + if(duty > 255) duty = 255; + + if (dcm_mode[motor_no] == 3) //L293 + { + if(direction == 1) + { + analogWrite(dcm_pin_1[motor_no],duty); + analogWrite(dcm_pin_2[motor_no],0); + } + else + { + analogWrite(dcm_pin_2[motor_no],duty); + analogWrite(dcm_pin_1[motor_no],0); + } + } + else + { + if(direction == 1) + { + digitalWrite(dcm_pin_1[motor_no],HIGH); + digitalWrite(dcm_pin_2[motor_no],LOW); + } + else + { + digitalWrite(dcm_pin_2[motor_no],HIGH); + digitalWrite(dcm_pin_1[motor_no],LOW); + } + } + +} + 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 new file mode 100644 index 0000000..0d04e74 --- /dev/null +++ b/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c @@ -0,0 +1,43 @@ +/* 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 + Revised by: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_dcmotor_setup.h" +#include "Arduino.h" + +uint8 dcm_pin_1[4], dcm_pin_2[4], dcm_mode[4]; + +void u8cmd_dcmotor_setups(uint8 board_no, uint8 driver_type, uint8 motor_no,\ + uint8 pin_1, uint8 pin_2) +{ + dcm_pin_1[motor_no] = pin_1; + dcm_pin_2[motor_no] = pin_2; + dcm_mode[motor_no] = driver_type; + + //Initialise pins + pinMode(pin_1,OUTPUT); + pinMode(pin_2,OUTPUT); + + //Set output to low. + if(driver_type == 3) + { + analogWrite(pin_1,0); + analogWrite(pin_2,0); + } + else + { + digitalWrite(pin_1,LOW); + digitalWrite(pin_2,LOW); + } + +} + diff --git a/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c b/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c new file mode 100644 index 0000000..da5ca78 --- /dev/null +++ b/src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c @@ -0,0 +1,20 @@ +/* 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 +*/ + +#include "cmd_digital_in.h" +#include "Arduino.h" + +uint8 u8cmd_digital_ins(uint8 board_no, uint8 pin) +{ + return((uint8)digitalRead(pin)); +} + diff --git a/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c new file mode 100644 index 0000000..64af7b5 --- /dev/null +++ b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.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 +*/ + +#include "cmd_digital_out.h" +#include "Arduino.h" + + +void u8cmd_digital_outs(uint8 board_no, uint8 pin, uint8 value) +{ + digitalWrite(pin,value); + +} + 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..eb9ec10 --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp @@ -0,0 +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(); //To initiate connection + return((uint8)address); //Returns address to create a device object +} 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..24d36de --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp @@ -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: 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" + +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..fd07eb6 --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp @@ -0,0 +1,40 @@ +/* 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" + +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..b777225 --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp @@ -0,0 +1,26 @@ +/* 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" + +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..9e3c11c --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_write_register/u8cmd_i2c_write_registers.cpp @@ -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 +*/ + + +//This function writes to the register of the device +#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/cmd_servo_attach/u8cmd_servo_attachs.cpp b/src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attachs.cpp new file mode 100644 index 0000000..b4322c7 --- /dev/null +++ b/src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attachs.cpp @@ -0,0 +1,32 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ +#include "cmd_servo_attach.h" +#include "Arduino.h" +#include +Servo servo1,servo2; +void u8cmd_servo_attach(uint8 h,uint8 servo_no) +{ + // h -> Board no. reserve for future use + // servo_no -> pin no.(9 and 10). + if(servo_no == 1) + { + servo1.attach(9); + servo1.write(0); + } + else + { + servo2.attach(10); + servo2.write(0); + } + +} + diff --git a/src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detachs.cpp b/src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detachs.cpp new file mode 100644 index 0000000..08ea03f --- /dev/null +++ b/src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detachs.cpp @@ -0,0 +1,32 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_servo_detach.h" +#include "Arduino.h" +#include +Servo servo1,servo2; +void u8cmd_servo_detach(uint8 h,uint8 servo_no) +{ + // h -> Board no. reserve for future use + // servo_no -> pin no.(9 and 10). + if(servo_no == 1) + { + servo1.detach(); + } + + else + { + servo2.detach(); + } + +} + diff --git a/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_moves.cpp b/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_moves.cpp new file mode 100644 index 0000000..c7c6fa7 --- /dev/null +++ b/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_moves.cpp @@ -0,0 +1,34 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include "cmd_servo_move.h" +#include "Arduino.h" +#include +Servo servo1,servo2; +void u8cmd_servo_move(uint8 h,uint8 servo_no,uint8 val) +{ + // h -> Board no. reserve for future use + // servo_no -> pin no.(9 and 10). + //val -> 0 to 180 angle of rotation + if (val>=0 && val<=180) + { + if (servo_no==1) + { + servo1.write(val); + } + else if (servo_no==2) + { + servo2.write(val); + } + } +} + diff --git a/src/c/scilab-arduino/default_files/Makefile b/src/c/scilab-arduino/default_files/Makefile new file mode 100644 index 0000000..5432fcf --- /dev/null +++ b/src/c/scilab-arduino/default_files/Makefile @@ -0,0 +1,10 @@ +# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile + +ARDUINO_DIR = /usr/share/arduino +ARDMK_DIR = /usr/share/arduino +AVR_TOOLS_DIR = /usr +BOARD_TAG = uno +USER_LIB_PATH = ../ +ARDUINO_LIBS = ../src/c ../includes ../interfaces ../ +ARDUINO_PORT = /dev/ttyACM0 +include /usr/share/arduino/Arduino.mk diff --git a/src/c/scilab-arduino/default_files/sci2c_arduino.ino b/src/c/scilab-arduino/default_files/sci2c_arduino.ino new file mode 100644 index 0000000..1d4465b --- /dev/null +++ b/src/c/scilab-arduino/default_files/sci2c_arduino.ino @@ -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 +*/ + +#include "Arduino.h" +#include "loop_arduino.h" +#include "setup_arduino.h" + +void setup() +{ + //Please write appropriate setup functions here. + setup_arduino(); +} + +void loop() +{ + loop_arduino(); +} diff --git a/src/c/scilab-arduino/default_files/setup_arduino.h b/src/c/scilab-arduino/default_files/setup_arduino.h new file mode 100644 index 0000000..acbf8e2 --- /dev/null +++ b/src/c/scilab-arduino/default_files/setup_arduino.h @@ -0,0 +1,65 @@ +/* +** ************************************************ +** This file has been generated using +** Scilab2C (Version 2.3) +** +** Please visit following links for more informations: +** Atoms Module: http://atoms.scilab.org/toolboxes/scilab2c +** Scilab2C Forge: http://forge.scilab.org/index.php/p/scilab2c/ +** Scilab2C ML: http://forge.scilab.org/index.php/p/scilab2c/ +** ************************************************ +*/ + + +#ifndef setup_arduino_h +#define setup_arduino_h +/* +** ------------------- +** ----- Target ------ +** ------------------- +*/ +# define Arduino1 1 +/* +** ----------------------- +** --- SCI2C Includes. --- +** ----------------------- +*/ +#include "Arduino.h" +#include "sci2clib.h" +/* +** --------------------------- +** --- End SCI2C Includes. --- +** --------------------------- +*/ + + +#ifdef __cplusplus +extern "C" { +#endif +/* +** ------------------- +** --- Prototypes. --- +** ------------------- +*/ +int setup_arduino(); +/* +** ----------------------- +** --- End Prototypes. --- +** ----------------------- +*/ + + +/* +** ------------------------ +** --- USER2C Includes. --- +** ------------------------ +*/ +/* +** ---------------------------- +** --- End USER2C Includes. --- +** ---------------------------- +*/ +#ifdef __cplusplus +} /* extern "C" */ +#endif +#endif diff --git a/src/c/scilab-arduino/includes/cmd_analog_in.h b/src/c/scilab-arduino/includes/cmd_analog_in.h new file mode 100644 index 0000000..0c18656 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_analog_in.h @@ -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 +*/ + + +#ifndef __CMD_ANALOG_IN_H__ +#define __CMD_ANALOG_IN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint16 u8cmd_analog_ins(uint8 board_no, uint8 pin); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_ANALOG_IN_H__ */ 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.h b/src/c/scilab-arduino/includes/cmd_analog_out.h new file mode 100644 index 0000000..54e51f5 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_analog_out.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 __CMD_ANALOG_OUT_H__ +#define __CMD_ANALOG_OUT_H__ + +#include "types.h" +#ifdef __cplusplus +extern "C" { +#endif + +void u8cmd_analog_outs(uint8 board_no, uint8 pin, uint8 value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_ANALOG_OUT_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 new file mode 100644 index 0000000..1b5d41c --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_dcmotor_run.h @@ -0,0 +1,31 @@ +/* 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 __CMD_DCMOTOR_RUN_H__ +#define __CMD_DCMOTOR_RUN_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_runs(uint8 board_no, uint8 motor_no, int16 duty); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h b/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h new file mode 100644 index 0000000..45854ff --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_dcmotor_setup.h @@ -0,0 +1,32 @@ +/* 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 __CMD_DCMOTOR_SETUP_H__ +#define __CMD_DCMOTOR_SETUP_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_setups(uint8 board_no, uint8 driver_type, uint8 motor_no,\ + uint8 pin_1, uint8 pin_2); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_digital_in.h b/src/c/scilab-arduino/includes/cmd_digital_in.h new file mode 100644 index 0000000..51226a6 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_digital_in.h @@ -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 +*/ + + +#ifndef __CMD_DIGITAL_IN_H__ +#define __CMD_DIGITAL_IN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 u8cmd_digital_ins(uint8 board_no, uint8 pin); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DIGITAL_IN_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_digital_out.h b/src/c/scilab-arduino/includes/cmd_digital_out.h new file mode 100644 index 0000000..1e837e5 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_digital_out.h @@ -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 +*/ + + +#ifndef __CMD_DIGITAL_OUT_H__ +#define __CMD_DIGITAL_OUT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void u8cmd_digital_outs(uint8 board_no, uint8 pin, uint8 value); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DIGITAL_OUT_H__ */ 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..382c2b3 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_dev.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_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..e33ede3 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_read.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_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..50fba93 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_read_register.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_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..128f1af --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_write.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_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..7fac4cb --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_i2c_write_register.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_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/includes/cmd_servo_attach.h b/src/c/scilab-arduino/includes/cmd_servo_attach.h new file mode 100644 index 0000000..12c2c01 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_servo_attach.h @@ -0,0 +1,31 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CMD_SERVO_ATTACH_H__ +#define __CMD_SERVO_ATTACH_H__ + +#include "types.h" +//#include +#ifdef __cplusplus +extern "C" { +#endif + +extern Servo servo1,servo2; + +void u8cmd_servo_attach(uint8 h, uint8 servo_no ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_servo_detach.h b/src/c/scilab-arduino/includes/cmd_servo_detach.h new file mode 100644 index 0000000..daa5fd2 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_servo_detach.h @@ -0,0 +1,32 @@ +/* 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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __CMD_SERVO_DETACH_H__ +#define __CMD_SERVO_DETACH_H__ + +#include "types.h" +//#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern Servo servo1,servo2; + +void u8cmd_servo_detach(uint8 h, uint8 servo_no ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/src/c/scilab-arduino/includes/cmd_servo_move.h b/src/c/scilab-arduino/includes/cmd_servo_move.h new file mode 100644 index 0000000..79c16b4 --- /dev/null +++ b/src/c/scilab-arduino/includes/cmd_servo_move.h @@ -0,0 +1,32 @@ +/* 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 __CMD_SERVO_MOVE_H__ +#define __CMD_SERVO_MOVE_H__ + +#include "types.h" +//#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern Servo servo1,servo2; + +void u8cmd_servo_move(uint8 h, uint8 servo_no,uint8 val); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DCMOTOR_SETUP_H__ */ diff --git a/src/c/scilab-arduino/includes/sleep.h b/src/c/scilab-arduino/includes/sleep.h new file mode 100644 index 0000000..8763f5f --- /dev/null +++ b/src/c/scilab-arduino/includes/sleep.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 __SLEEP_H__ +#define __SLEEP_H__ + +#include "types.h" +#ifdef __cplusplus +extern "C" { +#endif + +void u16sleeps(uint16 delay_ms); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CMD_DIGITAL_OUT_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_analog_in.h b/src/c/scilab-arduino/interfaces/int_cmd_analog_in.h new file mode 100644 index 0000000..7358509 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_analog_in.h @@ -0,0 +1,30 @@ +/* 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_CMD_ANALOG_IN_H__ +#define __INT_CMD_ANALOG_IN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0cmd_analog_inu160(in1,in2) u8cmd_analog_ins((uint8)in1,\ + (uint8)in2) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_ANALOG_IN_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.h b/src/c/scilab-arduino/interfaces/int_cmd_analog_out.h new file mode 100644 index 0000000..80ed7ab --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_analog_out.h @@ -0,0 +1,33 @@ +/* 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_CMD_ANALOG_OUT_H__ +#define __INT_CMD_ANALOG_OUT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0d0cmd_analog_out(in1,in2,in3) u8cmd_analog_outs((uint8)in1,\ + (uint8)in2,(uint8)in3) + +#define d0d0u80cmd_analog_out(in1,in2,in3) u8cmd_analog_outs((uint8)in1,\ + (uint8)in2,(uint8)in3) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DIGITAL_OUT_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 new file mode 100644 index 0000000..d465ff6 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h @@ -0,0 +1,40 @@ +/* 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 + Revised by: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __INT_CMD_DCMOTOR_H__ +#define __INT_CMD_DCMOTOR_H__ + +#include "types.h" + +#ifdef __cplusplus +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 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); + +#define d0d0cmd_dcmotor_release(in1,in2) u8cmd_dcmotor_releases((uint8)in1,(uint8)in2) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DCMOTOR_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_digital_in.h b/src/c/scilab-arduino/interfaces/int_cmd_digital_in.h new file mode 100644 index 0000000..4e5e575 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_digital_in.h @@ -0,0 +1,30 @@ +/* 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_CMD_DIGITAL_IN_H__ +#define __INT_CMD_DIGITAL_IN_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0cmd_digital_inu80(in1,in2) u8cmd_digital_ins((uint8)in1,\ + (uint8)in2) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DIGITAL_IN_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h b/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h new file mode 100644 index 0000000..92a92c6 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h @@ -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 +*/ + + +#ifndef __INT_CMD_DIGITAL_OUT_H__ +#define __INT_CMD_DIGITAL_OUT_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0d0cmd_digital_out(in1,in2,in3) u8cmd_digital_outs((uint8)in1,\ + (uint8)in2,(uint8)in3) + +//Required when input from one pin is directed to other output pin. +#define d0d0u80cmd_digital_out(in1,in2,in3) u8cmd_digital_outs((uint8)in1,\ + (uint8)in2, (uint8)in3) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DIGITAL_OUT_H__ */ 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..85f3e3c --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h @@ -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 +*/ + +#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..6ffd7ec --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h @@ -0,0 +1,31 @@ +/* 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__ + +#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..e848b69 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.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_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..3a01593 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.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: Yash Pratap Singh Tomar + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#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..78a3382 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h @@ -0,0 +1,31 @@ +/* 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__ + +#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/interfaces/int_cmd_servo.h b/src/c/scilab-arduino/interfaces/int_cmd_servo.h new file mode 100644 index 0000000..a431fe1 --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_cmd_servo.h @@ -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: Mushir + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#ifndef __INT_CMD_SERVO_H__ +#define __INT_CMD_SERVO_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define d0d0cmd_servo_attach(in1,in2) u8cmd_servo_attach((uint8)in1,(uint8)in2); + +#define d0d0cmd_servo_detach(in1,in2) u8cmd_servo_detach((uint8)in1,(uint8)in2); + +#define d0d0d0cmd_servo_move(in1,in2,in3) u8cmd_servo_move((uint8)in1,(uint8)in2,(uint8)in3); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_CMD_DCMOTOR_H__ */ diff --git a/src/c/scilab-arduino/interfaces/int_sleep.h b/src/c/scilab-arduino/interfaces/int_sleep.h new file mode 100644 index 0000000..f3a697f --- /dev/null +++ b/src/c/scilab-arduino/interfaces/int_sleep.h @@ -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 +*/ + + +#ifndef __INT_SLEEP_H__ +#define __INT_sLEEP_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0sleep(in1) u16sleeps((uint16)in1) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_SLEEP_H__ */ diff --git a/src/c/scilab-arduino/sleep/u16sleeps.c b/src/c/scilab-arduino/sleep/u16sleeps.c new file mode 100644 index 0000000..3045978 --- /dev/null +++ b/src/c/scilab-arduino/sleep/u16sleeps.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 + 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) +{ + delay(delay_ms); +} + -- cgit From bd03b38be0918837e147e969c6bb2014900009db Mon Sep 17 00:00:00 2001 From: Brijeshcr Date: Sat, 8 Jul 2017 20:18:17 +0530 Subject: Revert "SCi2cDeps updated, Windows compatibility resolved" --- .../cmd_analog_in_volt/u8cmd_analog_in_volts.c | 5 ----- .../cmd_analog_out_volt/u8cmd_analog_out_volts.c | 6 ------ .../cmd_dcmotor_release/u8cmd_dcmotor_releases.c | 13 ------------ .../scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp | 24 ---------------------- .../cmd_i2c_read/u8cmd_i2c_reads.cpp | 17 --------------- .../u8cmd_i2c_read_registers.cpp | 17 --------------- .../cmd_i2c_write/u8cmd_i2c_writes.cpp | 16 --------------- .../u8cmd_i2c_write_registers.cpp | 17 --------------- .../scilab-arduino/default_files/sci2c_arduino.ino | 5 ----- src/c/scilab-arduino/includes/cmd_i2c_dev.h | 15 -------------- src/c/scilab-arduino/includes/cmd_i2c_read.h | 15 -------------- .../includes/cmd_i2c_read_register.h | 15 -------------- src/c/scilab-arduino/includes/cmd_i2c_write.h | 15 -------------- .../includes/cmd_i2c_write_register.h | 15 -------------- src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h | 15 -------------- src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h | 15 -------------- .../interfaces/int_cmd_i2c_read_register.h | 15 -------------- .../scilab-arduino/interfaces/int_cmd_i2c_write.h | 15 -------------- .../interfaces/int_cmd_i2c_write_register.h | 15 -------------- 19 files changed, 270 deletions(-) (limited to 'src/c/scilab-arduino') 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 index 27f63c7..7018df2 100644 --- 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 @@ -15,13 +15,8 @@ float u8cmd_analog_in_volts(uint8 board_no, uint8 pin) { -<<<<<<< HEAD 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 ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 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 index 19a73fc..2dd82e4 100644 --- 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 @@ -15,14 +15,8 @@ void u8cmd_analog_out_volts(uint8 board_no, uint8 pin, float value) { -<<<<<<< HEAD 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 ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 } 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 index a228303..349bcb1 100644 --- a/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c +++ b/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c @@ -15,7 +15,6 @@ void u8cmd_dcmotor_releases(uint8 board_no, uint8 motor_no) { -<<<<<<< HEAD if (dcm_mode[motor_no] == 3) { analogWrite(dcm_pin_1[motor_no],0); @@ -26,17 +25,5 @@ void u8cmd_dcmotor_releases(uint8 board_no, uint8 motor_no) { digitalWrite(dcm_pin_1[motor_no],LOW); digitalWrite(dcm_pin_2[motor_no],LOW); -======= - if (dcm_mode[motor_no] == 3) //for IC accepting analog value - { - analogWrite(dcm_pin_1[motor_no],0); //passing LOW to IC pins to stop the motor - analogWrite(dcm_pin_2[motor_no],0); - } - - else //for IC accepting digital value - { - digitalWrite(dcm_pin_1[motor_no],LOW); - digitalWrite(dcm_pin_2[motor_no],LOW); //passing LOW to IC pins to stop the motor ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 } } 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 index 2ba4d39..adc1a6e 100644 --- a/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp +++ b/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp @@ -1,34 +1,10 @@ -<<<<<<< HEAD -======= -/* 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 - ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #include "cmd_i2c_dev.h" #include "Arduino.h" #include "Wire.h" -<<<<<<< HEAD uint8 u8cmd_i2c_devs(uint8 address) { Wire.begin(); return((uint8)address); -======= -uint8 u8cmd_i2c_devs(uint8 address) -{ - Wire.begin(); //To initiate connection - return((uint8)address); //Returns address to create a device object ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 } 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 index 78ef0ce..8f02a87 100644 --- a/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp +++ b/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp @@ -1,20 +1,3 @@ -<<<<<<< HEAD -======= -/* 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. ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #include "cmd_i2c_read.h" #include "Arduino.h" #include "Wire.h" 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 index 6b54159..0a2ec2e 100644 --- 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 @@ -1,20 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #include "cmd_i2c_read_register.h" #include "Arduino.h" #include "Wire.h" 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 index 788fd08..0239097 100644 --- a/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp +++ b/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp @@ -1,19 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #include "cmd_i2c_write.h" #include "Arduino.h" #include "Wire.h" 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 index f10dd97..63cc7c7 100644 --- 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 @@ -1,20 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #include "cmd_i2c_write_register.h" #include "Arduino.h" #include "Wire.h" diff --git a/src/c/scilab-arduino/default_files/sci2c_arduino.ino b/src/c/scilab-arduino/default_files/sci2c_arduino.ino index 5d5d101..df28950 100644 --- a/src/c/scilab-arduino/default_files/sci2c_arduino.ino +++ b/src/c/scilab-arduino/default_files/sci2c_arduino.ino @@ -11,13 +11,8 @@ */ #include "Arduino.h" -<<<<<<< HEAD #include #include -======= -#include "loop_arduino.h" -#include "setup_arduino.h" ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 void setup() { diff --git a/src/c/scilab-arduino/includes/cmd_i2c_dev.h b/src/c/scilab-arduino/includes/cmd_i2c_dev.h index 85d154a..861a8e7 100644 --- a/src/c/scilab-arduino/includes/cmd_i2c_dev.h +++ b/src/c/scilab-arduino/includes/cmd_i2c_dev.h @@ -1,18 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 -*/ - ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #ifndef __CMD_I2C_DEV_H__ #define __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 index e49abcd..791bdd3 100644 --- a/src/c/scilab-arduino/includes/cmd_i2c_read.h +++ b/src/c/scilab-arduino/includes/cmd_i2c_read.h @@ -1,18 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 -*/ - ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #ifndef __CMD_I2C_READ_H__ #define __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 index 1b3a3cf..ea203ad 100644 --- a/src/c/scilab-arduino/includes/cmd_i2c_read_register.h +++ b/src/c/scilab-arduino/includes/cmd_i2c_read_register.h @@ -1,18 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 -*/ - ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #ifndef __CMD_I2C_READ_REGISTER_H__ #define __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 index 58667c7..6a57222 100644 --- a/src/c/scilab-arduino/includes/cmd_i2c_write.h +++ b/src/c/scilab-arduino/includes/cmd_i2c_write.h @@ -1,18 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 -*/ - ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #ifndef __CMD_I2C_WRITE_H__ #define __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 index bf8e788..ff1b9ec 100644 --- a/src/c/scilab-arduino/includes/cmd_i2c_write_register.h +++ b/src/c/scilab-arduino/includes/cmd_i2c_write_register.h @@ -1,18 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 -*/ - ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #ifndef __CMD_I2C_WRITE_REGISTER_H__ #define __CMD_I2C_WRITE_REGISTER_H__ diff --git a/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h index c1de1b7..c4d93d7 100644 --- a/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h @@ -1,18 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 -*/ - ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #ifndef __INT_CMD_I2C_DEV_H__ #define __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 index ef11426..b0633a0 100644 --- a/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h @@ -1,18 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 -*/ - ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #ifndef __INT_CMD_I2C_READ_H__ #define __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 index c2cdc65..5f4c529 100644 --- a/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h @@ -1,18 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 -*/ - ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #ifndef __INT_CMD_I2C_READ_REGISTER_H__ #define __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 index 23474a7..a7705a8 100644 --- a/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h @@ -1,18 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 -*/ - ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #ifndef __INT_CMD_I2C_WRITE_H__ #define __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 index e385b3f..35c0527 100644 --- a/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h +++ b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h @@ -1,18 +1,3 @@ -<<<<<<< HEAD -======= -/* 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 -*/ - ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 #ifndef __INT_CMD_I2C_WRITE_REGISTER_H__ #define __INT_CMD_I2C_WRITE_REGISTER_H__ -- cgit From 49d8281d2da2f4c6bf0e62d148a8a7328d3bf970 Mon Sep 17 00:00:00 2001 From: yash1112 Date: Mon, 10 Jul 2017 17:08:48 +0530 Subject: Arduino toolbox error Resolved --- .../cmd_analog_in_volt/u8cmd_analog_in_volts.c | 4 ++-- .../cmd_analog_out_volt/u8cmd_analog_out_volts.c | 6 +++--- .../cmd_dcmotor_release/u8cmd_dcmotor_releases.c | 8 ++++---- src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp | 19 ++++++++++++++++--- src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp | 14 ++++++++++++++ .../u8cmd_i2c_read_registers.cpp | 14 ++++++++++++++ .../scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp | 13 +++++++++++++ .../u8cmd_i2c_write_registers.cpp | 14 ++++++++++++++ src/c/scilab-arduino/default_files/sci2c_arduino.ino | 4 ++-- src/c/scilab-arduino/includes/cmd_i2c_dev.h | 12 ++++++++++++ src/c/scilab-arduino/includes/cmd_i2c_read.h | 12 ++++++++++++ src/c/scilab-arduino/includes/cmd_i2c_read_register.h | 12 ++++++++++++ src/c/scilab-arduino/includes/cmd_i2c_write.h | 12 ++++++++++++ .../scilab-arduino/includes/cmd_i2c_write_register.h | 12 ++++++++++++ src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h | 12 ++++++++++++ src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h | 12 ++++++++++++ .../interfaces/int_cmd_i2c_read_register.h | 12 ++++++++++++ src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h | 12 ++++++++++++ .../interfaces/int_cmd_i2c_write_register.h | 12 ++++++++++++ 19 files changed, 202 insertions(+), 14 deletions(-) (limited to 'src/c/scilab-arduino') 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 index 7018df2..f961719 100644 --- 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 @@ -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/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 index 2dd82e4..1d76b60 100644 --- 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 @@ -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/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c b/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c index 349bcb1..d56d12d 100644 --- a/src/c/scilab-arduino/cmd_dcmotor_release/u8cmd_dcmotor_releases.c +++ b/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/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp b/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp index adc1a6e..eb9ec10 100644 --- a/src/c/scilab-arduino/cmd_i2c_dev/u8cmd_i2c_devs.cpp +++ b/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/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp b/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp index 8f02a87..24d36de 100644 --- a/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp +++ b/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/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 index 0a2ec2e..fd07eb6 100644 --- 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 @@ -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/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp b/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp index 0239097..b777225 100644 --- a/src/c/scilab-arduino/cmd_i2c_write/u8cmd_i2c_writes.cpp +++ b/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/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 index 63cc7c7..9e3c11c 100644 --- 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 @@ -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/src/c/scilab-arduino/default_files/sci2c_arduino.ino b/src/c/scilab-arduino/default_files/sci2c_arduino.ino index df28950..1d4465b 100644 --- a/src/c/scilab-arduino/default_files/sci2c_arduino.ino +++ b/src/c/scilab-arduino/default_files/sci2c_arduino.ino @@ -11,8 +11,8 @@ */ #include "Arduino.h" -#include -#include +#include "loop_arduino.h" +#include "setup_arduino.h" void setup() { diff --git a/src/c/scilab-arduino/includes/cmd_i2c_dev.h b/src/c/scilab-arduino/includes/cmd_i2c_dev.h index 861a8e7..382c2b3 100644 --- a/src/c/scilab-arduino/includes/cmd_i2c_dev.h +++ b/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/src/c/scilab-arduino/includes/cmd_i2c_read.h b/src/c/scilab-arduino/includes/cmd_i2c_read.h index 791bdd3..e33ede3 100644 --- a/src/c/scilab-arduino/includes/cmd_i2c_read.h +++ b/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/src/c/scilab-arduino/includes/cmd_i2c_read_register.h b/src/c/scilab-arduino/includes/cmd_i2c_read_register.h index ea203ad..50fba93 100644 --- a/src/c/scilab-arduino/includes/cmd_i2c_read_register.h +++ b/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/src/c/scilab-arduino/includes/cmd_i2c_write.h b/src/c/scilab-arduino/includes/cmd_i2c_write.h index 6a57222..128f1af 100644 --- a/src/c/scilab-arduino/includes/cmd_i2c_write.h +++ b/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/src/c/scilab-arduino/includes/cmd_i2c_write_register.h b/src/c/scilab-arduino/includes/cmd_i2c_write_register.h index ff1b9ec..7fac4cb 100644 --- a/src/c/scilab-arduino/includes/cmd_i2c_write_register.h +++ b/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/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h index c4d93d7..85f3e3c 100644 --- a/src/c/scilab-arduino/interfaces/int_cmd_i2c_dev.h +++ b/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/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h index b0633a0..6ffd7ec 100644 --- a/src/c/scilab-arduino/interfaces/int_cmd_i2c_read.h +++ b/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/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h index 5f4c529..e848b69 100644 --- a/src/c/scilab-arduino/interfaces/int_cmd_i2c_read_register.h +++ b/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/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h index a7705a8..3a01593 100644 --- a/src/c/scilab-arduino/interfaces/int_cmd_i2c_write.h +++ b/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/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h b/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h index 35c0527..78a3382 100644 --- a/src/c/scilab-arduino/interfaces/int_cmd_i2c_write_register.h +++ b/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__ -- cgit