From f833faabec7718e112d12203342804be0e19c604 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sun, 17 May 2009 22:20:41 +0200 Subject: * digital/io, host/simu: - added contacts. --- digital/io/src/simu.host.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'digital/io/src') diff --git a/digital/io/src/simu.host.c b/digital/io/src/simu.host.c index f13f84a5..e3c9fc69 100644 --- a/digital/io/src/simu.host.c +++ b/digital/io/src/simu.host.c @@ -44,6 +44,7 @@ enum MSG_SIMU_IO_SHARPS = 0xb3, MSG_SIMU_IO_PATH = 0xb4, MSG_SIMU_IO_PWM = 0xb5, + MSG_SIMU_IO_CONTACT = 0xb6, }; /** Requested servo position. */ @@ -72,11 +73,19 @@ uint8_t PORTB; /** Contact registers. */ uint8_t PORTC, PINC; +void +handle_contact (void *user, mex_msg_t *msg) +{ + mex_msg_pop (msg, "B", &PINC); +} + /** Initialise simulation. */ void simu_init (void) { mex_node_connect (); + mex_node_register (MSG_SIMU_IO_CONTACT, handle_contact, 0); + PINC = 0x3f; simu_servo_update_cpt = 1; simu_switch_update_cpt = 1; simu_sharps_update_cpt = 1; -- cgit v1.2.3