line dump seems to work

This commit is contained in:
jaseg 2021-07-14 16:08:54 +02:00
parent 05c02ab7a7
commit 837ceef6e3
2 changed files with 28 additions and 12 deletions

View file

@ -297,14 +297,16 @@ int main(void)
con_printf("loop");
while (23) {
/*
uint8_t rd_buf[128];
ssize_t rv = con_read_until(rd_buf, sizeof(rd_buf), '\n');
if (rv < 0) {
con_printf("USART rx error\r\n");
}
con_printf("Received %d bytes: %s\r\n", rv, rd_buf);
*/
con_printf(" #%u", i);
con_printf_blocking(" #%u", i);
if (k == 0)
spif_printf(&spif, "\33[1m");
if (k == 1)
@ -315,7 +317,7 @@ int main(void)
spif_printf(&spif, "\033[3%dm", k-4+1);
if (k >= 12 && k < 20)
spif_printf(&spif, "\033[9%dm", k-12+1);
spif_printf(&spif, "loop #%u \033[4%dmloop #u \033[10%dmloop #u\033[0m\n", i, k%8, (k+1)%8);
spif_printf(&spif, "loop #%u \033[4%dmloop #%u \033[10%dmloop #%u\033[0m\n", i, k%8, (k+1)%8);
i++;
k = (k + 1) % 40;
if (k == 0) {
@ -323,17 +325,32 @@ int main(void)
uint8_t buf[4096];
spif_capture_read(&spif, sizeof(buf), buf);
con_printf("\r\n");
con_printf("\r\n");
con_printf("buffer capture:\r\n");
for (size_t e=0; e<sizeof(buf); e += 16) {
con_printf_blocking("\r\n");
con_printf_blocking("\r\n");
con_printf_blocking("buffer capture:\r\n");
for (size_t e=0; e<sizeof(buf); e += 27) {
uint8_t *p = buf + e;
con_printf(" %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\r\n",
p[0x00], buf[0x01], buf[0x02], buf[0x03], buf[0x04], buf[0x05], buf[0x06], buf[0x07],
p[0x08], buf[0x09], buf[0x0a], buf[0x0b], buf[0x0c], buf[0x0d], buf[0x0e], buf[0x0f]);
con_printf_blocking(" ");
for (size_t j=0; j<27 && e+j < sizeof(buf); j++) {
if (j%3 == 0)
con_printf_blocking("\033[91m");
else if (j%3 == 1)
con_printf_blocking("\033[92m");
else if (j%3 == 2)
con_printf_blocking("\033[94m");
con_printf_blocking("%02x", p[j]);
if (j == 9-1 || j == 18-1)
con_printf_blocking(" ");
else if (j == 27-1)
con_printf_blocking("\033[0m\r\n");
else if (j > 0 && j%3 == 2)
con_printf_blocking(" ");
}
}
con_printf("\r\n");
con_printf("loop");
con_printf_blocking("\033[0m\r\n");
con_printf_blocking("loop");
}
for (int j=0; j<1000000; j++) {

View file

@ -262,7 +262,6 @@ int usart_printf(volatile struct usart_desc *us, const char *fmt, ...) {
va_list va;
va_start(va, fmt);
tfp_format((void *)us, usart_putc_nonblocking_tpf, fmt, va);
return usart_flush(us);
}
int usart_printf_blocking_va(volatile struct usart_desc *us, const char *fmt, va_list va) {