mirror of
https://github.com/satoshinm/pill_6502.git
synced 2024-12-27 17:29:19 +00:00
Disable local echo, add ^E to toggle
This commit is contained in:
parent
a6f3f87b97
commit
56f6172eea
12
src/cdcacm.c
12
src/cdcacm.c
@ -192,6 +192,8 @@ void cdcacm_send_chunked_blocking(char *buf, int len, usbd_device *dev) {
|
||||
extern char *process_serial_command(char b);
|
||||
extern void *process_serial_input_byte(char b);
|
||||
|
||||
bool local_echo = false;
|
||||
|
||||
static void usbuart_usb_out_cb(usbd_device *dev, uint8_t ep)
|
||||
{
|
||||
(void)ep;
|
||||
@ -207,10 +209,12 @@ static void usbuart_usb_out_cb(usbd_device *dev, uint8_t ep)
|
||||
for(int i = 0; i < len; i++) {
|
||||
gpio_toggle(GPIOC, GPIO13);
|
||||
|
||||
// Echo back what was typed
|
||||
// Enter sends a CR, but an LF is needed to advance to next line
|
||||
if (buf[i] == '\r') reply_buf[j++] = '\n';
|
||||
reply_buf[j++] = buf[i];
|
||||
// If enabled, echo back what was typed
|
||||
if (local_echo) {
|
||||
// Enter sends a CR, but an LF is needed to advance to next line
|
||||
if (buf[i] == '\r') reply_buf[j++] = '\n';
|
||||
reply_buf[j++] = buf[i];
|
||||
}
|
||||
|
||||
char *response = process_serial_command(buf[i]);
|
||||
if (response) {
|
||||
|
10
src/main.c
10
src/main.c
@ -103,6 +103,7 @@ static void usb_reset()
|
||||
paused = false;
|
||||
}
|
||||
|
||||
extern bool local_echo;
|
||||
char *process_serial_command(char b) {
|
||||
if (b == '\x16') { // ^V
|
||||
return "Pill 6502 version " FIRMWARE_VERSION;
|
||||
@ -113,12 +114,15 @@ char *process_serial_command(char b) {
|
||||
reset6502();
|
||||
paused = false;
|
||||
return "reset";
|
||||
} else if (b == '\x14') { // T
|
||||
} else if (b == '\x05') { // ^E
|
||||
local_echo = !local_echo;
|
||||
return local_echo ? "local echo enabled" : "local echo disabled";
|
||||
} else if (b == '\x14') { // ^T
|
||||
static char buf[64];
|
||||
snprintf(buf, sizeof(buf), "%ld ticks\r\n%ld instructions", clockticks6502, instructions);
|
||||
return buf;
|
||||
} else if (b == '\x07') { // G
|
||||
return "^V=version ^R=reset ^P=pause ^T=ticks ^G=help";
|
||||
} else if (b == '\x07') { // ^G
|
||||
return "^V=version ^R=reset ^E=echo ^P=pause ^T=ticks ^G=help";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user