|
@ -0,0 +1,39 @@ |
|
|
|
|
|
#include "sys.h" |
|
|
|
|
|
static void timers_init(void) { |
|
|
|
|
|
ret_code_t err_code = app_timer_init(); |
|
|
|
|
|
APP_ERROR_CHECK(err_code); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void log_init(void) { |
|
|
|
|
|
ret_code_t err_code = NRF_LOG_INIT(NULL); |
|
|
|
|
|
APP_ERROR_CHECK(err_code); |
|
|
|
|
|
|
|
|
|
|
|
NRF_LOG_DEFAULT_BACKENDS_INIT(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**@brief Function for initializing power management. |
|
|
|
|
|
*/ |
|
|
|
|
|
static void power_management_init(void) { |
|
|
|
|
|
ret_code_t err_code; |
|
|
|
|
|
err_code = nrf_pwr_mgmt_init(); |
|
|
|
|
|
APP_ERROR_CHECK(err_code); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void idle_state_handle(void) { |
|
|
|
|
|
if (NRF_LOG_PROCESS() == false) { |
|
|
|
|
|
nrf_pwr_mgmt_run(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void zsys_init() { |
|
|
|
|
|
log_init(); |
|
|
|
|
|
timers_init(); |
|
|
|
|
|
power_management_init(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void zsys_loop() { |
|
|
|
|
|
while (true) { |
|
|
|
|
|
idle_state_handle(); |
|
|
|
|
|
} |
|
|
|
|
|
} |