|
|
|
|
|
|
|
|
#include "avr/pgmspace.h" |
|
|
#include "avr/pgmspace.h" |
|
|
#include <stdarg.h> |
|
|
#include <stdarg.h> |
|
|
#include "imxrt.h" |
|
|
#include "imxrt.h" |
|
|
|
|
|
#include "usb_desc.h" |
|
|
|
|
|
|
|
|
void putchar_debug(char c); |
|
|
void putchar_debug(char c); |
|
|
static void puint_debug(unsigned int num); |
|
|
static void puint_debug(unsigned int num); |
|
|
|
|
|
|
|
|
printf_debug(buf + i); |
|
|
printf_debug(buf + i); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// first is this normal Serial? |
|
|
|
|
|
#if defined(PRINT_DEBUG_USING_USB) && defined(CDC_STATUS_INTERFACE) && defined(CDC_DATA_INTERFACE) |
|
|
|
|
|
#include "usb_dev.h" |
|
|
|
|
|
#include "usb_serial.h" |
|
|
|
|
|
FLASHMEM void putchar_debug(char c) |
|
|
|
|
|
{ |
|
|
|
|
|
usb_serial_putchar(c); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FLASHMEM void printf_debug_init(void) {} |
|
|
|
|
|
|
|
|
|
|
|
#elif defined(PRINT_DEBUG_USING_USB) && defined(SEREMU_INTERFACE) && !defined(CDC_STATUS_INTERFACE) && !defined(CDC_DATA_INTERFACE) |
|
|
|
|
|
#include "usb_dev.h" |
|
|
|
|
|
#include "usb_seremu.h" |
|
|
|
|
|
FLASHMEM void putchar_debug(char c) |
|
|
|
|
|
{ |
|
|
|
|
|
usb_seremu_putchar(c); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FLASHMEM void printf_debug_init(void) {} |
|
|
|
|
|
|
|
|
|
|
|
#else |
|
|
FLASHMEM void putchar_debug(char c) |
|
|
FLASHMEM void putchar_debug(char c) |
|
|
{ |
|
|
{ |
|
|
while (!(LPUART3_STAT & LPUART_STAT_TDRE)) ; // wait |
|
|
while (!(LPUART3_STAT & LPUART_STAT_TDRE)) ; // wait |
|
|
|
|
|
|
|
|
LPUART3_BAUD = LPUART_BAUD_OSR(25) | LPUART_BAUD_SBR(8); // ~115200 baud |
|
|
LPUART3_BAUD = LPUART_BAUD_OSR(25) | LPUART_BAUD_SBR(8); // ~115200 baud |
|
|
LPUART3_CTRL = LPUART_CTRL_TE; |
|
|
LPUART3_CTRL = LPUART_CTRL_TE; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|