From: Andy Spencer Date: Tue, 11 Mar 2014 03:04:45 +0000 (+0000) Subject: Fix input events X-Git-Url: http://pileus.org/git/?p=~andy%2Fcsm213a-hw;a=commitdiff_plain;h=4d12e5ba26058b03792459cda53087998f291e05 Fix input events --- diff --git a/hw2/main.cpp b/hw2/main.cpp index 9292124..f7b7671 100644 --- a/hw2/main.cpp +++ b/hw2/main.cpp @@ -101,7 +101,7 @@ void time_ext_sync(uint64_t local, uint64_t world) world = time_last_world; //#ifdef VERBOSE -#if 1 +#if 0 uint64_t error = world > guess ? world - guess : guess > world ? guess - world : 0; int ahead = guess > world; @@ -334,21 +334,19 @@ void serial_send_sync(sirq_t *port, uint64_t now) */ void serial_send_event(uint16_t event, uint64_t local) { -// uint64_t world = time_to_world(local); + time_printf("event received", local); - // Message data #if 0 + // Message data header_t head; event_msg_t body; + uint64_t world = time_to_world(local); + ntime_t time = {}; time.seconds = (uint32_t)(world / NSEC_PER_SEC); time.nanosec = (uint32_t)(world % NSEC_PER_SEC); - sirq_printf("event received - %08x:%08x - %u.%09u\r\n", - (uint32_t)(local >> 32), (uint32_t)local, - time.seconds, time.nanosec); - // Transmit sync message head.header = MSG_HEADER; head.msgid = MSG_ID_SYNC; @@ -623,7 +621,7 @@ static struct { uint64_t due; } tasks[] = { { task_serial, 0 }, // always - { task_events, 1000000000 }, // always -- testing + { task_events, 0 }, // always -- testing { task_sync, 0 }, // always { task_emit, 0 }, // always { task_leds, 100000000 }, // 10hz @@ -656,7 +654,7 @@ int main(int argc, char **argv) sirq_mbed = sirq_open(SIRQ_UART2, PTD3, PTD2, 115200); // to mbed // Setup timers - tdma_evt = tdma_open(TDMA_CHAN0, 3, PTC9, PullUp); // async event + tdma_evt = tdma_open(TDMA_CHAN0, 3, PTC9, PullDown); // async event // mbed time sync tdma_rcv = tdma_open(TDMA_CHAN2, 3, PTD2, PullUp); // time sync rcv