Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 20046

Galileo LiquidCrystal Library Fixes

$
0
0

I've been studying the issues that people have been having trying to get the LiquidCrystal (LCD) library working and have developed a patch that addresses them.  There are two issues that have been reported:

 

1. The library and examples don't work as shipped, but you can sort of get around the problem by reinitializing the LiquidCrystal object with a clumsy init() sequence.

Re: Problems getting LCD to work with Galileo

Re: How to make an LCD shield work on the galileo board using arduino sketch

Root cause: Global LiquidCrystal() constructors call pinMode() and digitalWrite(), which are (apparently) not available at sketch initialization time.

Solution: Defer calls to pinMode() and digitalWrite() to the begin() method, which is typically called after the sketch has started.

 

2. When it does work, it is quite slow.  For example, it takes 3 seconds to display "Hello, World" on my 8x2 display.

Root cause: LiquidCrystal methods depend heavily on Arduino pinMode() and digitalWrite(), which are known to be slow on Galileo (especially pinMode()).  However, the library code can be optimized to call pinMode() only once at begin() time, and not every time a character is drawn.

(Partial) Solution: Optimize the critical path, avoiding unnecessary calls to pinMode.  This basically triples the speed of my LCD refresh (although it's still noticeably slower than running the same sketch on an Arduino Uno).

 

To install, simply do this:

1. Copy the Arduino LiquidCrystal library from its default location at .../libraries/LiquidCrystal to the Galileo-specific library location at .../hardware/arduino/x86/libraries/LiquidCrystal.

2. Replace the LiquidCrystal.cpp file in the "src" subfolder in the NEW (x86) location with the version attached.

3. Exit the Arduino IDE software and restart it.

 

You should now be able to run LCD sketches without the clumsy workarounds suggested by me and others iRe: Problems getting LCD to work with Galileo

You should also notice some speed improvement.

 

Note that I am not on the Galileo team, so this is in no way an official statement or release.


Viewing all articles
Browse latest Browse all 20046

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>