RT-AICHIP-sample
debug.c
[詳解]
1 /* ------------------------------------------------------------ *
2 File debug.c
3 
4 デバッグ用関数群
5 * ------------------------------------------------------------ */
6 
7 #include <stdarg.h>
8 #include <stdio.h>
9 
10 #include "LPC13xx.h"
11 #include "core_cm3.h"
12 #include "type.h"
13 
14 #include "uart.h"
15 #include "usbTransmission.h"
16 
17 /* ------------------------------------------------------------ *
18  Input *fmt, ... printf()と同じフォーマット
19  Output dat.num データ長
20 
21  printf()のフォーマットでUSBから文字列を出力
22 * ------------------------------------------------------------ */
23 int myPrintfUSB(const char *fmt, ...){
24  GETDAT_T dat;
25 
26  va_list ap;
27  va_start(ap, fmt);
28 
29  dat.num = vsprintf(&dat.d[0], fmt, ap);
30  VCOM_SendData(dat);
31  VCOM_CheckState ();
32 
33  va_end(ap);
34  return dat.num;
35 }
36 /* ------------------------------------------------------------ *
37  Input *fmt, ... printf()と同じフォーマット
38  Output dat.num データ長
39 
40  printf()のフォーマットでUARTで文字列を出力
41 * ------------------------------------------------------------ */
42 int myPrintfUART(const char *fmt, ...){
43  static char buffer[100];
44  int len;
45 
46  va_list ap;
47  va_start(ap, fmt);
48 
49  len = vsprintf(buffer, fmt, ap);
50 
51  UARTSend(buffer, len );
52 
53  va_end(ap);
54  return len;
55 }
56 
57 
58 
59 /******************************************************************************
60 ** End Of File
61 ******************************************************************************/
CMSIS Cortex-M3 Core Peripheral Access Layer Header File.
void UARTSend(uint8_t *BufferPtr, uint32_t Length)
Definition: uart.c:165
int myPrintfUART(const char *fmt,...)
Definition: debug.c:42
void VCOM_SendData(GETDAT_T dat)
uint8_t d[100]
int myPrintfUSB(const char *fmt,...)
Definition: debug.c:23
void VCOM_CheckState(void)