From 4018bef35759af836dcd87d7d1b7eee7de57dfb2 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 29 Apr 2008 09:42:13 +0200 Subject: * digital/io/src: - added distance sensors support for simulation. - added preliminary sharps commands. --- digital/io/src/simu.host.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'digital/io/src/simu.host.c') diff --git a/digital/io/src/simu.host.c b/digital/io/src/simu.host.c index 86029139..03eed76a 100644 --- a/digital/io/src/simu.host.c +++ b/digital/io/src/simu.host.c @@ -26,16 +26,19 @@ #include "simu.host.h" #include "servo.h" +#include "sharp.h" #include "modules/utils/utils.h" #include "modules/host/host.h" #include "modules/host/mex.h" +#include "modules/adc/adc.h" enum { MSG_SIMU_IO_JACK = 0xb0, MSG_SIMU_IO_COLOR = 0xb1, MSG_SIMU_IO_SERVO = 0xb2, + MSG_SIMU_IO_SHARPS = 0xb3, }; /** Requested servo position. */ @@ -51,6 +54,7 @@ uint8_t servo_high_time_current_[SERVO_NUMBER]; /** Do not update too often, interface is too slow. */ uint8_t simu_servo_update = 10, simu_servo_update_cpt; uint8_t simu_switch_update = 100, simu_switch_update_cpt; +uint8_t simu_sharps_update = 100, simu_sharps_update_cpt; /** Sampled switches. */ uint8_t simu_switches; @@ -111,6 +115,17 @@ simu_step (void) if (!r) simu_switches |= 2; } + /* Update sharps. */ + if (simu_sharps_update && !--simu_sharps_update_cpt) + { + simu_sharps_update_cpt = simu_sharps_update; + m = mex_msg_new (MSG_SIMU_IO_SHARPS); + m = mex_node_request (m); + uint8_t i; + for (i = 0; i < SHARP_NUMBER; i++) + mex_msg_pop (m, "H", &adc_values[i]); + mex_msg_delete (m); + } } void -- cgit v1.2.3