Updated patch to work with Arduino IDE 1.5 and above.

Using: digitalPinHasPWM and digitalPinToTimer.
This commit is contained in:
fmalpartida
2015-02-27 19:38:56 +01:00
parent c21bff22f4
commit 4d2be4cdfd
3 changed files with 13 additions and 3 deletions
+11 -1
View File
@@ -168,9 +168,20 @@ void LiquidCrystal::setBacklight ( uint8_t value )
// --------------------------------------------------- // ---------------------------------------------------
if ( _backlightPin != LCD_NOBACKLIGHT ) if ( _backlightPin != LCD_NOBACKLIGHT )
{ {
// Check if the pin is associated to a timer, i.e. PWM // Check if the pin is associated to a timer, i.e. PWM
// We dont need to use != NOT_ON_TIMER hack to detect PWM and
// 1.5x Arduino and above has a macro to check for PWM capability
// on a pin.
// --------------------------------------------------- // ---------------------------------------------------
#if digitalPinHasPWM
if(digitalPinHasPWM(_backlightPin))
#elif digitalPinToTimer
// On older 1.x Arduino have to check using hack
if(digitalPinToTimer(_backlightPin) != NOT_ON_TIMER) if(digitalPinToTimer(_backlightPin) != NOT_ON_TIMER)
#else
if(0) // if neither of the above we assume no PWM
#endif
{ {
// Check for control polarity inversion // Check for control polarity inversion
// --------------------------------------------------- // ---------------------------------------------------
@@ -296,4 +307,3 @@ void LiquidCrystal::writeNbits(uint8_t value, uint8_t numBits)
pulseEnable(); pulseEnable();
} }
+1 -1
View File
@@ -388,7 +388,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<a name="l00304"></a>00304 } <a name="l00304"></a>00304 }
<a name="l00305"></a>00305 <a name="l00305"></a>00305
<a name="l00306"></a>00306 <span class="preprocessor">#ifdef __AVR__</span> <a name="l00306"></a>00306 <span class="preprocessor">#ifdef __AVR__</span>
<a name="l00307"></a>00307 <span class="preprocessor"></span><span class="keywordtype">void</span> <a class="code" href="class_l_c_d.html#a91cba8f93c692abcddf8bc3de58d2d3a">LCD::createChar</a>(uint8_t location, <span class="keyword">const</span> prog_uchar charmap[]) <a name="l00307"></a>00307 <span class="preprocessor"></span><span class="keywordtype">void</span> <a class="code" href="class_l_c_d.html#a91cba8f93c692abcddf8bc3de58d2d3a">LCD::createChar</a>(uint8_t location, <span class="keyword">const</span> char *charmap)
<a name="l00308"></a>00308 { <a name="l00308"></a>00308 {
<a name="l00309"></a>00309 location &amp;= 0x7; <span class="comment">// we only have 8 memory locations 0-7</span> <a name="l00309"></a>00309 location &amp;= 0x7; <span class="comment">// we only have 8 memory locations 0-7</span>
<a name="l00310"></a>00310 <a name="l00310"></a>00310
+1 -1
View File
@@ -252,7 +252,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<a name="l00387"></a>00387 <a name="l00387"></a>00387
<a name="l00388"></a>00388 <span class="preprocessor">#ifdef __AVR__</span> <a name="l00388"></a>00388 <span class="preprocessor">#ifdef __AVR__</span>
<a name="l00389"></a>00389 <span class="preprocessor"></span> <a name="l00389"></a>00389 <span class="preprocessor"></span>
<a name="l00407"></a>00407 <span class="keywordtype">void</span> <a class="code" href="class_l_c_d.html#a91cba8f93c692abcddf8bc3de58d2d3a">createChar</a>(uint8_t location, <span class="keyword">const</span> prog_uchar charmap[]); <a name="l00407"></a>00407 <span class="keywordtype">void</span> <a class="code" href="class_l_c_d.html#a91cba8f93c692abcddf8bc3de58d2d3a">createChar</a>(uint8_t location, <span class="keyword">const</span> char *charmap);
<a name="l00408"></a>00408 <span class="preprocessor">#endif // __AVR__</span> <a name="l00408"></a>00408 <span class="preprocessor">#endif // __AVR__</span>
<a name="l00409"></a>00409 <span class="preprocessor"></span> <a name="l00409"></a>00409 <span class="preprocessor"></span>
<a name="l00419"></a>00419 <span class="keywordtype">void</span> <a class="code" href="class_l_c_d.html#a48220450fd152b25994eb7d0ba340e8d">setCursor</a>(uint8_t col, uint8_t row); <a name="l00419"></a>00419 <span class="keywordtype">void</span> <a class="code" href="class_l_c_d.html#a48220450fd152b25994eb7d0ba340e8d">setCursor</a>(uint8_t col, uint8_t row);