aboutsummaryrefslogtreecommitdiff
path: root/src/error.c
blob: 9f4166b3b4341dd3baeac54546a75cdf98133f7a (plain)
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
#include <error.h>
#ifdef CONFIG_ERRORS

#ifdef CONFIG_EH_LED
#include "ioport.h"
#endif /* CONFIG_EH_LED */

#ifdef CONFIG_ERROR_MESSAGES
void _error(enum ErrorCodes ec, const char *msg) {
#ifdef CONFIG_ERROR_CALLBACK
	error_callback(ec, msg);
#endif
#else /* CONFIG_ERROR_MESSAGES */
void _error(enum ErrorCodes ec) {
#ifdef CONFIG_ERROR_CALLBACK
	error_callback(ec);
#endif
#endif /* CONFIG_ERROR_MESSAGES */

	// OK error code means no error.
	if (ec == EC_OK)
		return;

#ifdef CONFIG_EH_LED
	// Set led
	io_setout(CONFIG_EH_LED_IOPIN);
	io_high(CONFIG_EH_LED_IOPIN);
#endif /* CONFIG_EH_LED */

#ifdef CONFIG_EH_HANGS
	// TODO
#endif /* CONFIG_EH_HANGS */

#ifdef CONFIG_EH_RESTART
	// TODO
#endif /* CONFIG_EH_RESTART */
}


#endif /* CONFIG_ERRORS */