java: changed some C types to C++ types

Signed-off-by: Andrei Vasiliu <andrei.vasiliu@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>

Conflicts:
	src/mma7455/mma7455.cxx
	src/mma7455/mma7455.h
	src/sm130/sm130.cxx
	src/sm130/sm130.h
This commit is contained in:
Andrei Vasiliu
2015-09-02 14:56:13 +03:00
committed by Mihai Tudor Panu
parent b8835958e2
commit ab730038fd
46 changed files with 731 additions and 996 deletions

View File

@ -62,25 +62,18 @@
using namespace upm;
Itg3200::Itg3200(int bus)
Itg3200::Itg3200(int bus) : m_i2c(bus)
{
//init bus and reset chip
m_i2c = mraa_i2c_init(bus);
mraa_i2c_address(m_i2c, ITG3200_I2C_ADDR);
//reset chip
m_i2c.address(ITG3200_I2C_ADDR);
m_buffer[0] = ITG3200_PWR_MGM;
m_buffer[1] = ITG3200_RESET;
mraa_i2c_write(m_i2c, m_buffer, 2);
m_i2c.write(m_buffer, 2);
Itg3200::calibrate();
Itg3200::update();
}
Itg3200::~Itg3200()
{
mraa_i2c_stop(m_i2c);
}
void
Itg3200::calibrate(void)
{
@ -132,14 +125,14 @@ Itg3200::getRawTemp()
return m_temperature;
}
mraa_result_t
mraa::Result
Itg3200::update(void)
{
mraa_i2c_address(m_i2c, ITG3200_I2C_ADDR);
mraa_i2c_write_byte(m_i2c, ITG3200_TEMP_H);
m_i2c.address(ITG3200_I2C_ADDR);
m_i2c.writeByte(ITG3200_TEMP_H);
mraa_i2c_address(m_i2c, ITG3200_I2C_ADDR);
mraa_i2c_read(m_i2c, m_buffer, DATA_REG_SIZE);
m_i2c.address(ITG3200_I2C_ADDR);
m_i2c.read(m_buffer, DATA_REG_SIZE);
//temp
//
@ -151,5 +144,5 @@ Itg3200::update(void)
// z
m_rotation[2] = ((m_buffer[6] << 8 ) | m_buffer[7]) + m_offsets[2];
return MRAA_SUCCESS;
return mraa::SUCCESS;
}

View File

@ -23,7 +23,7 @@
*/
#pragma once
#include <mraa/i2c.h>
#include <mraa/i2c.hpp>
#define READ_BUFFER_LENGTH 8
@ -64,11 +64,6 @@ public:
*/
Itg3200(int bus);
/**
* Itg3200 object destructor
*/
~Itg3200();
/**
* Calibrates the sensor to 0 on all axes. The sensor needs to be resting for accurate calibration.
* It takes about 3 seconds and is also called by the constructor on object creation.
@ -109,14 +104,14 @@ public:
*
* @return 0 if successful
*/
mraa_result_t update();
mraa::Result update();
private:
float m_angle[3];
int16_t m_rotation[3];
int16_t m_offsets[3];
int16_t m_temperature;
uint8_t m_buffer[READ_BUFFER_LENGTH];
mraa_i2c_context m_i2c;
mraa::I2c m_i2c;
};
}