SCLD peripheral of the KL46Z - with sign "-" just for USB Academy
Dependents: KL46Z-Lab2_lodz KL46Z-Lab2_fullll KL46Z-Lab2_szkolenie kL46Z-Lab3-lodz ... more
Fork of SLCD by
Revision 12:f5cc1eb350cf, committed 2014-03-27
- Comitter:
- liborgecnuk
- Date:
- Thu Mar 27 12:34:25 2014 +0000
- Parent:
- 11:ef2b3b7f1b01
- Commit message:
- USB Academy
Changed in this revision
diff -r ef2b3b7f1b01 -r f5cc1eb350cf FRDM-s401.h --- a/FRDM-s401.h Sun Mar 23 19:55:14 2014 +0000 +++ b/FRDM-s401.h Thu Mar 27 12:34:25 2014 +0000 @@ -1,4 +1,5 @@ #pragma once + /*^^^^^^^^^^^^^^^^ LCD HARDWARE CONECTION ^^^^^^^^^^^^^^^^^^^^^^^^*/ #define _LCDFRONTPLANES (8) // # of frontPlanes #define _LCDBACKPLANES (4) // # of backplanes @@ -95,3 +96,4 @@ extern const uint8_t WF_ORDERING_TABLE[]; // Logical Front plane N to LCD_WFx +
diff -r ef2b3b7f1b01 -r f5cc1eb350cf SLCD.cpp --- a/SLCD.cpp Sun Mar 23 19:55:14 2014 +0000 +++ b/SLCD.cpp Thu Mar 27 12:34:25 2014 +0000 @@ -81,6 +81,7 @@ ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = ^, offset=184 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = _, offset=188 ( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = `, offset=192 + (!SEGD+!SEGE+!SEGF+ SEGG) , (!SEGC+!SEGB+!SEGA) ,//Char = -, offset=196 //LG+ added '-' }; SLCD::SLCD() @@ -175,8 +176,11 @@ lbValue -= 32; // UpperCase } if (lbValue<ASCCI_TABLE_START || lbValue >ASCCI_TABLE_END) { + if (lbValue!='-') //LG+ lbValue = BLANK_CHARACTER; // default value as space } + //if(lbValue=='-') lbValue += (-ASCCI_TABLE_START+3+(196)/4); else //LG+ + if(lbValue=='-') lbValue = 196/4; else //LG+ lbValue -=ASCCI_TABLE_START; // Remove the offset to search in the ascci table arrayOffset = (lbValue * _CHAR_SIZE); // Compensate matrix offset // ensure bLCD position is in valid limit @@ -195,7 +199,7 @@ CharPosition++; } -void SLCD::Home() +void SLCD::Home (void) { CharPosition = 0; } @@ -267,11 +271,11 @@ DP(2, mode==1); } -void SLCD::Colon (bool on) +void SLCD::Colon (int mode) { uint8_t *lbpLCDWF; lbpLCDWF = (uint8_t *)&LCD->WF8B[0]; - if (on) { + if (mode==1) { lbpLCDWF[(uint8_t)WF_ORDERING_TABLE[7]]|=1; } else { lbpLCDWF[(uint8_t)WF_ORDERING_TABLE[7]]&=~1;
diff -r ef2b3b7f1b01 -r f5cc1eb350cf SLCD.h --- a/SLCD.h Sun Mar 23 19:55:14 2014 +0000 +++ b/SLCD.h Thu Mar 27 12:34:25 2014 +0000 @@ -1,6 +1,8 @@ #pragma once + #include "mbed.h" + /* ------ sample usage------ #include "mbed.h" @@ -27,55 +29,20 @@ } */ -/** -* SLCD peripheral of the FRDM-KL46Z\n -Inherits mbed::Stream and supports the majority of Stream functions. - -@code -#include "mbed.h" -#include "SLCD.h" - -SLCD slcd; - -main() -{ - slcd.Home(); // Moves cursor to position 0 (start) - slcd.printf("1.2.3.4"); // Standard printf function, only characters in ASCII_TO_WF_CODIFICATION_TABLE will display - // Dots printed using decimal points - slcd.putc('A'); // Prints a single character - - while(1); // Wait forever -} -@endcode -*/ class SLCD : public Stream { public: - //! Construct an SLCD object SLCD(); - //! Move the SLCD cursor to the first character - void Home(); - /** - * Set contrast - * @param lbContrast 0 - 15, 0 lightest, 15 darkest - */ + void Home (void); void Contrast (uint8_t lbContrast); void All_Segments (int); - //! Turn off all segments void clear(); - /** - * Turn a decimal point on or off - * @param pos decimal point position: 0-2 - * @param on True or False - */ void DP(int pos, bool on); void DP1 (int); void DP2 (int); void DP3 (int); - //! Turn the colon symbol on or off - void Colon (bool on); - //! Current cursor position + void Colon (int); uint8_t CharPosition; void blink(int blink = 3); void deepsleepEnable(bool enable);