diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2008-05-07 18:24:49 +0000 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2008-05-07 18:24:49 +0000 |
commit | 4b2b39e383d7fec0f94deb0f9a75a493bce2d0ca (patch) | |
tree | 43c30ba64a83d21416e640cd532a5cd4198b4f55 /libraries/LiquidCrystal/LiquidCrystal.cpp | |
parent | 2d5bc015fbd70befc08c2295630ff06770e9d7c8 (diff) |
Changing Print class to use regular virtual write() function (instead of my hack
ed together version).
Diffstat (limited to 'libraries/LiquidCrystal/LiquidCrystal.cpp')
-rwxr-xr-x | libraries/LiquidCrystal/LiquidCrystal.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libraries/LiquidCrystal/LiquidCrystal.cpp b/libraries/LiquidCrystal/LiquidCrystal.cpp index c5acc85..b5f2cd4 100755 --- a/libraries/LiquidCrystal/LiquidCrystal.cpp +++ b/libraries/LiquidCrystal/LiquidCrystal.cpp @@ -26,7 +26,7 @@ LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, - uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7) : Print(baseWrite), + uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7) : _four_bit_mode(0), _rs_pin(rs), _rw_pin(rw), _enable_pin(enable) { _data_pins[0] = d0; @@ -52,7 +52,7 @@ LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable, } LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3) : Print(baseWrite), + uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3) : _four_bit_mode(1), _rs_pin(rs), _rw_pin(rw), _enable_pin(enable) { _data_pins[0] = d0; @@ -91,11 +91,15 @@ void LiquidCrystal::setCursor(int col, int row) command(0x80 | (col + row_offsets[row])); } -void LiquidCrystal::command(int value) { - write(value, LOW); +void LiquidCrystal::command(uint8_t value) { + send(value, LOW); } -void LiquidCrystal::write(int value, int mode) { +void LiquidCrystal::write(uint8_t value) { + send(value, HIGH); +} + +void LiquidCrystal::send(uint8_t value, uint8_t mode) { digitalWrite(_rs_pin, mode); digitalWrite(_rw_pin, LOW); @@ -122,7 +126,3 @@ void LiquidCrystal::write(int value, int mode) { digitalWrite(_enable_pin, LOW); } } - -void baseWrite(uint8_t value, void *instance) { - ((LiquidCrystal *) instance)->write(value); -} |