From b83365010e8338a41988426f879243208714c44f Mon Sep 17 00:00:00 2001 From: root Date: Mon, 7 Sep 2015 18:43:44 +0100 Subject: fish --- crypto/main.c | 47 ++++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) (limited to 'crypto/main.c') diff --git a/crypto/main.c b/crypto/main.c index 2a1c05c..4f15694 100644 --- a/crypto/main.c +++ b/crypto/main.c @@ -26,33 +26,7 @@ * Also it would accept pairing requests from any peer device. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "bsp/bsp.h" -#include -#include "bsp/bsp_btn_ble.h" -#include -#include -#include -#include -#include -#include -#include +#include "project.h" #if BUTTONS_NUMBER <2 #error "Not enough resources on board" @@ -203,6 +177,8 @@ static sensorsim_state_t m_battery_sim_state; static app_timer_id_t m_battery_timer_id; /**< Battery timer. */ +static app_timer_id_t sd_timer_id; + static dm_application_instance_t m_app_handle; /**< Application identifier allocated by device manager. */ static dm_handle_t m_bonded_peer_handle; /**< Device reference handle to the current bonded central. */ static bool m_caps_on = false; /**< Variable to indicate if Caps Lock is turned on. */ @@ -305,6 +281,12 @@ static void battery_level_update(void) } } +static void sd_timeout_handler(void * p_context) +{ + UNUSED_PARAMETER(p_context); + sd_doodle(); +} + /**@brief Function for handling the Battery measurement timer timeout. * @@ -335,6 +317,11 @@ static void timers_init(void) APP_TIMER_MODE_REPEATED, battery_level_meas_timeout_handler); APP_ERROR_CHECK(err_code); + + err_code = app_timer_create(&sd_timer_id, + APP_TIMER_MODE_REPEATED, + sd_timeout_handler); + APP_ERROR_CHECK(err_code); } @@ -610,6 +597,9 @@ static void timers_start(void) err_code = app_timer_start(m_battery_timer_id, BATTERY_LEVEL_MEAS_INTERVAL, NULL); APP_ERROR_CHECK(err_code); + + err_code = app_timer_start(sd_timer_id, APP_TIMER_TICKS(10,APP_TIMER_PRESCALER),NULL); + APP_ERROR_CHECK(err_code); } @@ -1486,6 +1476,9 @@ int main(void) conn_params_init(); buffer_init(); + sd_init(); + sd_on(); + // Start execution. timers_start(); err_code = ble_advertising_start(BLE_ADV_MODE_FAST); -- cgit v1.2.3