From 6e762b5be99a1d39d050b7ec1e93dc81cfb75e9a Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Tue, 18 Dec 2012 23:17:08 +0100 Subject: digital/beacon: add trust decrease task --- digital/beacon/src/trust.c | 12 ++++++++++++ digital/beacon/src/trust.h | 1 + 2 files changed, 13 insertions(+) diff --git a/digital/beacon/src/trust.c b/digital/beacon/src/trust.c index 23823ef8..49bdb043 100644 --- a/digital/beacon/src/trust.c +++ b/digital/beacon/src/trust.c @@ -26,8 +26,10 @@ #include "position.h" #include "trust.h" #include "debug_simu.h" +#include "debug_avr.h" extern opponent_s opponent[MAX_OBSTACLE]; +static HAL_AppTimer_t trustTimer; /* This function returns the trust level */ @@ -68,6 +70,16 @@ TTrustStatus trust_decrease(void) opponent[i].trust--; } } + return TRUST_LEVEL_OK; } + +void trust_decrease_task(void) +{ + trustTimer.interval = TRUST_DECREASE_TASK_PERIOD; + trustTimer.mode = TIMER_REPEAT_MODE; + trustTimer.callback = trust_decrease; + HAL_StartAppTimer(&trustTimer); +} + diff --git a/digital/beacon/src/trust.h b/digital/beacon/src/trust.h index 8169660f..64a3104c 100644 --- a/digital/beacon/src/trust.h +++ b/digital/beacon/src/trust.h @@ -29,6 +29,7 @@ #define TRUST_MIN 0 #define TRUST_THRESHOLD 30 #define TRUST_MAX 100 +#define TRUST_DECREASE_TASK_PERIOD 500L /* Status returns */ typedef enum -- cgit v1.2.3