switch(usr_dev->event){
case DEVICE_EVENT_CHANGE:
r_printf("-----%s,DEVICE_EVENT_CHANGE\n",func);
if (!strcmp(e->arg, “uart_rx_overflow”)) {
uart_bus = (const uart_bus_t *)e->u.dev.value;
uart_rxcnt = uart_bus->read(uart_rxbuf, sizeof(uart_rxbuf), 0);
if (uart_rxcnt) {
printf(“get_buffer:\n”);
for (int i = 0; i < uart_rxcnt; i++) {
my_put_u8hex(uart_rxbuf[i]);
if (i % 16 == 15) {
putchar(’\n’);
}
}
if (uart_rxcnt % 16) {
putchar(’\n’);
}
uart_bus->write(uart_rxbuf, uart_rxcnt);
}
}
if (!strcmp(e->arg, “uart_rx_outtime”)) {
uart_bus = (const uart_bus_t *)e->u.dev.value;
uart_rxcnt = uart_bus->read(uart_rxbuf, sizeof(uart_rxbuf), 0);
if (uart_rxcnt) {
printf(“get_buffer:\n”);
for (int i = 0; i < uart_rxcnt; i++) {
my_put_u8hex(uart_rxbuf[i]);
if (i % 16 == 15) {
putchar(’\n’);
}
}
if (uart_rxcnt % 16) {
putchar(’\n’);
}
uart_bus->write(uart_rxbuf, uart_rxcnt);
}
}
break;
default:
g_printf("—other event ----\n");
break;
}
}
杰里之开启串口 test 功能会复位问题【篇】
最新推荐文章于 2024-02-01 08:53:37 发布