/test/test.factor

http://github.com/Telecom-Robotics/Wiimote · Factor · 17 lines · 14 code · 1 blank · 2 comment · 0 complexity · 0d1da38674302aaf54649d81a96b79f4 MD5 · raw file

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