Contiki 3.x
debug-uart.c
1 #include <string.h>
2 #include <MKL25Z4.h>
3 #include "nvic.h"
4 #include "serial.h"
5 #include "debug-uart.h"
6 
7 
8 #define DBG_UART_BAUD 38400
9 
10 void
11 dbg_set_input_handler(void* DBG_Callback_Ptr){
12  UART0_reg_callback(DBG_Callback_Ptr);
13  UART0_IRQ_en();
14 }
15 
16 void
17 dbg_setup_uart_default()
18 {
19  UART0_init(DBG_UART_BAUD);
20 }
21 
22 unsigned int
23 dbg_send_bytes(const unsigned char *seq, unsigned int len)
24 {
25  unsigned int i=0;
26  while(seq && *seq!=0) {
27  if( i >= len) { break; }
28  dbg_putchar(*seq++); i++;
29  }
30  return i;
31 }
32 
33 
34 void
35 dbg_putchar(const char ch)
36 {
37  UART0_PutChar(ch);
38 }
39 
40 void
41 dbg_blocking_putchar(const char ch)
42 {
43  UART0_PutChar(ch);
44 }
45 
unsigned int dbg_send_bytes(const unsigned char *seq, unsigned int len)
Print a stream of bytes.
Definition: debug-uart.c:71
CMSIS Peripheral Access Layer for MKL25Z4.
int dbg_putchar(int c)
Print a character to debug output.
Definition: dbg.c:63
Header file for the MKL25Z NVIC functions.