PageRenderTime 101ms CodeModel.GetById 60ms app.highlight 4ms RepoModel.GetById 36ms app.codeStats 0ms

/test/test.factor

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