Skip to content

Commit 4cc9363

Browse files
committed
2 parents 9fa4297 + 7d4cfb1 commit 4cc9363

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

src/LiquidCrystal_PCF8574.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ void LiquidCrystal_PCF8574::init(uint8_t i2cAddr, uint8_t rs, uint8_t rw, uint8_
5656
} // init()
5757

5858

59-
void LiquidCrystal_PCF8574::begin(int cols, int lines)
59+
void LiquidCrystal_PCF8574::begin(uint8_t cols, uint8_t lines)
6060
{
6161
_cols = min(cols, 80);
6262
_lines = min(lines, 4);
6363

64-
int functionFlags = 0;
64+
uint8_t functionFlags = 0;
6565

6666
_row_offsets[0] = 0x00;
6767
_row_offsets[1] = 0x40;
@@ -116,10 +116,10 @@ void LiquidCrystal_PCF8574::home()
116116

117117

118118
/// Set the cursor to a new position.
119-
void LiquidCrystal_PCF8574::setCursor(int col, int row)
119+
void LiquidCrystal_PCF8574::setCursor(uint8_t col, uint8_t row)
120120
{
121121
// check boundaries
122-
if ((col >= 0) && (col < _cols) && (row >= 0) && (row < _lines)) {
122+
if ((col < _cols) && (row < _lines)) {
123123
// Instruction: Set DDRAM address = 0x80
124124
_send(0x80 | (_row_offsets[row] + col));
125125
}
@@ -235,7 +235,7 @@ void LiquidCrystal_PCF8574::noAutoscroll(void)
235235
/// Setting the brightness of the background display light.
236236
/// The backlight can be switched on and off.
237237
/// The current brightness is stored in the private _backlight variable to have it available for further data transfers.
238-
void LiquidCrystal_PCF8574::setBacklight(int brightness)
238+
void LiquidCrystal_PCF8574::setBacklight(uint8_t brightness)
239239
{
240240
_backlight = brightness;
241241
// send no data but set the background-pin right;
@@ -245,12 +245,12 @@ void LiquidCrystal_PCF8574::setBacklight(int brightness)
245245

246246
// Allows us to fill the first 8 CGRAM locations
247247
// with custom characters
248-
void LiquidCrystal_PCF8574::createChar(int location, byte charmap[])
248+
void LiquidCrystal_PCF8574::createChar(uint8_t location, byte charmap[])
249249
{
250250
location &= 0x7; // we only have 8 locations 0-7
251251
// Set CGRAM address
252252
_send(0x40 | (location << 3));
253-
for (int i = 0; i < 8; i++) {
253+
for (uint8_t i = 0; i < 8; i++) {
254254
write(charmap[i]);
255255
}
256256
} // createChar()
@@ -290,7 +290,7 @@ void LiquidCrystal_PCF8574::_send(uint8_t value, bool isData)
290290

291291

292292
// write a nibble / halfByte with handshake
293-
void LiquidCrystal_PCF8574::_sendNibble(int halfByte, bool isData)
293+
void LiquidCrystal_PCF8574::_sendNibble(uint8_t halfByte, bool isData)
294294
{
295295
// map the data to the given pin connections
296296
uint8_t data = 0;

src/LiquidCrystal_PCF8574.h

+16-16
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,19 @@ class LiquidCrystal_PCF8574 : public Print
4040
// There is no sda and scl parameter for i2c in any api.
4141
// The Wire library has standard settings that can be overwritten by using Wire.begin(int sda, int scl) before calling LiquidCrystal_PCF8574::begin();
4242

43-
// constructors, which allows to redefine bit assignments in case your adapter is wired differently
43+
// constructors, which allow to redefine bit assignments in case your adapter is wired differently
4444
LiquidCrystal_PCF8574(uint8_t i2cAddr, uint8_t rs, uint8_t enable,
4545
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t backlight=255);
4646
LiquidCrystal_PCF8574(uint8_t i2cAddr, uint8_t rs, uint8_t rw, uint8_t enable,
4747
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t backlight=255);
4848

49-
// Funtions from reference:
49+
// Functions from reference:
5050

51-
void begin(int cols, int rows);
51+
void begin(uint8_t cols, uint8_t rows);
5252

53+
void clear();
5354
void home();
54-
void setCursor(int col, int row);
55+
void setCursor(uint8_t col, uint8_t row);
5556
void cursor();
5657
void noCursor();
5758
void blink();
@@ -64,7 +65,7 @@ class LiquidCrystal_PCF8574 : public Print
6465
void noAutoscroll();
6566
void leftToRight();
6667
void rightToLeft();
67-
void createChar(int, byte[]);
68+
void createChar(uint8_t, byte[]);
6869
#ifdef __AVR__
6970
void createChar_P(uint8_t, const byte *);
7071
inline void createChar(uint8_t n, const byte *data) {
@@ -73,23 +74,22 @@ class LiquidCrystal_PCF8574 : public Print
7374
#endif
7475

7576
// plus functions from LCDAPI:
76-
void clear();
77-
void setBacklight(int brightness);
77+
void setBacklight(uint8_t brightness);
7878
inline void command(uint8_t value) { _send(value); }
7979

8080
// support of Print class
8181
virtual size_t write(uint8_t ch);
8282

8383
private:
8484
// instance variables
85-
int _i2cAddr; ///< Wire Address of the LCD
86-
int _backlight; ///< the backlight intensity
87-
int _cols; ///< number of cols of the display
88-
int _lines; ///< number of lines of the display
89-
int _entrymode; ///<flags from entrymode
90-
int _displaycontrol; ///<flags from displaycontrol
91-
int _row_offsets[4];
92-
85+
uint8_t _i2cAddr; ///< Wire Address of the LCD
86+
uint8_t _backlight; ///< the backlight intensity
87+
uint8_t _cols; ///< number of cols of the display
88+
uint8_t _lines; ///< number of lines of the display
89+
uint8_t _entrymode; ///<flags from entrymode
90+
uint8_t _displaycontrol; ///<flags from displaycontrol
91+
uint8_t _row_offsets[4];
92+
9393
// variables describing how the PCF8574 is connected to the LCD
9494
uint8_t _rs_mask;
9595
uint8_t _rw_mask;
@@ -100,7 +100,7 @@ class LiquidCrystal_PCF8574 : public Print
100100

101101
// low level functions
102102
void _send(uint8_t value, bool isData = false);
103-
void _sendNibble(int halfByte, bool isData = false);
103+
void _sendNibble(uint8_t halfByte, bool isData = false);
104104
void _write2Wire(uint8_t data, bool isData, bool enable);
105105

106106
void init(uint8_t i2cAddr, uint8_t rs, uint8_t rw, uint8_t enable,

0 commit comments

Comments
 (0)