Shop OBEX P1 Docs P2 Docs Learn Events
Writing a new Virtual Peripheral — Parallax Forums

Writing a new Virtual Peripheral

theoatvecnatheoatvecna Posts: 20
edited 2005-02-26 04:24 in General Discussion
Anyone know how to go about writing a new Virtual Peripheral class? I would like to create a pulse counting VP, and am a bit suprised that one doesn't already exist. Any help would be appreciated.

thanks,
Daniel

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-02-26 04:24
    You cannot have your own VP that runs in the background, other

    than the VP's provided with the Javelin.

    There is CPU.count() that counts pulses but it does so

    for a specified time and as mainline code.

    To mimic an interrupt I have written the SimpleTask class

    http://groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/lib/stamp/util/os/

    This is a very simplified variant of the Task class.

    The trick is to have any method that takes a long time to complete,

    call this simple task so it appears this task runs forever. It only works

    for low frequency events (eg. detect a pushbutton press)

    regards peter
Sign In or Register to comment.