mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
lcd: rename from iiclcd to i2clcd, add swig
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
parent
058c40e340
commit
0050f92b06
@ -1,12 +1,5 @@
|
|||||||
set (libname "i2clcd")
|
set (libname "i2clcd")
|
||||||
add_library (i2clcd SHARED iiclcd.cxx lcm1602.cxx jhd1313m1.cxx ssd1308.cxx ssd1327.cxx)
|
set (libdescription "upm lcd/oled displays")
|
||||||
include_directories (${MAA_INCLUDE_DIR})
|
set (module_src i2clcd.cxx lcm1602.cxx jhd1313m1.cxx ssd1308.cxx ssd1327.cxx)
|
||||||
target_link_libraries (i2clcd ${MAA_LIBRARIES})
|
set (module_h i2clcd.h lcm1602.h jhd1313m1.h ssd1308.h ssd1327.h)
|
||||||
|
upm_module_init()
|
||||||
install (TARGETS ${libname} DESTINATION lib/upm COMPONENT ${libname})
|
|
||||||
install (FILES iiclcd.h DESTINATION include/upm COMPONENT ${libname})
|
|
||||||
|
|
||||||
if (IPK)
|
|
||||||
cpack_add_component (${libname} DISPLAY_NAME ${libname} REQUIRED INSTALL_TYPES all)
|
|
||||||
set(CPACK_COMPONENT_${libname}_DESCRIPTION "libupm lcd")
|
|
||||||
endif()
|
|
||||||
|
@ -25,11 +25,11 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "iiclcd.h"
|
#include "i2clcd.h"
|
||||||
|
|
||||||
using namespace upm;
|
using namespace upm;
|
||||||
|
|
||||||
IICLcd::IICLcd (int bus, int lcdAddress) {
|
I2CLcd::I2CLcd (int bus, int lcdAddress) {
|
||||||
m_lcd_control_address = lcdAddress;
|
m_lcd_control_address = lcdAddress;
|
||||||
m_bus = bus;
|
m_bus = bus;
|
||||||
|
|
||||||
@ -42,18 +42,18 @@ IICLcd::IICLcd (int bus, int lcdAddress) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
maa_result_t
|
maa_result_t
|
||||||
IICLcd::write (int row, int column, std::string msg) {
|
I2CLcd::write (int row, int column, std::string msg) {
|
||||||
setCursor (row, column);
|
setCursor (row, column);
|
||||||
write (msg);
|
write (msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
maa_result_t
|
maa_result_t
|
||||||
IICLcd::close() {
|
I2CLcd::close() {
|
||||||
return maa_i2c_stop(m_i2c_lcd_control);
|
return maa_i2c_stop(m_i2c_lcd_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
maa_result_t
|
maa_result_t
|
||||||
IICLcd::i2cReg (maa_i2c_context ctx, int deviceAdress, int addr, uint8_t value) {
|
I2CLcd::i2cReg (maa_i2c_context ctx, int deviceAdress, int addr, uint8_t value) {
|
||||||
maa_result_t error = MAA_SUCCESS;
|
maa_result_t error = MAA_SUCCESS;
|
||||||
|
|
||||||
uint8_t data[2] = { addr, value };
|
uint8_t data[2] = { addr, value };
|
||||||
@ -64,7 +64,7 @@ IICLcd::i2cReg (maa_i2c_context ctx, int deviceAdress, int addr, uint8_t value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
maa_result_t
|
maa_result_t
|
||||||
IICLcd::i2Cmd (maa_i2c_context ctx, uint8_t value) {
|
I2CLcd::i2Cmd (maa_i2c_context ctx, uint8_t value) {
|
||||||
maa_result_t error = MAA_SUCCESS;
|
maa_result_t error = MAA_SUCCESS;
|
||||||
|
|
||||||
uint8_t data[2] = { LCD_CMD, value };
|
uint8_t data[2] = { LCD_CMD, value };
|
||||||
@ -75,7 +75,7 @@ IICLcd::i2Cmd (maa_i2c_context ctx, uint8_t value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
maa_result_t
|
maa_result_t
|
||||||
IICLcd::i2cData (maa_i2c_context ctx, uint8_t value) {
|
I2CLcd::i2cData (maa_i2c_context ctx, uint8_t value) {
|
||||||
maa_result_t error = MAA_SUCCESS;
|
maa_result_t error = MAA_SUCCESS;
|
||||||
|
|
||||||
uint8_t data[2] = { LCD_DATA, value };
|
uint8_t data[2] = { LCD_DATA, value };
|
@ -67,9 +67,9 @@ namespace upm {
|
|||||||
#define LCD_RW 0x02 // Read/Write bit
|
#define LCD_RW 0x02 // Read/Write bit
|
||||||
#define LCD_RS 0x01 // Register select bit
|
#define LCD_RS 0x01 // Register select bit
|
||||||
|
|
||||||
class IICLcd {
|
class I2CLcd {
|
||||||
public:
|
public:
|
||||||
IICLcd (int bus, int lcdAddress);
|
I2CLcd (int bus, int lcdAddress);
|
||||||
maa_result_t write (int x, int y, std::string msg);
|
maa_result_t write (int x, int y, std::string msg);
|
||||||
|
|
||||||
virtual maa_result_t write (std::string msg) = 0;
|
virtual maa_result_t write (std::string msg) = 0;
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
using namespace upm;
|
using namespace upm;
|
||||||
|
|
||||||
Jhd1313m1::Jhd1313m1 (int bus, int lcdAddress, int rgbAddress) : IICLcd(bus, lcdAddress) {
|
Jhd1313m1::Jhd1313m1 (int bus, int lcdAddress, int rgbAddress) : I2CLcd(bus, lcdAddress) {
|
||||||
maa_result_t error = MAA_SUCCESS;
|
maa_result_t error = MAA_SUCCESS;
|
||||||
|
|
||||||
m_rgb_address = rgbAddress;
|
m_rgb_address = rgbAddress;
|
||||||
|
@ -24,11 +24,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "iiclcd.h"
|
#include "i2clcd.h"
|
||||||
|
|
||||||
namespace upm {
|
namespace upm {
|
||||||
|
|
||||||
class Jhd1313m1 : public IICLcd {
|
class Jhd1313m1 : public I2CLcd {
|
||||||
public:
|
public:
|
||||||
Jhd1313m1 (int bus, int lcdAddress, int rgbAddress);
|
Jhd1313m1 (int bus, int lcdAddress, int rgbAddress);
|
||||||
~Jhd1313m1 ();
|
~Jhd1313m1 ();
|
||||||
|
21
src/lcd/jsupm_i2clcd.i
Normal file
21
src/lcd/jsupm_i2clcd.i
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
%module jsupm_i2clcd
|
||||||
|
|
||||||
|
%include "i2clcd.h"
|
||||||
|
%{
|
||||||
|
#include "i2clcd.h"
|
||||||
|
%}
|
||||||
|
|
||||||
|
%include "jhd1313m1.h"
|
||||||
|
%{
|
||||||
|
#include "jhd1313m1.h"
|
||||||
|
%}
|
||||||
|
|
||||||
|
%include "lcm1602.h"
|
||||||
|
%{
|
||||||
|
#include "lcm1602.h"
|
||||||
|
%}
|
||||||
|
|
||||||
|
%include "ssd1327.h"
|
||||||
|
%{
|
||||||
|
#include "ssd1327.h"
|
||||||
|
%}
|
@ -1,7 +0,0 @@
|
|||||||
%module jsupm_jhd1313m1
|
|
||||||
|
|
||||||
%{
|
|
||||||
#include "jhd1313m1.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "jhd1313m1.h"
|
|
@ -1,7 +0,0 @@
|
|||||||
%module jsupm_lcm1602
|
|
||||||
|
|
||||||
%{
|
|
||||||
#include "lcm1602.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "lcm1602.h"
|
|
@ -1,7 +0,0 @@
|
|||||||
%module jsupm_ssd1308
|
|
||||||
|
|
||||||
%{
|
|
||||||
#include "ssd1308.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "ssd1308.h"
|
|
@ -1,7 +0,0 @@
|
|||||||
%module jsupm_ssd1327
|
|
||||||
|
|
||||||
%{
|
|
||||||
#include "ssd1327.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "ssd1327.h"
|
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
using namespace upm;
|
using namespace upm;
|
||||||
|
|
||||||
Lcm1602::Lcm1602(int bus_in, int addr_in) : IICLcd (bus_in, addr_in) {
|
Lcm1602::Lcm1602(int bus_in, int addr_in) : I2CLcd (bus_in, addr_in) {
|
||||||
maa_result_t error = MAA_SUCCESS;
|
maa_result_t error = MAA_SUCCESS;
|
||||||
|
|
||||||
usleep(50000);
|
usleep(50000);
|
||||||
|
@ -28,11 +28,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "iiclcd.h"
|
#include "i2clcd.h"
|
||||||
|
|
||||||
namespace upm {
|
namespace upm {
|
||||||
|
|
||||||
class Lcm1602 : public IICLcd {
|
class Lcm1602 : public I2CLcd {
|
||||||
public:
|
public:
|
||||||
/** LCM1602 Constructor.
|
/** LCM1602 Constructor.
|
||||||
* Calls MAA initialisation functions.
|
* Calls MAA initialisation functions.
|
||||||
|
23
src/lcd/pyupm_i2clcd.i
Normal file
23
src/lcd/pyupm_i2clcd.i
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
%module pyupm_i2clcd
|
||||||
|
|
||||||
|
%feature("autodoc", "3");
|
||||||
|
|
||||||
|
%include "i2clcd.h"
|
||||||
|
%{
|
||||||
|
#include "i2clcd.h"
|
||||||
|
%}
|
||||||
|
|
||||||
|
%include "jhd1313m1.h"
|
||||||
|
%{
|
||||||
|
#include "jhd1313m1.h"
|
||||||
|
%}
|
||||||
|
|
||||||
|
%include "lcm1602.h"
|
||||||
|
%{
|
||||||
|
#include "lcm1602.h"
|
||||||
|
%}
|
||||||
|
|
||||||
|
%include "ssd1327.h"
|
||||||
|
%{
|
||||||
|
#include "ssd1327.h"
|
||||||
|
%}
|
@ -1,8 +0,0 @@
|
|||||||
%module pyupm_jhd1313m1
|
|
||||||
|
|
||||||
%feature("autodoc", "3");
|
|
||||||
|
|
||||||
%include "jhd1313m1.h"
|
|
||||||
%{
|
|
||||||
#include "jhd1313m1.h"
|
|
||||||
%}
|
|
@ -1,12 +0,0 @@
|
|||||||
%module pyupm_lcm1602
|
|
||||||
|
|
||||||
%feature("autodoc", "3");
|
|
||||||
|
|
||||||
#ifdef DOXYGEN
|
|
||||||
%include "lcm1602_doc.i"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
%include "lcm1602.h"
|
|
||||||
%{
|
|
||||||
#include "lcm1602.h"
|
|
||||||
%}
|
|
@ -1,8 +0,0 @@
|
|||||||
%module pyupm_ssd1308
|
|
||||||
|
|
||||||
%feature("autodoc", "3");
|
|
||||||
|
|
||||||
%include "ssd1308.h"
|
|
||||||
%{
|
|
||||||
#include "ssd1308.h"
|
|
||||||
%}
|
|
@ -1,8 +0,0 @@
|
|||||||
%module pyupm_ssd1327
|
|
||||||
|
|
||||||
%feature("autodoc", "3");
|
|
||||||
|
|
||||||
%include "ssd1327.h"
|
|
||||||
%{
|
|
||||||
#include "ssd1327.h"
|
|
||||||
%}
|
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
using namespace upm;
|
using namespace upm;
|
||||||
|
|
||||||
SSD1308::SSD1308 (int bus_in, int addr_in) : IICLcd (bus_in, addr_in) {
|
SSD1308::SSD1308 (int bus_in, int addr_in) : I2CLcd (bus_in, addr_in) {
|
||||||
i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_OFF); // display off
|
i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_OFF); // display off
|
||||||
printf ("NO_GDB :: DISPLAY_CMD_OFF \n");
|
printf ("NO_GDB :: DISPLAY_CMD_OFF \n");
|
||||||
usleep (4500);
|
usleep (4500);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "iiclcd.h"
|
#include "i2clcd.h"
|
||||||
|
|
||||||
namespace upm {
|
namespace upm {
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ typedef enum {
|
|||||||
PAGE = 2
|
PAGE = 2
|
||||||
} displayAddressingMode;
|
} displayAddressingMode;
|
||||||
|
|
||||||
class SSD1308 : public IICLcd {
|
class SSD1308 : public I2CLcd {
|
||||||
public:
|
public:
|
||||||
/** SSD1308 Constructor.
|
/** SSD1308 Constructor.
|
||||||
* Calls MAA initialisation functions.
|
* Calls MAA initialisation functions.
|
||||||
|
@ -32,7 +32,7 @@ using namespace upm;
|
|||||||
#define INIT_SLEEP 50000
|
#define INIT_SLEEP 50000
|
||||||
#define CMD_SLEEP 10000
|
#define CMD_SLEEP 10000
|
||||||
|
|
||||||
SSD1327::SSD1327 (int bus_in, int addr_in) : IICLcd (bus_in, addr_in) {
|
SSD1327::SSD1327 (int bus_in, int addr_in) : I2CLcd (bus_in, addr_in) {
|
||||||
maa_result_t error = MAA_SUCCESS;
|
maa_result_t error = MAA_SUCCESS;
|
||||||
usleep (INIT_SLEEP);
|
usleep (INIT_SLEEP);
|
||||||
i2Cmd (m_i2c_lcd_control, 0xFD); // Unlock OLED driver IC MCU interface from entering command. i.e: Accept commands
|
i2Cmd (m_i2c_lcd_control, 0xFD); // Unlock OLED driver IC MCU interface from entering command. i.e: Accept commands
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "iiclcd.h"
|
#include "i2clcd.h"
|
||||||
|
|
||||||
namespace upm {
|
namespace upm {
|
||||||
/*
|
/*
|
||||||
@ -145,7 +145,7 @@ typedef enum {
|
|||||||
PAGE = 2
|
PAGE = 2
|
||||||
} displayAddressingMode;
|
} displayAddressingMode;
|
||||||
|
|
||||||
class SSD1327 : public IICLcd {
|
class SSD1327 : public I2CLcd {
|
||||||
public:
|
public:
|
||||||
/** SSD1308 Constructor.
|
/** SSD1308 Constructor.
|
||||||
* Calls MAA initialisation functions.
|
* Calls MAA initialisation functions.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user