mirror of
https://github.com/eclipse/upm.git
synced 2025-07-03 18:31:13 +03:00
mraa: change all existing code to use libmraa.
* Made CMake depend on 0.4 libmraa Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
@ -33,54 +33,54 @@ I2CLcd::I2CLcd (int bus, int lcdAddress) {
|
||||
m_lcd_control_address = lcdAddress;
|
||||
m_bus = bus;
|
||||
|
||||
m_i2c_lcd_control = maa_i2c_init(m_bus);
|
||||
m_i2c_lcd_control = mraa_i2c_init(m_bus);
|
||||
|
||||
maa_result_t ret = maa_i2c_address(m_i2c_lcd_control, m_lcd_control_address);
|
||||
if (ret != MAA_SUCCESS) {
|
||||
mraa_result_t ret = mraa_i2c_address(m_i2c_lcd_control, m_lcd_control_address);
|
||||
if (ret != MRAA_SUCCESS) {
|
||||
fprintf(stderr, "Messed up i2c bus\n");
|
||||
}
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
I2CLcd::write (int row, int column, std::string msg) {
|
||||
setCursor (row, column);
|
||||
write (msg);
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
I2CLcd::close() {
|
||||
return maa_i2c_stop(m_i2c_lcd_control);
|
||||
return mraa_i2c_stop(m_i2c_lcd_control);
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
I2CLcd::i2cReg (maa_i2c_context ctx, int deviceAdress, int addr, uint8_t value) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t
|
||||
I2CLcd::i2cReg (mraa_i2c_context ctx, int deviceAdress, int addr, uint8_t value) {
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
uint8_t data[2] = { addr, value };
|
||||
error = maa_i2c_address (ctx, deviceAdress);
|
||||
error = maa_i2c_write (ctx, data, 2);
|
||||
error = mraa_i2c_address (ctx, deviceAdress);
|
||||
error = mraa_i2c_write (ctx, data, 2);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
I2CLcd::i2Cmd (maa_i2c_context ctx, uint8_t value) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t
|
||||
I2CLcd::i2Cmd (mraa_i2c_context ctx, uint8_t value) {
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
uint8_t data[2] = { LCD_CMD, value };
|
||||
error = maa_i2c_address (ctx, m_lcd_control_address);
|
||||
error = maa_i2c_write (ctx, data, 2);
|
||||
error = mraa_i2c_address (ctx, m_lcd_control_address);
|
||||
error = mraa_i2c_write (ctx, data, 2);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
I2CLcd::i2cData (maa_i2c_context ctx, uint8_t value) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t
|
||||
I2CLcd::i2cData (mraa_i2c_context ctx, uint8_t value) {
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
uint8_t data[2] = { LCD_DATA, value };
|
||||
error = maa_i2c_address (ctx, m_lcd_control_address);
|
||||
error = maa_i2c_write (ctx, data, 2);
|
||||
error = mraa_i2c_address (ctx, m_lcd_control_address);
|
||||
error = mraa_i2c_write (ctx, data, 2);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <maa/i2c.h>
|
||||
#include <mraa/i2c.h>
|
||||
|
||||
namespace upm {
|
||||
|
||||
@ -70,17 +70,17 @@ namespace upm {
|
||||
class I2CLcd {
|
||||
public:
|
||||
I2CLcd (int bus, int lcdAddress);
|
||||
maa_result_t write (int x, int y, std::string msg);
|
||||
mraa_result_t write (int x, int y, std::string msg);
|
||||
|
||||
virtual maa_result_t write (std::string msg) = 0;
|
||||
virtual maa_result_t setCursor (int row, int column) = 0;
|
||||
virtual maa_result_t clear () = 0;
|
||||
virtual maa_result_t home () = 0;
|
||||
virtual maa_result_t i2Cmd (maa_i2c_context ctx, uint8_t value);
|
||||
virtual maa_result_t i2cReg (maa_i2c_context ctx, int deviceAdress, int addr, uint8_t data);
|
||||
virtual maa_result_t i2cData (maa_i2c_context ctx, uint8_t value);
|
||||
virtual mraa_result_t write (std::string msg) = 0;
|
||||
virtual mraa_result_t setCursor (int row, int column) = 0;
|
||||
virtual mraa_result_t clear () = 0;
|
||||
virtual mraa_result_t home () = 0;
|
||||
virtual mraa_result_t i2Cmd (mraa_i2c_context ctx, uint8_t value);
|
||||
virtual mraa_result_t i2cReg (mraa_i2c_context ctx, int deviceAdress, int addr, uint8_t data);
|
||||
virtual mraa_result_t i2cData (mraa_i2c_context ctx, uint8_t value);
|
||||
|
||||
maa_result_t close();
|
||||
mraa_result_t close();
|
||||
std::string name()
|
||||
{
|
||||
return m_name;
|
||||
@ -89,7 +89,7 @@ class I2CLcd {
|
||||
std::string m_name;
|
||||
int m_lcd_control_address;
|
||||
int m_bus;
|
||||
maa_i2c_context m_i2c_lcd_control;
|
||||
mraa_i2c_context m_i2c_lcd_control;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -30,13 +30,13 @@
|
||||
using namespace upm;
|
||||
|
||||
Jhd1313m1::Jhd1313m1 (int bus, int lcdAddress, int rgbAddress) : I2CLcd(bus, lcdAddress) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
m_rgb_address = rgbAddress;
|
||||
m_i2c_lcd_rgb = maa_i2c_init(m_bus);
|
||||
m_i2c_lcd_rgb = mraa_i2c_init(m_bus);
|
||||
|
||||
maa_result_t ret = maa_i2c_address(m_i2c_lcd_rgb, m_rgb_address);
|
||||
if (ret != MAA_SUCCESS) {
|
||||
mraa_result_t ret = mraa_i2c_address(m_i2c_lcd_rgb, m_rgb_address);
|
||||
if (ret != MRAA_SUCCESS) {
|
||||
fprintf(stderr, "Messed up i2c bus\n");
|
||||
}
|
||||
|
||||
@ -75,9 +75,9 @@ Jhd1313m1::~Jhd1313m1() {
|
||||
* virtual area
|
||||
* **************
|
||||
*/
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
Jhd1313m1::write (std::string msg) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
uint8_t data[2] = {0x40, 0};
|
||||
for (std::string::size_type i = 0; i < msg.size(); ++i) {
|
||||
error = i2cData (m_i2c_lcd_control, msg[i]);
|
||||
@ -86,9 +86,9 @@ Jhd1313m1::write (std::string msg) {
|
||||
return error;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
Jhd1313m1::setCursor (int row, int column) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
int row_addr[] = { 0x80, 0xc0, 0x14, 0x54};
|
||||
uint8_t offset = ((column % 16) + row_addr[row]);
|
||||
error = i2Cmd (m_i2c_lcd_control, offset);
|
||||
@ -96,12 +96,12 @@ Jhd1313m1::setCursor (int row, int column) {
|
||||
return error;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
Jhd1313m1::clear () {
|
||||
return i2Cmd (m_i2c_lcd_control, LCD_CLEARDISPLAY);
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
Jhd1313m1::home () {
|
||||
return i2Cmd (m_i2c_lcd_control, LCD_RETURNHOME);
|
||||
}
|
||||
|
@ -32,14 +32,14 @@ class Jhd1313m1 : public I2CLcd {
|
||||
public:
|
||||
Jhd1313m1 (int bus, int lcdAddress, int rgbAddress);
|
||||
~Jhd1313m1 ();
|
||||
maa_result_t write (std::string msg);
|
||||
maa_result_t setCursor (int row, int column);
|
||||
maa_result_t clear ();
|
||||
maa_result_t home ();
|
||||
mraa_result_t write (std::string msg);
|
||||
mraa_result_t setCursor (int row, int column);
|
||||
mraa_result_t clear ();
|
||||
mraa_result_t home ();
|
||||
|
||||
private:
|
||||
int m_rgb_address;
|
||||
maa_i2c_context m_i2c_lcd_rgb;
|
||||
mraa_i2c_context m_i2c_lcd_rgb;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
using namespace upm;
|
||||
|
||||
Lcm1602::Lcm1602(int bus_in, int addr_in) : I2CLcd (bus_in, addr_in) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
usleep(50000);
|
||||
expandWrite(LCD_BACKLIGHT);
|
||||
@ -69,18 +69,18 @@ Lcm1602::~Lcm1602 () {
|
||||
* virtual area
|
||||
* **************
|
||||
*/
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
Lcm1602::write (std::string msg) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
for (std::string::size_type i = 0; i < msg.size(); ++i) {
|
||||
error = send (msg[i], LCD_RS);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
Lcm1602::setCursor (int row, int column) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
int row_addr[] = { 0x80, 0xc0, 0x14, 0x54};
|
||||
uint8_t offset = ((column % 16) + row_addr[row]);
|
||||
@ -88,12 +88,12 @@ Lcm1602::setCursor (int row, int column) {
|
||||
return send (LCD_CMD | offset, 0);
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
Lcm1602::clear () {
|
||||
return send(LCD_CLEARDISPLAY, 0);
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
Lcm1602::home () {
|
||||
return send(LCD_RETURNHOME, 0);
|
||||
}
|
||||
@ -103,9 +103,9 @@ Lcm1602::home () {
|
||||
* private area
|
||||
* **************
|
||||
*/
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
Lcm1602::send (uint8_t value, int mode) {
|
||||
maa_result_t ret = MAA_SUCCESS;
|
||||
mraa_result_t ret = MRAA_SUCCESS;
|
||||
uint8_t h = value & 0xf0;
|
||||
uint8_t l = (value << 4) & 0xf0;
|
||||
ret = write4bits(h | mode);
|
||||
@ -113,26 +113,26 @@ Lcm1602::send (uint8_t value, int mode) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
Lcm1602::write4bits(uint8_t value)
|
||||
{
|
||||
maa_result_t ret = MAA_SUCCESS;
|
||||
mraa_result_t ret = MRAA_SUCCESS;
|
||||
ret = expandWrite(value);
|
||||
ret = pulseEnable(value);
|
||||
return ret;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
Lcm1602::expandWrite(uint8_t value)
|
||||
{
|
||||
uint8_t buffer = value | LCD_BACKLIGHT;
|
||||
return maa_i2c_write_byte(m_i2c_lcd_control, buffer);
|
||||
return mraa_i2c_write_byte(m_i2c_lcd_control, buffer);
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
Lcm1602::pulseEnable(uint8_t value)
|
||||
{
|
||||
maa_result_t ret = MAA_SUCCESS;
|
||||
mraa_result_t ret = MRAA_SUCCESS;
|
||||
ret = expandWrite(value | LCD_EN);
|
||||
usleep(1);
|
||||
ret = expandWrite(value & ~LCD_EN);
|
||||
|
@ -35,21 +35,21 @@ namespace upm {
|
||||
class Lcm1602 : public I2CLcd {
|
||||
public:
|
||||
/** LCM1602 Constructor.
|
||||
* Calls MAA initialisation functions.
|
||||
* Calls MRAA initialisation functions.
|
||||
* @param bus i2c bus to use
|
||||
* @param address the slave address the lcd is registered on.
|
||||
*/
|
||||
Lcm1602(int bus, int address);
|
||||
~Lcm1602();
|
||||
maa_result_t write (std::string msg);
|
||||
maa_result_t setCursor (int row, int column);
|
||||
maa_result_t clear ();
|
||||
maa_result_t home ();
|
||||
mraa_result_t write (std::string msg);
|
||||
mraa_result_t setCursor (int row, int column);
|
||||
mraa_result_t clear ();
|
||||
mraa_result_t home ();
|
||||
|
||||
private :
|
||||
maa_result_t send (uint8_t value, int mode);
|
||||
maa_result_t write4bits(uint8_t value);
|
||||
maa_result_t expandWrite(uint8_t value);
|
||||
maa_result_t pulseEnable(uint8_t value);
|
||||
mraa_result_t send (uint8_t value, int mode);
|
||||
mraa_result_t write4bits(uint8_t value);
|
||||
mraa_result_t expandWrite(uint8_t value);
|
||||
mraa_result_t pulseEnable(uint8_t value);
|
||||
};
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ SSD1308::~SSD1308 () {
|
||||
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1308::draw (uint8_t *data, int bytes) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
setAddressingMode (HORIZONTAL);
|
||||
for (int idx = 0; idx < bytes; idx++) {
|
||||
@ -62,9 +62,9 @@ SSD1308::draw (uint8_t *data, int bytes) {
|
||||
* virtual area
|
||||
* **************
|
||||
*/
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1308::write (std::string msg) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
uint8_t data[2] = {0x40, 0};
|
||||
|
||||
setAddressingMode (PAGE);
|
||||
@ -75,9 +75,9 @@ SSD1308::write (std::string msg) {
|
||||
return error;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1308::setCursor (int row, int column) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
error = i2Cmd (m_i2c_lcd_control, BASE_PAGE_START_ADDR + row); // set page address
|
||||
error = i2Cmd (m_i2c_lcd_control, BASE_LOW_COLUMN_ADDR + (8 * column & 0x0F)); // set column lower address
|
||||
@ -86,9 +86,9 @@ SSD1308::setCursor (int row, int column) {
|
||||
return error;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1308::clear () {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
uint8_t columnIdx, rowIdx;
|
||||
|
||||
i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_OFF); // display off
|
||||
@ -103,10 +103,10 @@ SSD1308::clear () {
|
||||
i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_ON); // display on
|
||||
home ();
|
||||
|
||||
return MAA_SUCCESS;
|
||||
return MRAA_SUCCESS;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1308::home () {
|
||||
return setCursor (0, 0);
|
||||
}
|
||||
@ -116,8 +116,8 @@ SSD1308::home () {
|
||||
* private area
|
||||
* **************
|
||||
*/
|
||||
maa_result_t
|
||||
SSD1308::writeChar (maa_i2c_context ctx, uint8_t value) {
|
||||
mraa_result_t
|
||||
SSD1308::writeChar (mraa_i2c_context ctx, uint8_t value) {
|
||||
if (value < 0x20 || value > 0x7F) {
|
||||
value = 0x20; // space
|
||||
}
|
||||
@ -127,12 +127,12 @@ SSD1308::writeChar (maa_i2c_context ctx, uint8_t value) {
|
||||
}
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1308::setNormalDisplay () {
|
||||
return i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_SET_NORMAL); // set to normal display '1' is ON
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1308::setAddressingMode (displayAddressingMode mode) {
|
||||
i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_MEM_ADDR_MODE); //set addressing mode
|
||||
i2Cmd (m_i2c_lcd_control, mode); //set page addressing mode
|
||||
|
@ -148,23 +148,23 @@ typedef enum {
|
||||
class SSD1308 : public I2CLcd {
|
||||
public:
|
||||
/** SSD1308 Constructor.
|
||||
* Calls MAA initialisation functions.
|
||||
* Calls MRAA initialisation functions.
|
||||
* @param bus i2c bus to use
|
||||
* @param address the slave address the lcd is registered on.
|
||||
*/
|
||||
SSD1308 (int bus, int address);
|
||||
~SSD1308 ();
|
||||
maa_result_t draw(uint8_t *data, int bytes);
|
||||
mraa_result_t draw(uint8_t *data, int bytes);
|
||||
|
||||
// pure virtual methods
|
||||
maa_result_t write (std::string msg);
|
||||
maa_result_t setCursor (int row, int column);
|
||||
maa_result_t clear ();
|
||||
maa_result_t home ();
|
||||
mraa_result_t write (std::string msg);
|
||||
mraa_result_t setCursor (int row, int column);
|
||||
mraa_result_t clear ();
|
||||
mraa_result_t home ();
|
||||
|
||||
private:
|
||||
maa_result_t writeChar (maa_i2c_context ctx, uint8_t value);
|
||||
maa_result_t setNormalDisplay ();
|
||||
maa_result_t setAddressingMode (displayAddressingMode mode);
|
||||
mraa_result_t writeChar (mraa_i2c_context ctx, uint8_t value);
|
||||
mraa_result_t setNormalDisplay ();
|
||||
mraa_result_t setAddressingMode (displayAddressingMode mode);
|
||||
};
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ using namespace upm;
|
||||
#define CMD_SLEEP 10000
|
||||
|
||||
SSD1327::SSD1327 (int bus_in, int addr_in) : I2CLcd (bus_in, addr_in) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
usleep (INIT_SLEEP);
|
||||
i2Cmd (m_i2c_lcd_control, 0xFD); // Unlock OLED driver IC MCU interface from entering command. i.e: Accept commands
|
||||
usleep (INIT_SLEEP);
|
||||
@ -123,9 +123,9 @@ SSD1327::~SSD1327 () {
|
||||
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1327::draw (uint8_t *data, int bytes) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
setHorizontalMode ();
|
||||
for (int row = 0; row < bytes; row++) {
|
||||
@ -151,9 +151,9 @@ SSD1327::draw (uint8_t *data, int bytes) {
|
||||
* virtual area
|
||||
* **************
|
||||
*/
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1327::write (std::string msg) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
setVerticalMode ();
|
||||
for (std::string::size_type i = 0; i < msg.size(); ++i) {
|
||||
@ -163,9 +163,9 @@ SSD1327::write (std::string msg) {
|
||||
return error;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1327::setCursor (int row, int column) {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
//Column Address
|
||||
i2Cmd (m_i2c_lcd_control, 0x15); /* Set Column Address */
|
||||
@ -185,9 +185,9 @@ SSD1327::setCursor (int row, int column) {
|
||||
return error;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1327::clear () {
|
||||
maa_result_t error = MAA_SUCCESS;
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
uint8_t columnIdx, rowIdx;
|
||||
|
||||
for(rowIdx = 0; rowIdx < 12; rowIdx++) {
|
||||
@ -197,15 +197,15 @@ SSD1327::clear () {
|
||||
}
|
||||
}
|
||||
|
||||
return MAA_SUCCESS;
|
||||
return MRAA_SUCCESS;
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1327::home () {
|
||||
return setCursor (0, 0);
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1327::setGrayLevel (uint8_t level) {
|
||||
grayHigh = (level << 4) & 0xF0;
|
||||
grayLow = level & 0x0F;
|
||||
@ -216,8 +216,8 @@ SSD1327::setGrayLevel (uint8_t level) {
|
||||
* private area
|
||||
* **************
|
||||
*/
|
||||
maa_result_t
|
||||
SSD1327::writeChar (maa_i2c_context ctx, uint8_t value) {
|
||||
mraa_result_t
|
||||
SSD1327::writeChar (mraa_i2c_context ctx, uint8_t value) {
|
||||
if (value < 0x20 || value > 0x7F) {
|
||||
value = 0x20; // space
|
||||
}
|
||||
@ -238,12 +238,12 @@ SSD1327::writeChar (maa_i2c_context ctx, uint8_t value) {
|
||||
}
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1327::setNormalDisplay () {
|
||||
return i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_SET_NORMAL); // set to normal display '1' is ON
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1327::setHorizontalMode () {
|
||||
i2Cmd (m_i2c_lcd_control, 0xA0); // remap to
|
||||
usleep (CMD_SLEEP);
|
||||
@ -267,7 +267,7 @@ SSD1327::setHorizontalMode () {
|
||||
usleep (CMD_SLEEP);
|
||||
}
|
||||
|
||||
maa_result_t
|
||||
mraa_result_t
|
||||
SSD1327::setVerticalMode () {
|
||||
i2Cmd (m_i2c_lcd_control, 0xA0); // remap to
|
||||
usleep (CMD_SLEEP);
|
||||
|
@ -148,26 +148,26 @@ typedef enum {
|
||||
class SSD1327 : public I2CLcd {
|
||||
public:
|
||||
/** SSD1308 Constructor.
|
||||
* Calls MAA initialisation functions.
|
||||
* Calls MRAA initialisation functions.
|
||||
* @param bus i2c bus to use
|
||||
* @param address the slave address the lcd is registered on.
|
||||
*/
|
||||
SSD1327 (int bus, int address);
|
||||
~SSD1327 ();
|
||||
maa_result_t draw(uint8_t *data, int bytes);
|
||||
mraa_result_t draw(uint8_t *data, int bytes);
|
||||
|
||||
// virtual methods
|
||||
maa_result_t write (std::string msg);
|
||||
maa_result_t setCursor (int row, int column);
|
||||
maa_result_t clear ();
|
||||
maa_result_t home ();
|
||||
maa_result_t setGrayLevel (uint8_t level);
|
||||
mraa_result_t write (std::string msg);
|
||||
mraa_result_t setCursor (int row, int column);
|
||||
mraa_result_t clear ();
|
||||
mraa_result_t home ();
|
||||
mraa_result_t setGrayLevel (uint8_t level);
|
||||
|
||||
private:
|
||||
maa_result_t writeChar (maa_i2c_context ctx, uint8_t value);
|
||||
maa_result_t setNormalDisplay ();
|
||||
maa_result_t setHorizontalMode ();
|
||||
maa_result_t setVerticalMode ();
|
||||
mraa_result_t writeChar (mraa_i2c_context ctx, uint8_t value);
|
||||
mraa_result_t setNormalDisplay ();
|
||||
mraa_result_t setHorizontalMode ();
|
||||
mraa_result_t setVerticalMode ();
|
||||
|
||||
uint8_t grayHigh;
|
||||
uint8_t grayLow;
|
||||
|
Reference in New Issue
Block a user