Fix binary commands, add cgram support

This commit is contained in:
Markus Koch 2018-01-13 12:00:42 +01:00
parent 1de8c24675
commit b4dbad09e9
2 changed files with 30 additions and 5 deletions

@ -1 +1 @@
Subproject commit 1739d5b3ae1f3c8a83237366b3f339fe128b4fdc
Subproject commit 2fc07b393e74ba2b7dbe85824fc0bdd85a30038c

View File

@ -33,6 +33,7 @@ uchar byte_counter = 0;
uchar cmd = 0;
#define BUFSZ 12
char dbuf[BUFSZ];
uchar cmax = 0;
void uartInit(ulong baudrate, uchar parity, uchar stopbits, uchar databits)
{
@ -71,7 +72,13 @@ void uartPoll(void)
while(tx_write_ptr!=tx_read_ptr) {
data = tx_buf[tx_read_ptr];
if ((data < 32) || (data > 127)) { // any control character - cmd done
if (cmax && (byte_counter >= cmax)) {
data = 0;
cmax = 0;
}
if ((!cmax) && ((data < 32) || (data > 127))) { // any control character - cmd done
if (cmd) {
txs("\r\n");
switch (cmd) {
@ -121,6 +128,9 @@ void uartPoll(void)
wdt_enable(WDTO_15MS);
while (1); // WD Timeout -> CPU reset
break;
case 'C':
hcs12ss59t_set_character(dbuf[0], dbuf+1, 1);
break;
case 'h':
case '?':
txs("text : t<12b ASCII>\r\n");
@ -130,6 +140,8 @@ void uartPoll(void)
txs("shift : s<ASCII>...\r\n");
txs(" : S<RAW>...\r\n");
//txs("reset : r / R\r\n");
//txs("cgram : C<adr><2b RAW>\r\n");
break;
default:
ok = 0;
@ -144,8 +156,7 @@ void uartPoll(void)
cmd = 0;
byte_counter = 0;
}
if (data = '\n')
txs("\r\n>");
txs("\r\n>");
} else { // ASCII character
if (cmd == 0) {
echo = 1;
@ -153,9 +164,23 @@ void uartPoll(void)
for (int i = 0; i < BUFSZ; ++i) {
dbuf[i] = 0;
}
switch (cmd) {
case 'T':
cmax = BUFSZ;
break;
case 'B':
cmax = 1;
break;
case 'C':
cmax = 3;
break;
default:
cmax = 0;
break;
}
} else {
if (cmd == 's' || cmd == 'S') {
if (cmd == 's' || cmd == 'S') { // Shift mode
for (int i = 1; i < HCS12SS59T_NUMDIGITS; ++i) {
dbuf[i - 1] = dbuf[i];
}