summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rwxr-xr-xsrc/main.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/main.c b/src/main.c
index ca88f6a..82dcc5f 100755
--- a/src/main.c
+++ b/src/main.c
@@ -48,11 +48,16 @@
/******************************************************************************
******* macros ***************************************************************
******************************************************************************/
-#define DEBUG_MODE (true)
+#define DEBUG_MODE (false)
+/* Can be a value of <enum Project_SysClk_Source> */
#define PROJECT_SYSCLK_SOURCE (PROJECT_SYSCLK_FROM_PLL_MSI)
-#define PROJECT_COMPONENT (PROJECT_COMPONENT_OFF)
+/* Can be a value of <enum Project_Component> */
+#define PROJECT_COMPONENT (PROJECT_COMPONENT_CTRL)
+
+/* Can be a value of <enum Stuck_4ever_LED_State> */
+#define STUCK_4EVER_LED_STATE (STUCK_4EVER_LED_ON)
/******************************************************************************
@@ -71,6 +76,11 @@
PROJECT_COMPONENT_ACT
};
+ enum Stuck_4ever_LED_State {
+ STUCK_4EVER_LED_OFF = false,
+ STUCK_4EVER_LED_ON = true
+ };
+
/******************************************************************************
******* structs **************************************************************
@@ -101,29 +111,25 @@ noreturn int main (void)
{
HAL_Init();
- if (sysclk_config()) {
+ if (sysclk_config())
goto err_clk;
- }
if (DEBUG_MODE) {
- if (test()) {
+ if (test())
goto err;
- }
}
- if (proc_init()) {
+ if (proc_init())
goto err;
- }
- if (proc()) {
+ if (proc())
goto err;
- }
err:
prj_error_handle();
err_clk:
- stuck_forever(false);
+ stuck_forever(STUCK_4EVER_LED_STATE);
}
@@ -142,6 +148,8 @@ static int sysclk_config (void)
return sysclk_config_pll_hsi();
case PROJECT_SYSCLK_FROM_PLL_MSI:
return sysclk_config_pll_msi();
+ default:
+ return ERROR_NOK;
}
}
@@ -178,15 +186,13 @@ static int proc (void)
static noreturn void stuck_forever (bool led)
{
- if (led) {
+ if (led)
led_set();
- } else {
+ else
led_reset();
- }
- while (true) {
+ while (true)
__WFI();
- }
}