Conversions for the LCD display in FRDM-KL46Z

Dependents:   eem202a_display eem202a_resolutedreamer_1

convert.h

Committer:
Waldek
Date:
2014-04-19
Revision:
2:9467805cb02b
Parent:
1:cf83568dc17a
Child:
3:551fe797c723

File content as of revision 2:9467805cb02b:

#pragma once

#include "SLCD.h"

/*-------------------------------------------------------------

(c) W.D. 2014

-------------------------------------------------------------*/

/*  ------ sample usage------
Convert slcd;

    while (true) 
    {
        wait(1.);
        slcd.display(99999);            //  OFL
        wait(2.);
        slcd.display(9999);             //  9999
        wait(1.);
        slcd.display(-999);             //  -999
        wait(1.);
        slcd.display(-99999);           // -OFL
        wait(2.);
        slcd.display(99999.0);          //  OFL
        wait(1.);
        slcd.display(1000.0);           // 1000
        wait(1.);
        slcd.display(200.0);            // 200.0
        wait(1.);
        slcd.display(30.0);             // 30.00
        wait(1.);
        slcd.display(4.0);              // 4.000
        wait(1.);
        slcd.display((float)0.5);       // 0.500
        wait(1.);
        slcd.display((double)0.0);      //     0
        wait(1.);
        slcd.display((float)-0.6);      // -0.60
        wait(1.);
        slcd.display((double)-7.0);     // -7.00
        wait(1.);
        slcd.display((float)-80.0);    // -80.0
        wait(1.);
        slcd.display((double)-900.0);   // -900
        wait(1.);
        slcd.display(-12345.0);  // -OFL
        wait(1.);
    }
*/

class Convert : public SLCD
{
public: 
    Convert();
    bool display(unsigned int number);
    bool display(int number);
    bool display(double number);
    bool display(float number);
    bool display(char *text);
private:
    void display_digits(unsigned int number, bool negate=false);
    void prepare(void);
};