From cefd0601b91fa642163c82021d454b3c17d8adf4 Mon Sep 17 00:00:00 2001 From: Jan Sucan Date: Sun, 22 Sep 2019 21:17:50 +0200 Subject: Initial commit --- FanController/fan_controller/error.c | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 FanController/fan_controller/error.c (limited to 'FanController/fan_controller/error.c') diff --git a/FanController/fan_controller/error.c b/FanController/fan_controller/error.c new file mode 100644 index 0000000..66ad2f9 --- /dev/null +++ b/FanController/fan_controller/error.c @@ -0,0 +1,47 @@ +/* Autor: Ján Sučan + * + * Zdrojove kody, ich casti a subory z nich vzniknute priamo alebo nepriamo + * (objektove subory, Intel Hex, ...) prosim nepouzivajte komercne, ani ako + * sucast komercnych diel. Vsetky ostatne pripady pouzitia su dovolene. + * + * Please don't use the source codes, their parts and files created from them + * directly or indirectly, (object files, Intel Hex files, ...) for commercial + * purposes, not even as a part of commercial products. All other use cases + * are allowed. + */ + +#include +#include +#include + +/** Pocet milisekund periody blikania LED pri chybe. Polovicu periody su LED zasvietene a polovicu zhasnute. */ +#define ERROR_BLINK_PERIOD_MS 1000U // ms + +/** + * @brief Funkcia pre indikaciu chyby blikanim LED. + * + * Blikaju vsetky zelene a cervena LED naraz. Tato funkcia + * sa vola pri detekcii zastavenia ventilatora ale aj pri + * lubovolnej dalsej chybe (napr. chyba argumentov nejakej + * funkcie). Spracovanie programu sa z tejto funkcie uz + * nedostane. + */ +void +error(void) +{ + while (1) + { + // Zasvietit LED + led_min_green_on(); + led_green_bar_show_by_mask(0xff); + led_red_on(); + // Pockat + delay_ms(ERROR_BLINK_PERIOD_MS / 2); + // Zhasnut LED + led_min_green_off(); + led_green_bar_show_by_mask(0x00); + led_red_off(); + // Pockat + delay_ms(ERROR_BLINK_PERIOD_MS / 2); + } +} \ No newline at end of file -- cgit v1.2.3