Browse Source

lcd: rename from iiclcd to i2clcd, add swig

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
Thomas Ingleby 10 years ago
parent
commit
0050f92b06

+ 4
- 11
src/lcd/CMakeLists.txt View File

1
 set (libname "i2clcd")
1
 set (libname "i2clcd")
2
-add_library (i2clcd SHARED iiclcd.cxx lcm1602.cxx jhd1313m1.cxx ssd1308.cxx ssd1327.cxx)
3
-include_directories (${MAA_INCLUDE_DIR})
4
-target_link_libraries (i2clcd ${MAA_LIBRARIES})
5
-
6
-install (TARGETS ${libname} DESTINATION lib/upm COMPONENT ${libname})
7
-install (FILES iiclcd.h DESTINATION include/upm COMPONENT ${libname})
8
-
9
-if (IPK)
10
-  cpack_add_component (${libname} DISPLAY_NAME ${libname} REQUIRED INSTALL_TYPES all)
11
-  set(CPACK_COMPONENT_${libname}_DESCRIPTION "libupm lcd")
12
-endif()
2
+set (libdescription "upm lcd/oled displays")
3
+set (module_src i2clcd.cxx lcm1602.cxx jhd1313m1.cxx ssd1308.cxx ssd1327.cxx)
4
+set (module_h i2clcd.h lcm1602.h jhd1313m1.h ssd1308.h ssd1327.h)
5
+upm_module_init()

src/lcd/iiclcd.cxx → src/lcd/i2clcd.cxx View File

25
 #include <iostream>
25
 #include <iostream>
26
 #include <unistd.h>
26
 #include <unistd.h>
27
 
27
 
28
-#include "iiclcd.h"
28
+#include "i2clcd.h"
29
 
29
 
30
 using namespace upm;
30
 using namespace upm;
31
 
31
 
32
-IICLcd::IICLcd (int bus, int lcdAddress) {
32
+I2CLcd::I2CLcd (int bus, int lcdAddress) {
33
     m_lcd_control_address = lcdAddress;
33
     m_lcd_control_address = lcdAddress;
34
     m_bus = bus;
34
     m_bus = bus;
35
 
35
 
42
 }
42
 }
43
 
43
 
44
 maa_result_t
44
 maa_result_t
45
-IICLcd::write (int row, int column, std::string msg) {
45
+I2CLcd::write (int row, int column, std::string msg) {
46
     setCursor (row, column);
46
     setCursor (row, column);
47
     write (msg);
47
     write (msg);
48
 }
48
 }
49
 
49
 
50
 maa_result_t
50
 maa_result_t
51
-IICLcd::close() {
51
+I2CLcd::close() {
52
     return maa_i2c_stop(m_i2c_lcd_control);
52
     return maa_i2c_stop(m_i2c_lcd_control);
53
 }
53
 }
54
 
54
 
55
 maa_result_t
55
 maa_result_t
56
-IICLcd::i2cReg (maa_i2c_context ctx, int deviceAdress, int addr, uint8_t value) {
56
+I2CLcd::i2cReg (maa_i2c_context ctx, int deviceAdress, int addr, uint8_t value) {
57
     maa_result_t error = MAA_SUCCESS;
57
     maa_result_t error = MAA_SUCCESS;
58
 
58
 
59
     uint8_t data[2] = { addr, value };
59
     uint8_t data[2] = { addr, value };
64
 }
64
 }
65
 
65
 
66
 maa_result_t
66
 maa_result_t
67
-IICLcd::i2Cmd (maa_i2c_context ctx, uint8_t value) {
67
+I2CLcd::i2Cmd (maa_i2c_context ctx, uint8_t value) {
68
     maa_result_t error = MAA_SUCCESS;
68
     maa_result_t error = MAA_SUCCESS;
69
 
69
 
70
     uint8_t data[2] = { LCD_CMD, value };
70
     uint8_t data[2] = { LCD_CMD, value };
75
 }
75
 }
76
 
76
 
77
 maa_result_t
77
 maa_result_t
78
-IICLcd::i2cData (maa_i2c_context ctx, uint8_t value) {
78
+I2CLcd::i2cData (maa_i2c_context ctx, uint8_t value) {
79
     maa_result_t error = MAA_SUCCESS;
79
     maa_result_t error = MAA_SUCCESS;
80
 
80
 
81
     uint8_t data[2] = { LCD_DATA, value };
81
     uint8_t data[2] = { LCD_DATA, value };

src/lcd/iiclcd.h → src/lcd/i2clcd.h View File

67
 #define LCD_RW 0x02 // Read/Write bit
67
 #define LCD_RW 0x02 // Read/Write bit
68
 #define LCD_RS 0x01 // Register select bit
68
 #define LCD_RS 0x01 // Register select bit
69
 
69
 
70
-class IICLcd {
70
+class I2CLcd {
71
     public:
71
     public:
72
-        IICLcd (int bus, int lcdAddress);
72
+        I2CLcd (int bus, int lcdAddress);
73
         maa_result_t write (int x, int y, std::string msg);
73
         maa_result_t write (int x, int y, std::string msg);
74
         
74
         
75
         virtual maa_result_t write (std::string msg) = 0;
75
         virtual maa_result_t write (std::string msg) = 0;

+ 1
- 1
src/lcd/jhd1313m1.cxx View File

29
 
29
 
30
 using namespace upm;
30
 using namespace upm;
31
 
31
 
32
-Jhd1313m1::Jhd1313m1 (int bus, int lcdAddress, int rgbAddress) : IICLcd(bus, lcdAddress) {
32
+Jhd1313m1::Jhd1313m1 (int bus, int lcdAddress, int rgbAddress) : I2CLcd(bus, lcdAddress) {
33
     maa_result_t error = MAA_SUCCESS;
33
     maa_result_t error = MAA_SUCCESS;
34
 
34
 
35
     m_rgb_address = rgbAddress;
35
     m_rgb_address = rgbAddress;

+ 2
- 2
src/lcd/jhd1313m1.h View File

24
 #pragma once
24
 #pragma once
25
 
25
 
26
 #include <string>
26
 #include <string>
27
-#include "iiclcd.h"
27
+#include "i2clcd.h"
28
 
28
 
29
 namespace upm {
29
 namespace upm {
30
 
30
 
31
-class Jhd1313m1 : public IICLcd {
31
+class Jhd1313m1 : public I2CLcd {
32
     public:
32
     public:
33
         Jhd1313m1 (int bus, int lcdAddress, int rgbAddress);
33
         Jhd1313m1 (int bus, int lcdAddress, int rgbAddress);
34
         ~Jhd1313m1 ();
34
         ~Jhd1313m1 ();

+ 21
- 0
src/lcd/jsupm_i2clcd.i View File

1
+%module jsupm_i2clcd
2
+
3
+%include "i2clcd.h"
4
+%{
5
+    #include "i2clcd.h"
6
+%}
7
+
8
+%include "jhd1313m1.h"
9
+%{
10
+    #include "jhd1313m1.h"
11
+%}
12
+
13
+%include "lcm1602.h"
14
+%{
15
+    #include "lcm1602.h"
16
+%}
17
+
18
+%include "ssd1327.h"
19
+%{
20
+    #include "ssd1327.h"
21
+%}

+ 0
- 7
src/lcd/jsupm_jhd1313m1.i View File

1
-%module jsupm_jhd1313m1
2
-
3
-%{
4
-    #include "jhd1313m1.h"
5
-%}
6
-
7
-%include "jhd1313m1.h"

+ 0
- 7
src/lcd/jsupm_lcm1602.i View File

1
-%module jsupm_lcm1602
2
-
3
-%{
4
-    #include "lcm1602.h"
5
-%}
6
-
7
-%include "lcm1602.h"

+ 0
- 7
src/lcd/jsupm_ssd1308.i View File

1
-%module jsupm_ssd1308
2
-
3
-%{
4
-    #include "ssd1308.h"
5
-%}
6
-
7
-%include "ssd1308.h"

+ 0
- 7
src/lcd/jsupm_ssd1327.i View File

1
-%module jsupm_ssd1327
2
-
3
-%{
4
-    #include "ssd1327.h"
5
-%}
6
-
7
-%include "ssd1327.h"

+ 1
- 1
src/lcd/lcm1602.cxx View File

32
 
32
 
33
 using namespace upm;
33
 using namespace upm;
34
 
34
 
35
-Lcm1602::Lcm1602(int bus_in, int addr_in) : IICLcd (bus_in, addr_in) {
35
+Lcm1602::Lcm1602(int bus_in, int addr_in) : I2CLcd (bus_in, addr_in) {
36
     maa_result_t error = MAA_SUCCESS;
36
     maa_result_t error = MAA_SUCCESS;
37
 
37
 
38
     usleep(50000);
38
     usleep(50000);

+ 2
- 2
src/lcd/lcm1602.h View File

28
 #pragma once
28
 #pragma once
29
 
29
 
30
 #include <string>
30
 #include <string>
31
-#include "iiclcd.h"
31
+#include "i2clcd.h"
32
 
32
 
33
 namespace upm {
33
 namespace upm {
34
 
34
 
35
-class Lcm1602 : public IICLcd {
35
+class Lcm1602 : public I2CLcd {
36
     public:
36
     public:
37
         /** LCM1602 Constructor.
37
         /** LCM1602 Constructor.
38
          * Calls MAA initialisation functions.
38
          * Calls MAA initialisation functions.

+ 23
- 0
src/lcd/pyupm_i2clcd.i View File

1
+%module pyupm_i2clcd
2
+
3
+%feature("autodoc", "3");
4
+
5
+%include "i2clcd.h"
6
+%{
7
+    #include "i2clcd.h"
8
+%}
9
+
10
+%include "jhd1313m1.h"
11
+%{
12
+    #include "jhd1313m1.h"
13
+%}
14
+
15
+%include "lcm1602.h"
16
+%{
17
+    #include "lcm1602.h"
18
+%}
19
+
20
+%include "ssd1327.h"
21
+%{
22
+    #include "ssd1327.h"
23
+%}

+ 0
- 8
src/lcd/pyupm_jhd1313m1.i View File

1
-%module pyupm_jhd1313m1
2
-
3
-%feature("autodoc", "3");
4
-
5
-%include "jhd1313m1.h"
6
-%{
7
-    #include "jhd1313m1.h"
8
-%}

+ 0
- 12
src/lcd/pyupm_lcm1602.i View File

1
-%module pyupm_lcm1602
2
-
3
-%feature("autodoc", "3");
4
-
5
-#ifdef DOXYGEN
6
-%include "lcm1602_doc.i"
7
-#endif
8
-
9
-%include "lcm1602.h"
10
-%{
11
-    #include "lcm1602.h"
12
-%}

+ 0
- 8
src/lcd/pyupm_ssd1308.i View File

1
-%module pyupm_ssd1308
2
-
3
-%feature("autodoc", "3");
4
-
5
-%include "ssd1308.h"
6
-%{
7
-    #include "ssd1308.h"
8
-%}

+ 0
- 8
src/lcd/pyupm_ssd1327.i View File

1
-%module pyupm_ssd1327
2
-
3
-%feature("autodoc", "3");
4
-
5
-%include "ssd1327.h"
6
-%{
7
-    #include "ssd1327.h"
8
-%}

+ 1
- 1
src/lcd/ssd1308.cxx View File

29
 
29
 
30
 using namespace upm;
30
 using namespace upm;
31
 
31
 
32
-SSD1308::SSD1308 (int bus_in, int addr_in) : IICLcd (bus_in, addr_in) {
32
+SSD1308::SSD1308 (int bus_in, int addr_in) : I2CLcd (bus_in, addr_in) {
33
     i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_OFF);  // display off
33
     i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_OFF);  // display off
34
     printf ("NO_GDB :: DISPLAY_CMD_OFF \n");
34
     printf ("NO_GDB :: DISPLAY_CMD_OFF \n");
35
     usleep (4500);
35
     usleep (4500);

+ 2
- 2
src/lcd/ssd1308.h View File

25
 #pragma once
25
 #pragma once
26
 
26
 
27
 #include <string>
27
 #include <string>
28
-#include "iiclcd.h"
28
+#include "i2clcd.h"
29
 
29
 
30
 namespace upm {
30
 namespace upm {
31
 
31
 
145
     PAGE          =  2
145
     PAGE          =  2
146
 } displayAddressingMode;
146
 } displayAddressingMode;
147
 
147
 
148
-class SSD1308 : public IICLcd {
148
+class SSD1308 : public I2CLcd {
149
     public:
149
     public:
150
         /** SSD1308 Constructor.
150
         /** SSD1308 Constructor.
151
          * Calls MAA initialisation functions.
151
          * Calls MAA initialisation functions.

+ 1
- 1
src/lcd/ssd1327.cxx View File

32
 #define INIT_SLEEP 50000
32
 #define INIT_SLEEP 50000
33
 #define CMD_SLEEP  10000
33
 #define CMD_SLEEP  10000
34
 
34
 
35
-SSD1327::SSD1327 (int bus_in, int addr_in) : IICLcd (bus_in, addr_in) {
35
+SSD1327::SSD1327 (int bus_in, int addr_in) : I2CLcd (bus_in, addr_in) {
36
     maa_result_t error  = MAA_SUCCESS;
36
     maa_result_t error  = MAA_SUCCESS;
37
     usleep (INIT_SLEEP);
37
     usleep (INIT_SLEEP);
38
     i2Cmd (m_i2c_lcd_control, 0xFD); // Unlock OLED driver IC MCU interface from entering command. i.e: Accept commands
38
     i2Cmd (m_i2c_lcd_control, 0xFD); // Unlock OLED driver IC MCU interface from entering command. i.e: Accept commands

+ 2
- 2
src/lcd/ssd1327.h View File

25
 #pragma once
25
 #pragma once
26
 
26
 
27
 #include <string>
27
 #include <string>
28
-#include "iiclcd.h"
28
+#include "i2clcd.h"
29
 
29
 
30
 namespace upm {
30
 namespace upm {
31
 /*
31
 /*
145
     PAGE          =  2
145
     PAGE          =  2
146
 } displayAddressingMode;
146
 } displayAddressingMode;
147
 
147
 
148
-class SSD1327 : public IICLcd {
148
+class SSD1327 : public I2CLcd {
149
     public:
149
     public:
150
         /** SSD1308 Constructor.
150
         /** SSD1308 Constructor.
151
          * Calls MAA initialisation functions.
151
          * Calls MAA initialisation functions.