/test/test.factor
http://github.com/Telecom-Robotics/Wiimote · Factor · 17 lines · 14 code · 1 blank · 2 comment · 0 complexity · 0d1da38674302aaf54649d81a96b79f4 MD5 · raw file
- ! Copyright (C) 2010 Your name.
- ! See http://factorcode.org/license.txt for BSD license.
- USING: calendar classes.struct combinators kernel threads
- wiimote.bindings ;
- IN: wiimote.test
- : <bdaddr-any> ( -- bdaddr ) bdaddr_t <struct> ;
- : get-msg ( mote -- )
- { int cwiid_mesg timespec } [ cwiid_get_mesg drop ] with-out-parameters . . . ;
- : wiimote-test ( -- )
- <bdaddr-any> CWIID_FLAG_CONTINUOUS CWIID_FLAG_MESG_IFC bitor cwiid_open
- {
- [ CWIID_FLAG_CONTINUOUS cwiid_enable drop ]
- [ CWIID_CMD_RPT_MODE CWIID_RPT_IR cwiid_command drop ]
- [ [ get-msg ] curry 50 swap times ]
- [ cwiid_close drop ]
- } cleave ;