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 Erik -

Committer:
liborgecnuk
Date:
Thu Mar 27 12:34:25 2014 +0000
Revision:
12:f5cc1eb350cf
Parent:
11:ef2b3b7f1b01
USB Academy

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Tomo2k 10:dae947a658f0 1 #pragma once
liborgecnuk 12:f5cc1eb350cf 2
Sissors 0:d04758e76d5b 3 #include "mbed.h"
Sissors 0:d04758e76d5b 4
liborgecnuk 12:f5cc1eb350cf 5
star297 3:f70873bc6121 6 /* ------ sample usage------
star297 3:f70873bc6121 7
star297 3:f70873bc6121 8 #include "mbed.h"
star297 3:f70873bc6121 9 #include "SLCD.h"
Tomo2k 6:f4773221794b 10
star297 3:f70873bc6121 11 SLCD slcd;
Tomo2k 6:f4773221794b 12
star297 3:f70873bc6121 13 main()
star297 3:f70873bc6121 14 {
Tomo2k 8:99e4215cfc11 15 slcd.printf("1.2.3.4"); // standard printf function, only charaters in ASCII_TO_WF_CODIFICATION_TABLE will display
Tomo2k 8:99e4215cfc11 16 // Dots printed using decimal points
Tomo2k 8:99e4215cfc11 17 slcd.putc('A'); // prints a single character
Tomo2k 8:99e4215cfc11 18 slcd.clear(); // All segments off
Tomo2k 6:f4773221794b 19 slcd.All_Segments(y); // y=1 for ALL segments on, 0 for ALL segments off
Tomo2k 8:99e4215cfc11 20 slcd.DP(x, true/false); // Set/Clear decimal point. x=0, 1 or 2.
Tomo2k 8:99e4215cfc11 21 // Does nothing if invalid decimal point
Tomo2k 8:99e4215cfc11 22 slcd.DPx(y); // x=DP1 to DP3, y=1 for on 0 for off (legacy)
star297 3:f70873bc6121 23 slcd.Colon(y); // y=1 for on, 0 for off
star297 3:f70873bc6121 24 slcd.CharPosition=x; // x=0 to 3, 0 is start position
star297 3:f70873bc6121 25 slcd.Home(); // sets next charater to posistion 0 (start)
Sissors 4:ec7b3c9b2aeb 26 slcd.Contrast (x); // set contrast x=0 - 15, 0 lightest, 15 darkest
Sissors 4:ec7b3c9b2aeb 27 slcd.blink(x); // set display to blink, 0-7 is blink rate (default = 3), -1 disables blink
Sissors 4:ec7b3c9b2aeb 28 slcd.deepsleepEnable(x);// true (default) keeps the lcd enabled in deepsleep, false disables its 4MHz internal oscillator clock. Total power consumption ~= 40uA
Tomo2k 6:f4773221794b 29 }
star297 3:f70873bc6121 30 */
star297 3:f70873bc6121 31
Tomo2k 6:f4773221794b 32 class SLCD : public Stream
Tomo2k 6:f4773221794b 33 {
Tomo2k 6:f4773221794b 34 public:
Sissors 0:d04758e76d5b 35 SLCD();
Tomo2k 6:f4773221794b 36
liborgecnuk 12:f5cc1eb350cf 37 void Home (void);
star297 3:f70873bc6121 38 void Contrast (uint8_t lbContrast);
Tomo2k 6:f4773221794b 39 void All_Segments (int);
Tomo2k 7:0e084b33d730 40 void clear();
Tomo2k 7:0e084b33d730 41 void DP(int pos, bool on);
star297 3:f70873bc6121 42 void DP1 (int);
star297 3:f70873bc6121 43 void DP2 (int);
star297 3:f70873bc6121 44 void DP3 (int);
liborgecnuk 12:f5cc1eb350cf 45 void Colon (int);
star297 3:f70873bc6121 46 uint8_t CharPosition;
Sissors 4:ec7b3c9b2aeb 47 void blink(int blink = 3);
Sissors 4:ec7b3c9b2aeb 48 void deepsleepEnable(bool enable);
Tomo2k 6:f4773221794b 49
Tomo2k 6:f4773221794b 50 private:
Sissors 5:6e3c11967108 51 void Write_Char(char lbValue);
Sissors 4:ec7b3c9b2aeb 52 void init();
Sissors 0:d04758e76d5b 53 virtual int _putc(int c);
Sissors 0:d04758e76d5b 54 virtual int _getc() {
Sissors 0:d04758e76d5b 55 return 0;
Tomo2k 6:f4773221794b 56 }
Sissors 0:d04758e76d5b 57 };