-
Notifications
You must be signed in to change notification settings - Fork 59
Hd44780 mcp23 x17 #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
There are many issues with this pull request - as is, I cannot accept it. An i/o class in the hd44780 library is much more than just a simple header file and a simple single .ino file. Before I could consider a pull request for a new i/o class, it will need to meet some additional requirements.
And all those example files must be updated with appropriate comments documenting the i/o class. There are readme files in the source code tree that will need to be updated.
The Documentation.ino sketch will need to be updated to reflect the new i/o class. There is a wiki page for the i/o class that will need to be created This i/o class depends on another 3rd party library - currently no other i/o class has a 3rd party library dependency. If the i/o class depends on a certain revision of the IDE (or newer), that creates some issues as well since currently the hd47480 library an all its i/o classes can run on any IDE version back to 1.0.1 - and is currently documented as such. Beyond that, there are some issues with the actual code. There is no need to do the keypad check since that is specific to the LCD keypad shield which does not apply to this h/w. i/o classes are implemented as .h files to allow future templating. If you don't want to implement backlight support you don't need to provide a iosetBackight() function. In terms of initialization, a high priority goal of the hd44780 library is that the only thing that should have to be changed when switching between i/o classes (LCD device h/w interfaces) is things outside any of the sketch code. Another big concern I have is the io class's dependency on an object outside the i/o class code that is declared & defined inside the user sketch code. Not saying I would outright reject the i/o class because of this but it does create some concerns. The issue of single vs multiple LCD support can have a big impact on examples and documentation. So that is kind of a high level view of what I'd be expecting from a new i/o class to be added to the library. Looking forward, here is some news on the hd44780 library. I'm also in the process of adding some new i/o classes to replace the current i/o class that use i2c interfaces. |
|
I just don’t have the time needed :/ |
|
Yeah, it is a bunch of work, to fully integrate into the library. I'm curious what the performance for that i/o class is. |
|
how is this better or worse than the direct io? |
|
Here are some numbers all run on ESP8266 which is what I believe you used as well. You can see direct pin control in 4 bit mode is much faster at 52us The i2c MCP23XXX parts will always be slower than the PCF8574 given it requires a byte across the bus to set up the port register for every data transfer - which in 4 bit mode is every nibble. Not surprised that the numbers are so slow given the mode of operation and using the Adafruit library. I pretty much lost interest in the MCP parts when the PCF8574 based backpacks started coming out for less than $1 USD shipped to your door. In this case, SPI uses more pins, the pins have to be configured by the user, and it ends up being significantly slower than a super cheap ready made i2c solution. |
|
I’m using it just because it’s the simplest solution, I’m already using spi, so only one pin more (only one pin free on my setup). |
|
One question, why you’re not initialize hardware only in lcd.init? |
|
Not quite sure of your questions about lcd.init() From an API perspective, there is a long history of the the APIs used by Arduino libraries to control a hd44780 LCD. LCD API 1.0 was created as an attempt to standardize an API since at the time things were all over the place with not common API. hd44780 LCD libraries used very different APIs, and initialization. The APIs are similar but slightly different. The "LiquidCrystal" API is what has been implemented in the LiquidCrystal library. The LiquidCrystal library calls its low level h/w initalization in its init() function. This is very problematic.
To work for all h/w environments, the library API needs an initialization function that can be called from the user sketch code, typically the setup() function. This is late enough that any Arduino resources can be used as well as interrupts. So the issue of init() vs begin() comes down to which API. but it really is an internal function. If the intent was to provide an init() function to comply with LCD API 1.0 then it was a total failure since what they did is not how LCD API1.0 defined init() nor can it ever be portable across platforms. The hd44780 library accommodates both APIs as much is technically possible. |
|
My mistake, I wanted to say lcd.begin… |
Not sure I follow.
Because it is slower. On the AVR even with direct pin control using the digital i/o API (digitalRead(), digitalWrite(), pinMode() ) If using 4 bit mode, it is still the same problem because while you only have 4 data pins, you now have two nibbles Now for clear() and home() there could be a a benefit, assuming the LCD processes it in less than 2ms. Other interfaces can't send the data as fast as the instruction time. The hd44780 library is smart about its delays. Other LCD libraries do a blind delay for the full instruction time immediately after sending the instruction. I would not use the Adafruit library when using a MCP23XXX to control an LCD. If using the hd44780 library, the i/o class source code would likely be smaller (fewer lines of code) than what you have now, for sure if you tossed out support for reads. As I recall those dual port MCP chips have a h/w issue in their design where you can't tell what register banking mode the chip is in which can can and will cause initialization issues, if you use one of the banking modes to optimize performance. IMO, it is a major screwup. ---- bill |
Simple (based on arduino direct io) IO lib that works using a mcp23S17 to control an LCD, i'm using Adafruit_MCP23X17 lib so it should play nice with all supported ic's.
Tested with webmos D1 mini and a 20x4 text lcd