Subversion Repositories libCharLCD

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
#pragma once
2
 
3
#include "libCharLCD/lcdInterface.h"
4
 
5
class lcd_t
6
{
7
public:
8
        lcd_t(lcdType_t type_,      ///< LCD type code
9
              ioline_t rsBit_,      ///< LCD register select bit
10
              ioline_t wrBit_,      ///< LCD register write bit
11
              ioline_t eBit_,       ///< LCD enable bit
12
              lcdDataLines_t dBits_ ///< LCD data bits
13
              )
14
            : m_lcd(type_, rsBit_, wrBit_, eBit_, dBits_){};
15
 
16
        // initialise the display
17
        void init();
18
 
19
        /// \brief clear the display
20
        void clear();
21
 
22
        /// \brief Enable or disable the display
23
        void enable(bool ena_);
24
 
25
        /// \brief Return the X size (8, 10,16, or 20) of this display
26
        uint8_t displayXsize() const { return m_lcd.displayXsize(); }
27
 
28
        /// \brief Return the Y size (1 or 2) of this display
29
        uint8_t displayYsize() const { return m_lcd.displayYsize(); }
30
 
31
        /// \brief set cursor position
32
        void gotoxy(uint8_t x_, uint8_t y_);
33
 
34
        /// \brief Print a string on the LCD: will terminate on null character or count_
35
        /// characters printed , whichever is first.
36
        ///
37
        /// \param str_ Null terminated string
38
        ///
39
        /// \param count_ Maximum number of characters to print
40
        void printString(char *str_, uint8_t count_ = 255);
41
        void printString(char const *str_, uint8_t count_ = 255);
42
 
43
        /// \brief provides a buffer to format a number into, then uses format_num.
44
        /// \param digits, total digit width including decimal point and sign character
45
        /// \param dp_pos Decimal point position within number counting digits from right
46
        /// \param val value to print
47
        void font_digits(uint8_t digits, uint8_t dp_pos, int val);
48
 
49
        /// \brief Define one of 8 user defined graphics
50
        /// \param code : Graphics code from 0..7
51
        /// \param rows : bits 4:0 of rows 0:6 define character .
52
        void defineChar(uint8_t code, uint8_t const *rows);
53
        void defineChar(uint8_t code, uint8_t * rows);
54
 
55
private:
56
        /// \brief formats an integer value with a decimal point in a particular position
57
        /// \param buff Workspace buffer
58
        /// \param digits, total digit width including decimal point and sign character
59
        /// \param dp_pos Decimal point position within number counting digits from right
60
        /// \param val value to print
61
        uint8_t format_num(char *buff, uint8_t digits, uint8_t dp_pos, int val);
62
 
63
        lcdInterface_t m_lcd;
64
};