Shop OBEX P1 Docs P2 Docs Learn Events
Propeller C library for PS2 keyboard? — Parallax Forums

Propeller C library for PS2 keyboard?

Does this exist and I just can't find it?

It seems like such an obvious thing to support...

I'm moving a program from Spin to C, and it's holding me up...

I need to provide input to my treadmill control system, speed, incline, start/stop/pause... etc., and I've been using this Spin programmed setup for a few
years now, and it's worked perfectly.

I did see an announcement to post C questions to the "Learn" section/forum, but I am apparently clueless in finding that area as well.

Thanks in advance for any directions/hints...

Ken



Comments

  • ersmithersmith Posts: 6,053
    edited 2018-11-10 15:42
    If you have Spin code already, then you can convert that to C with the spin2cpp tool:

    https://github.com/totalspectrum/spin2cpp/releases

    You'll have to use the command line for the conversion, but it's pretty straightforward. If you want pure C, with any PASM converted to GAS inline assembly, you'd do something like:
    spin2cpp --ccode --gas my_ps2_code.spin
    
    which would output "my_ps2_code.c".

    Just out of curiousity, why are you moving your program to C? If it's to get a speed improvement, you could also use the fastspin compiler (in the same repository as spin2cpp, they're really the same tool underneath) to compile your Spin code to binary that runs at about the same speed as LMM C code would (sometimes a bit slower, but still way way faster than "normal" Spin).
  • ersmith,

    I'm moving it mostly a learning exercise, but while I have my system torn apart, I wanted to add a few options. My spin code is also pretty sloppy and hard to read, so I thought I'd clean things up in this attempt.

    Thanks for the speedy response, just got in from moving another foot of snow... 2 wounded snowblowers, one might be dead...

    I appreciate the fastspin suggestion, I didn't know there was such a thing.

    In the meantime, I'll reload my spin code onto the quickstart VGA plus 256 system I bought a few years back, and get an hour on the treadmill.

    Regards,

    Ken
Sign In or Register to comment.