-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug.h
42 lines (33 loc) · 885 Bytes
/
debug.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* File: debug.h
* Author: Guillaume Fournier-Mayer
*
* Created on 25. Juli 2020, 14:54
*
* A module to send some debug data over the USART interface.
* This modules works in a blocking way!
*/
#ifndef USART_H
#define USART_H
#define F_CPU 1000000UL
#define BAUD 9600
/**
* Initialize the USART Interface to 8 databits and 1 stopbit
* and sends a "new Line"
*/
void usart_init();
/**
* Sends the passed string character by character by use of "usart_send_c".
* @param s The string to send.
*/
void usart_send_s(const char *s);
/**
* Debug makro that is used to send some data over the USART interface.
* If DEBUG is false, the code should be optimized by the compiler.
*/
#define debug_print(...) \
if(DEBUG){\
char buffer[100];\
sprintf(buffer, __VA_ARGS__);\
usart_send_s(buffer);}
#endif /* USART_H */