summaryrefslogtreecommitdiff
path: root/src/c/scilab-arduino/cmd_i2c_read_register
diff options
context:
space:
mode:
authorSandeep Gupta2017-07-05 12:41:25 +0530
committerSandeep Gupta2017-07-05 12:41:25 +0530
commit06337f0dc8114c70fd0c7767083971a0d091750a (patch)
tree446481550ba88e6e0f7df2db7fdc66d2016ee2f1 /src/c/scilab-arduino/cmd_i2c_read_register
parentc2e305c3b82ed944d57402dd515b3d5839a31980 (diff)
downloadScilab2C_fossee_old-06337f0dc8114c70fd0c7767083971a0d091750a.tar.gz
Scilab2C_fossee_old-06337f0dc8114c70fd0c7767083971a0d091750a.tar.bz2
Scilab2C_fossee_old-06337f0dc8114c70fd0c7767083971a0d091750a.zip
LinearAlgebra and MatrixOperation Update
Diffstat (limited to 'src/c/scilab-arduino/cmd_i2c_read_register')
-rw-r--r--src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp26
1 files changed, 0 insertions, 26 deletions
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
deleted file mode 100644
index 0a2ec2e..0000000
--- a/src/c/scilab-arduino/cmd_i2c_read_register/u8cmd_i2c_read_registers.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#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);
-
-}