aboutsummaryrefslogtreecommitdiff
path: root/robot/hypervisor.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-06-07 23:46:48 +0200
committerlonkaars <loek@pipeframe.xyz>2022-06-07 23:46:48 +0200
commit0d3c52e49dc34344f335fd6d7b214592723cbc93 (patch)
tree36c8b974556a5ee3c955549131ac3858208d373b /robot/hypervisor.h
parentc88c7c7c6e6c687c3d8170cb07a467aa3c4d7f48 (diff)
implemented obstacle detection
Diffstat (limited to 'robot/hypervisor.h')
-rw-r--r--robot/hypervisor.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/robot/hypervisor.h b/robot/hypervisor.h
index 4b1ed9b..fe9dbea 100644
--- a/robot/hypervisor.h
+++ b/robot/hypervisor.h
@@ -7,9 +7,10 @@
#include "../shared/bool.h"
/** amount of parallel timers */
-#define W2_HYPERVISOR_TIMER_COUNT (1)
+#define W2_HYPERVISOR_TIMER_COUNT 2
-#define W2_TIMER_PING (0)
+#define W2_TIMER_PING 0
+#define W2_TIMER_OBJECT_DETECTION 1
extern uint64_t g_w2_hypervisor_cycles;
extern uint64_t g_w2_hypervisor_uptime_ms;
@@ -32,7 +33,17 @@ extern bool g_w2_connected;
*/
void w2_hypervisor_main();
+/**
+ * pololu's `get_ms()` estimates run time by only adding the CPU time taken up
+ * by pololu library functions. this function uses the `get_ticks()` function
+ * to calculate elapsed milliseconds, and should therefore be more accurate.
+ */
+uint64_t w2_get_ms();
+/** reset time returned by `w2_get_ms()` */
+void w2_time_reset();
+
/** start timer with label `label` */
void w2_hypervisor_time_start(uint8_t label);
/** stop timer with label `label` */
uint64_t w2_hypervisor_time_end(uint8_t label);
+