java: now using the C++ style types from mraa defined in types.hpp

Signed-off-by: Andrei Vasiliu <andrei.vasiliu@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Andrei Vasiliu
2015-08-26 16:38:57 +03:00
committed by Mihai Tudor Panu
parent ea1df1b178
commit b8835958e2
28 changed files with 208 additions and 200 deletions

View File

@ -35,13 +35,13 @@ using namespace upm;
SSD1327::SSD1327(int bus_in, int addr_in) : m_i2c_lcd_control(bus_in)
{
mraa_result_t error = MRAA_SUCCESS;
mraa::Result error = mraa::SUCCESS;
m_lcd_control_address = addr_in;
m_name = "SSD1327";
error = m_i2c_lcd_control.address(m_lcd_control_address);
if (error != MRAA_SUCCESS) {
if (error != mraa::SUCCESS) {
fprintf(stderr, "Failed to initialize i2c bus\n");
return;
}
@ -144,10 +144,10 @@ SSD1327::~SSD1327()
{
}
mraa_result_t
mraa::Result
SSD1327::draw(uint8_t* data, int bytes)
{
mraa_result_t error = MRAA_SUCCESS;
mraa::Result error = mraa::SUCCESS;
setHorizontalMode();
for (int row = 0; row < bytes; row++) {
@ -173,10 +173,10 @@ SSD1327::draw(uint8_t* data, int bytes)
* virtual area
* **************
*/
mraa_result_t
mraa::Result
SSD1327::write(std::string msg)
{
mraa_result_t error = MRAA_SUCCESS;
mraa::Result error = mraa::SUCCESS;
setVerticalMode();
for (std::string::size_type i = 0; i < msg.size(); ++i) {
@ -186,10 +186,10 @@ SSD1327::write(std::string msg)
return error;
}
mraa_result_t
mraa::Result
SSD1327::setCursor(int row, int column)
{
mraa_result_t error = MRAA_SUCCESS;
mraa::Result error = mraa::SUCCESS;
// Column Address
m_i2c_lcd_control.writeReg(LCD_CMD, 0x15); /* Set Column Address */
@ -210,10 +210,10 @@ SSD1327::setCursor(int row, int column)
return error;
}
mraa_result_t
mraa::Result
SSD1327::clear()
{
mraa_result_t error = MRAA_SUCCESS;
mraa::Result error = mraa::SUCCESS;
uint8_t columnIdx, rowIdx;
for (rowIdx = 0; rowIdx < 12; rowIdx++) {
@ -223,10 +223,10 @@ SSD1327::clear()
}
}
return MRAA_SUCCESS;
return mraa::SUCCESS;
}
mraa_result_t
mraa::Result
SSD1327::home()
{
return setCursor(0, 0);
@ -244,10 +244,10 @@ SSD1327::setGrayLevel(uint8_t level)
* private area
* **************
*/
mraa_result_t
mraa::Result
SSD1327::writeChar(uint8_t value)
{
mraa_result_t rv = MRAA_SUCCESS;
mraa::Result rv = mraa::SUCCESS;
if (value < 0x20 || value > 0x7F) {
value = 0x20; // space
}
@ -269,17 +269,17 @@ SSD1327::writeChar(uint8_t value)
return rv;
}
mraa_result_t
mraa::Result
SSD1327::setNormalDisplay()
{
return m_i2c_lcd_control.writeReg(LCD_CMD,
DISPLAY_CMD_SET_NORMAL); // set to normal display '1' is ON
}
mraa_result_t
mraa::Result
SSD1327::setHorizontalMode()
{
mraa_result_t rv = MRAA_SUCCESS;
mraa::Result rv = mraa::SUCCESS;
rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0xA0); // remap to
usleep(CMD_SLEEP);
rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x42); // horizontal mode
@ -305,10 +305,10 @@ SSD1327::setHorizontalMode()
return rv;
}
mraa_result_t
mraa::Result
SSD1327::setVerticalMode()
{
mraa_result_t rv = MRAA_SUCCESS;
mraa::Result rv = mraa::SUCCESS;
rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0xA0); // remap to
usleep(CMD_SLEEP);
rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x46); // Vertical mode