serial: Add serial_tx_raw() function for sending raw bytes to the serial port

serial_tx() can only be used for NULL-terminated strings, and also adds CR before every LF.

Change-Id: I8c3eafa5bc152bb54abf4629ee76396dc1cb9b8c
This commit is contained in:
Vencislav Atanasov 2025-01-17 01:05:10 +02:00 committed by Solomon Peachy
parent 46eb089f97
commit 8e293b4948
2 changed files with 10 additions and 1 deletions

View file

@ -52,3 +52,11 @@ void serial_tx(const unsigned char * buf)
}
}
}
void serial_tx_raw(const unsigned char * buf, int len)
{
for (int i = 0; i < len; i++) {
while (!tx_rdy());
tx_writec(buf[i]);
}
}

View file

@ -25,7 +25,8 @@
extern void serial_setup(void);
extern void serial_bitrate(int rate);
extern int remote_control_rx(void);
extern void serial_tx(const unsigned char *buf);
extern void serial_tx(const unsigned char * buf);
extern void serial_tx_raw(const unsigned char *buf, int len);
extern void tx_writec(unsigned char c);
extern int tx_rdy(void);