mirror of
https://github.com/eclipse/upm.git
synced 2025-07-02 01:41:12 +03:00
lcd/lcm1602/jhd1313m1: remove lcm1602 and jhd1313m1 from lcd library
The lcm1602 and jhd1313m1 drivers had been rewritten in C with a C++ wrapper some time ago, however the original lcm and jhd drivers were still present in the lcd library. In addition, to avoid header file conflicts, the new, separated lcm and jhd header files were renamed with a .hxx prefix. This patch: - renames the new lcm1602/ and jhd1313m1/ header files to have the usual .hpp prefix. - removes the lcm1602, jhd1313m1, and sainsmartks drivers from the lcd/ (i2clcd) library. - fixes the examples to use the "new" libraries (lcm1602 and jhd1313m1) - changes the argument type for the createChar() (C++) to use a byte vector (std::vector<uint8_t>) rather than a typedef'd char array. The lcm1602_create_char() function (C) uses a standard char *. The use of std::vector is well supported by SWIG. - SWIG interface files changed to use upm_vectortypes.i, and removes the carrays helpers, which should no longer be needed for these drivers. - removes the inclusion of the driver C .h header files into the SWIG interface files - this should not be needed for these drivers. - the sainsmartks driver will be placed into it's own new lcdks (LCD Keypad Shield) library. This library should support the SainsmartKS, DFRobot LCD Keypad Shield, and similar products from other manufacturers in a future commit. Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
@ -2,8 +2,7 @@ upm_mixed_module_init (NAME lcm1602
|
||||
DESCRIPTION "LCD Display Driver for the LCM1602 Controller for HD44780-based Displays"
|
||||
C_HDR lcm1602.h
|
||||
C_SRC lcm1602.c
|
||||
CPP_HDR lcm1602.hxx
|
||||
CPP_HDR lcm1602.hpp
|
||||
CPP_SRC lcm1602.cxx
|
||||
# FTI_SRC lcm1602_fti.c
|
||||
CPP_WRAPS_C
|
||||
REQUIRES mraa)
|
||||
|
@ -1,32 +1,11 @@
|
||||
%module javaupm_lcm1602
|
||||
%include "../upm.i"
|
||||
%include "stdint.i"
|
||||
%include "../upm_vectortypes.i"
|
||||
%include "typemaps.i"
|
||||
%include "arrays_java.i";
|
||||
|
||||
%apply signed char[] {uint8_t []};
|
||||
%ignore BasicFont;
|
||||
|
||||
%typemap(jni) (uint8_t *data, int bytes) "jbyteArray";
|
||||
%typemap(jtype) (uint8_t *data, int bytes) "byte[]";
|
||||
%typemap(jstype) (uint8_t *data, int bytes) "byte[]";
|
||||
|
||||
%typemap(javain) (uint8_t *data, int bytes) "$javainput";
|
||||
|
||||
%typemap(in) (uint8_t *data, int bytes) {
|
||||
$1 = (uint8_t *) JCALL2(GetByteArrayElements, jenv, $input, NULL);
|
||||
$2 = JCALL1(GetArrayLength, jenv, $input);
|
||||
}
|
||||
|
||||
%typemap(freearg) (uint8_t *data, int bytes) {
|
||||
JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
|
||||
}
|
||||
|
||||
%include "lcm1602.h"
|
||||
%include "lcm1602.hxx"
|
||||
|
||||
%include "lcm1602.hpp"
|
||||
%{
|
||||
#include "lcm1602.hxx"
|
||||
#include "lcm1602.hpp"
|
||||
%}
|
||||
|
||||
%pragma(java) jniclasscode=%{
|
||||
|
@ -1,9 +1,8 @@
|
||||
%module jsupm_lcm1602
|
||||
%include "../upm.i"
|
||||
%include "../carrays_uint8_t.i"
|
||||
%include "../upm_vectortypes.i"
|
||||
|
||||
%include "lcm1602.h"
|
||||
%include "lcm1602.hxx"
|
||||
%include "lcm1602.hpp"
|
||||
%{
|
||||
#include "lcm1602.hxx"
|
||||
#include "lcm1602.hpp"
|
||||
%}
|
||||
|
@ -377,7 +377,7 @@ upm_result_t lcm1602_home(const lcm1602_context dev)
|
||||
|
||||
upm_result_t lcm1602_create_char(const lcm1602_context dev,
|
||||
unsigned int slot,
|
||||
lcm1602_custom_char_t data)
|
||||
char *data)
|
||||
{
|
||||
assert(dev != NULL);
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <stdexcept>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "lcm1602.hxx"
|
||||
#include "lcm1602.hpp"
|
||||
|
||||
using namespace upm;
|
||||
|
||||
@ -86,9 +86,9 @@ upm_result_t Lcm1602::home()
|
||||
}
|
||||
|
||||
upm_result_t Lcm1602::createChar(uint8_t charSlot,
|
||||
lcm1602_custom_char_t charData)
|
||||
std::vector<uint8_t> charData)
|
||||
{
|
||||
return lcm1602_create_char(m_lcm1602, charSlot, charData);
|
||||
return lcm1602_create_char(m_lcm1602, charSlot, (char *)charData.data());
|
||||
}
|
||||
|
||||
upm_result_t Lcm1602::displayOn()
|
||||
|
@ -81,11 +81,6 @@ extern "C" {
|
||||
uint8_t backlight;
|
||||
} *lcm1602_context;
|
||||
|
||||
/**
|
||||
* Custom character.
|
||||
*/
|
||||
typedef char lcm1602_custom_char_t[8];
|
||||
|
||||
/**
|
||||
* LCM1602 I2C initialization. This is used for those devices
|
||||
* using an I2C expander, or other I2C interface. If you are
|
||||
@ -181,7 +176,7 @@ extern "C" {
|
||||
*/
|
||||
upm_result_t lcm1602_create_char(const lcm1602_context dev,
|
||||
unsigned int slot,
|
||||
lcm1602_custom_char_t data);
|
||||
char *data);
|
||||
|
||||
/**
|
||||
* Turn the display on.
|
||||
|
@ -34,6 +34,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "lcm1602.h"
|
||||
|
||||
namespace upm
|
||||
@ -144,11 +145,11 @@ namespace upm
|
||||
* Create a custom character
|
||||
*
|
||||
* @param charSlot the character slot to write, only 8 are available
|
||||
* @param charData The character data (8 bytes) making up the character
|
||||
* @param charData A vector containing 8 bytes making up the character
|
||||
* @return Result of operation
|
||||
*/
|
||||
upm_result_t createChar(uint8_t charSlot,
|
||||
lcm1602_custom_char_t charData);
|
||||
std::vector<uint8_t> charData);
|
||||
|
||||
/**
|
||||
* Turn the display on
|
@ -2,12 +2,11 @@
|
||||
%include "pyupm_doxy2swig.i"
|
||||
%module pyupm_lcm1602
|
||||
%include "../upm.i"
|
||||
%include "../carrays_uint8_t.i"
|
||||
%include "../upm_vectortypes.i"
|
||||
|
||||
%feature("autodoc", "3");
|
||||
|
||||
%include "lcm1602.h"
|
||||
%include "lcm1602.hxx"
|
||||
%include "lcm1602.hpp"
|
||||
%{
|
||||
#include "lcm1602.hxx"
|
||||
#include "lcm1602.hpp"
|
||||
%}
|
||||
|
Reference in New Issue
Block a user