From fbe0e4d00ba7e026b8b848cfcd0ed583a71f8069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 7 Mar 2017 10:10:09 +0100 Subject: Just huge update --- src/error.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/error.c (limited to 'src/error.c') diff --git a/src/error.c b/src/error.c new file mode 100644 index 0000000..1c75382 --- /dev/null +++ b/src/error.c @@ -0,0 +1,40 @@ +#include +#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_hight(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 */ -- cgit v1.2.3