summaryrefslogtreecommitdiffhomepage
path: root/digital/beacon
diff options
context:
space:
mode:
authorFlorent Duchon2012-12-18 23:17:08 +0100
committerFlorent Duchon2012-12-24 17:50:53 +0100
commit6e762b5be99a1d39d050b7ec1e93dc81cfb75e9a (patch)
tree0b9e22f2c30fb1f5d19bbc3278382e190119945a /digital/beacon
parent900144668252e74fcc4c779028d5065ba696720b (diff)
digital/beacon: add trust decrease task
Diffstat (limited to 'digital/beacon')
-rw-r--r--digital/beacon/src/trust.c12
-rw-r--r--digital/beacon/src/trust.h1
2 files changed, 13 insertions, 0 deletions
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