/coner-timer

Connect timing hardware to Coner

Primary LanguageKotlinGNU General Public License v3.0GPL-3.0

coner-timer

Capture times from hardware timers

Build Status codecov

Library

  • Capture times from hardware timers connected by USB/serial port
  • Supports JACircuits time encoding

Usage:

Maven dependency:

<dependency>
    <groupId>org.coner</groupId>
    <artifactId>coner-timer-library</artifactId>
</dependency>

Start logging times:

val reader = PureJavaCommTimerInputReader(
     pureJavaComm = PureJavaCommWrapper(),
     appName = "coner-timer-cli",
     port = "ttyUSB0"
)
val timer = Timer(
    controller = TimerInputReaderController(reader = reader),
    rawInputWriter = FileAppendingOutputWriter(rawInputLogFile),
    mapper = JACTimerInputMapper(),
    mappedInputWriter = PrintlnTimerOutputWriter<FinishTriggerElapsedTimeOnly>(),
)
timer.start()
// receive some times on your hardware timer connected to ttyUSB0

// when you're ready to stop receiving times
timer.stop()

CLI

A functional reference app demonstrating time capture with the Coner Timer library.

Build and run

Prerequisites:

  • JDK 8

Produce a build:

./mvnw clean package

List available ports:

java -jar cli/target/coner-timer-cli-*.jar port list

Capture times from hardware timer on ttyUSB0, log raw input to raw-input.log, and echo formatted times to console:

java -jar cli/target/coner-timer-cli-*.jar port capture --raw-log raw-input.log ttyUSB0

Replay times in raw-input.log as input, and echo formatted times to console:

java -jar cli/target/coner-timer-cli-*.jar file replay raw-input.log