Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Temporarily) fixed issue with RS232 not printing over TX pin on 3rd party devices. (See description) #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/LiquidCrystal_NKC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ void spitransfer(unsigned char var) {
void sendcommand(unsigned char command) {
switch (g_interface) {
case RS232:
Serial.write(0xFE);
Serial.write(command);
Serial1.write(0xFE);
Serial1.write(command);
delayMicroseconds(RS232DELAY);
break;
case I2C:
Expand All @@ -156,9 +156,9 @@ void sendcommand(unsigned char command) {
void sendcommand2(unsigned char command, unsigned char value) {
switch (g_interface) {
case RS232:
Serial.write(0xFE);
Serial.write(command);
Serial.write(value);
Serial1.write(0xFE);
Serial1.write(command);
Serial1.write(value);
delayMicroseconds(RS232DELAY);
break;
case I2C:
Expand Down Expand Up @@ -271,7 +271,7 @@ void LC_NKC::begin() {
delay(500);
switch (g_interface) {
case RS232:
Serial.begin(g_baudrate);
Serial1.begin(g_baudrate);
break;
case I2C:
Wire.begin();
Expand Down Expand Up @@ -332,7 +332,7 @@ void LC_NKC::setContrast(uint8_t new_val) {
size_t LC_NKC::write(uint8_t value) {
switch (g_interface) {
case RS232:
Serial.write(value);
Serial1.write(value);
break;
case I2C:
Wire.beginTransmission(g_i2c_address);
Expand All @@ -352,10 +352,10 @@ void LC_NKC::createChar(unsigned char char_num, unsigned char *rows) {

switch (g_interface) {
case RS232:
Serial.write(0xFE);
Serial.write(LOADCUSTOMCHAR);
Serial.write(char_num);
Serial.write(rows, CUSTOM_CHAR_SIZE);
Serial1.write(0xFE);
Serial1.write(LOADCUSTOMCHAR);
Serial1.write(char_num);
Serial1.write(rows, CUSTOM_CHAR_SIZE);
delayMicroseconds(RS232DELAY);
break;
case I2C:
Expand Down Expand Up @@ -391,7 +391,7 @@ void LC_NKC::print(const String inputStr) {
switch (g_interface) {
case RS232:
for (uint8_t i = 0; i < len; i++) {
Serial.write(inputStr.charAt(i));
Serial1.write(inputStr.charAt(i));
}
break;
case I2C:
Expand All @@ -417,7 +417,7 @@ void LC_NKC::print(const char inputChar[]) {
switch (g_interface) {
case RS232:
while (len--)
Serial.write(*inputChar++);
Serial1.write(*inputChar++);
break;
case I2C:
Wire.beginTransmission(g_i2c_address);
Expand Down