USB HID Joystick & PPM-In program

More
20 Jan 2013 10:40 - 20 Jan 2013 10:41 #5238 by hmjack2008
USB HID Joystick & PPM-In program was created by hmjack2008
Just upload my program, DEVO10 for "USB HID Joystick".
(1) in Menu->USB page.
(2) press "DN" to enable USB.
(3) plug-in USB to PC, PC will detect Mass Storage & USB HID Joystick.
(4) press "UP" to enable send Joystick data.







File Attachment:

File Name: usb_joystick_src.zip
File Size:23 KB



and, my ppm-in program, but "not stable!!" (if plug-in/out when connect)

File Attachment:

File Name: protocol_ppmin_3.zip
File Size:4 KB
Last edit: 20 Jan 2013 10:41 by hmjack2008.

Please Log in or Create an account to join the conversation.

More
20 Jan 2013 15:29 #5252 by SadSack
Replied by SadSack on topic USB HID Joystick & PPM-In program
So head tracker be an option soon, sweet :) possibly option for 7e(hint)

Some details on how to add it to build would be handy for dim wits like me :D

Thanks,Phil

Please Log in or Create an account to join the conversation.

More
20 Jan 2013 16:22 #5255 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program
Basically, you would drop the files in the root dir, and add ppm_Init() after the Init() call in main.c

Note that is just from inspection I didn't try it.
it will override the normal inputs I think and isn't configurable, so it is more of a proof of concept than anything else.

Still, it is great work, and I look forward to spending more time looking at it.

Please Log in or Create an account to join the conversation.

More
20 Jan 2013 18:12 #5275 by SadSack
Replied by SadSack on topic USB HID Joystick & PPM-In program
Thanks

So would work for 7e& others or just 10?

Please Log in or Create an account to join the conversation.

More
21 Jan 2013 07:32 #5295 by MatCat
Replied by MatCat on topic USB HID Joystick & PPM-In program
I think I am going to tackle the USB Joystick for the Devo 8, my goal is to have it working by tonight.

Please Log in or Create an account to join the conversation.

More
21 Jan 2013 14:37 - 21 Jan 2013 14:51 #5311 by hmjack2008
Replied by hmjack2008 on topic USB HID Joystick & PPM-In program
may be you need change "mixer.c" for DEVO8 & DEVO7 :

(1) change : "7" to "5"
(2) change : "15" to "13"


=========== mixer.c ===========

#define devoCH_size 4+1 //devo7;8;10 = 5;5;7
#define devoSW_size 4+1+8 //devo7;8;10 = 13;13;15

/******************** Joystick ********************/
#ifndef EMULATOR
if (JoystickEn && PrevXferComplete) {

if (i<devoCH_size) { // devo7;8;10 = 1~4: Aixs; 5~6:AUX4~AUX5
Joystick_Buffer[i+2] = (s8) ((raw)/79);
} else {
if (i<devoSW_size) { //switch 1st-byte
if (raw>0) {
Joystick_Buffer[1] |= (uint8_t) 0x01<<(i- devoCH_size);
} else {
Joystick_Buffer[1] &= (uint8_t) ~(0x01<<(i- devoCH_size));
} //if (raw>0)
} else { //switch 2nd-byte, devo7 not use
if (raw>0) {
Joystick_Buffer[2] |= (uint8_t) 0x01<<(i- devoSW_size);
} else {
Joystick_Buffer[2] &= (uint8_t) ~(0x01<<(i- devoSW_size));
} //if (raw>0)
} //else if (i< devoSW_size)
} //if (i< devoCH_size)

JoystickBuff = 1;
} //if (JoystickEn && PrevXferComplete)
#endif // #ifndef EMULATOR
/******************** Joystick ********************/
Last edit: 21 Jan 2013 14:51 by hmjack2008.

Please Log in or Create an account to join the conversation.

More
21 Jan 2013 15:11 - 21 Jan 2013 15:27 #5320 by hmjack2008
Replied by hmjack2008 on topic USB HID Joystick & PPM-In program

SadSack wrote: So head tracker be an option soon, sweet :) possibly option for 7e(hint)

Some details on how to add it to build would be handy for dim wits like me :D

Thanks,Phil


I use "menu-> about page" to do enable ppmin.c and show the ppmin channels & signal-width.

(0) use trainer cable to connect
(1) in about page
(2) press "ENTER" to enable ppmin
(3) press "DN" to show the ppmin channels & signal-width

NOTE:
Do NOT plug in/out the trainer cable when ppmin enable !!


I got the problem .... if plug in/out when ppmin enable.
=> sometime, LCD become no display,
=> if LCD no display, need reflash to walkera fireware for recover.



====about_page.c====
static u8 _action_cb(u32 button, u8 flags, void *data)
{
    (void)data;
    if ((flags & BUTTON_PRESS) || (flags & BUTTON_LONGPRESS)) {
        if (CHAN_ButtonIsPressed(button, BUT_EXIT)) {
            PAGE_ChangeByID(PAGEID_MENU, PREVIOUS_ITEM);
        } else {
            if (CHAN_ButtonIsPressed(button, BUT_ENTER)) {
            #ifndef EMULATOR
            // ppm-in
            sprintf(up->tmpstr, "ppm: '%d'-'%d'", 0, 65535),
             GUI_CreateLabelBox(0, 55, 128, 8,&TINY_FONT, NULL, NULL, up->tmpstr);
            ppmin_TIM5_Init();
            ppmin_Init();
            ppmIN = 1;
            }
            if (CHAN_ButtonIsPressed(button, BUT_DOWN)) {
            ppmin_Stop();
            sprintf(up->tmpstr, "ppm#: %d-%d-%d",ppmin_num_channels,ppmChannels[0],ppmChannels[ppmin_num_channels]);
             GUI_CreateLabelBox(0, 55, 128, 8,&TINY_FONT, NULL, NULL, up->tmpstr);
            }
            // ppm-in
            #endif    // #ifndef EMULATOR
            }
        }
    }
    return 1;
}
Last edit: 21 Jan 2013 15:27 by hmjack2008.

Please Log in or Create an account to join the conversation.

More
21 Jan 2013 19:02 #5334 by SadSack
Replied by SadSack on topic USB HID Joystick & PPM-In program
excellent many thanks.

Please Log in or Create an account to join the conversation.

More
24 Feb 2013 14:32 - 24 Feb 2013 14:33 #6949 by SadSack
Replied by SadSack on topic USB HID Joystick & PPM-In program
Hi
Well i give it ago awhile back and tried to build 10c and 7e no joy lots of build errors. I know you did this for 10c only then added 7e. hoping either you've done more with it or some pointers on how it should be built. I did try build just Hid then PPM and then both.

thanks,Phil
Last edit: 24 Feb 2013 14:33 by SadSack.

Please Log in or Create an account to join the conversation.

More
25 Feb 2013 02:58 - 25 Feb 2013 07:51 #7007 by hmjack2008
Replied by hmjack2008 on topic USB HID Joystick & PPM-In program

File Attachment:

File Name: USB_Joystick_2.zip
File Size:24 KB


Edit PB:
Removed entire post due to discussion of illegal software. the zip itself is the usb joystick code and looks ok.

Please read the message posted on the forum page. No discussion of subverting copyright will be tolerated on this board.


Sorry, I included the illegal message, and thanks PhracturedBlue removed these immediate.

below is my updated :
(1) for USB joystick,
(1.1) change for DEVO7;8;10;12.
(1.2) rearrangement the sequence of axis.

(2) for PPM-In
(2.1) the program not compatible with Walkera f/w.
(2.2) the ppm-in need special audio cable to connect.
coach(audio-left, ppm-out) --to--> trainer(audio-right, ppm-in)
Attachments:
Last edit: 25 Feb 2013 07:51 by hmjack2008.

Please Log in or Create an account to join the conversation.

More
25 Feb 2013 03:52 - 25 Feb 2013 05:03 #7008 by Hexperience
Replied by Hexperience on topic USB HID Joystick & PPM-In program
Too bad you included the crack... Good work on the ppm in and usb joystick support but the crack will get this post deleted as soon as pb or fdr see it.

There are 10 types of people in this world. Those that understand binary and those that don't.
Last edit: 25 Feb 2013 05:03 by PhracturedBlue.

Please Log in or Create an account to join the conversation.

More
25 Feb 2013 17:52 #7042 by SadSack
Replied by SadSack on topic USB HID Joystick & PPM-In program
is the ppm in with usb hid ?

Phoenix R/C is cheap enough compared to few crash's. Guy puts more updates out than PB :) Even if you sell up phoenix holds it's value and never up for sale to long. Small heli's hard to say how good but 450 up and trex600 is perfect.

Please Log in or Create an account to join the conversation.

More
25 Feb 2013 20:49 - 25 Feb 2013 20:51 #7052 by Hexperience
Replied by Hexperience on topic USB HID Joystick & PPM-In program

hmjack2008 wrote:
(2.2) the ppm-in need special audio cable to connect.
coach(audio-left, ppm-out) --to--> trainer(audio-right, ppm-in)


Which one is the TIP of the plug? I can't recall off the top of my head. If the TIP is left for ppm out, then maybe the standard "mono" cable will work for trainer and sim without having to use an adapter?

Can't wait to see both of these features working... will be great!

(And yes, Phoenix is great! I have Phoenix and RF6.5 but I shouldn't have bothered with RF6.5...)

There are 10 types of people in this world. Those that understand binary and those that don't.
Last edit: 25 Feb 2013 20:51 by Hexperience.

Please Log in or Create an account to join the conversation.

More
25 Feb 2013 21:37 #7055 by SadSack
Replied by SadSack on topic USB HID Joystick & PPM-In program
well once have a working code you'll only have 2 options so i think i can work it out :whistle: I'm thinking it maybe simple way to add multipole switch's ok maybe hard to configure/not supported but simple/easy.

I started with reflex and at the time thought it was good till started flying with heli pilot and saw how much better it was. And I'm not going to comment about realflight as not to start flame war.

Please Log in or Create an account to join the conversation.

More
22 Apr 2013 03:41 - 22 Apr 2013 03:42 #9109 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program
I've started implementation of the ppm-in capabilities.
So far I only have the menuing created. The actual ppm code is not yet ready.

My idea is that there are 2 modes for PPM-in:
1) Trainer mode: In this mode each input channel is mapped to an output of the transmitter when the relevant switch is enabled, otherwise the channels act as normal

2) FPV mode: in this mode we enable a set of new inputs that can be used like any other analog input. this will allow for head-tracking or whatever other external inputs you like.

The PPM controls will allow specifying the PPM parameters (similar to how the PPM-Out controls work), as well as the channel order (when using train mode)
Last edit: 22 Apr 2013 03:42 by PhracturedBlue.

Please Log in or Create an account to join the conversation.

More
22 Apr 2013 03:50 #9110 by SadSack
Replied by SadSack on topic USB HID Joystick & PPM-In program
Well that's a lot more than expected. Trainer function going to be life saver :) Friend dropped quite a lot money into mid range quad and only flown on sim and watched me. He's not the type to give tx when i first ask for it :)
FPV great!!!

Thanks, Phil

Please Log in or Create an account to join the conversation.

More
22 Apr 2013 04:12 #9111 by FDR
Replied by FDR on topic USB HID Joystick & PPM-In program
IMO even with the only FPV mode one can manage both situations.
I think trainers don't always let control all channels by the tranee anyway...

The point is there should be PPM in inputs assignable to any channel source, All the rest can be done with switches...

Please Log in or Create an account to join the conversation.

More
22 Apr 2013 04:53 #9113 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program

FDR wrote: IMO even with the only FPV mode one can manage both situations.
I think trainers don't always let control all channels by the tranee anyway...

The point is there should be PPM in inputs assignable to any channel source, All the rest can be done with switches...

I agree it could be done with just extra inputs, but configuration would be cumbersome as you'd end up needing to tune every model for train mode. With this configuration, you can very easily configure an existing model for work with a trainer. It is a good point about some channels not being mapped. I'll make sure you can disable the mapping of the input channels in train mode.

Please Log in or Create an account to join the conversation.

More
22 Apr 2013 16:29 #9135 by hmjack2008
Replied by hmjack2008 on topic USB HID Joystick & PPM-In program
Before is based on my own ideas in this ppm-in program.
I use my JR-10S (9 channels ppm-out) for DEVO10 ppm singals input.

So, my program not compatible walkera firmware.

Today, I use Arduino to do out put 8 channels ppm signal (Student mode simulation ).
The DEVO(walkera firmware) can use on Coach mode.

Now, I finally know the walkera's algorithm.



Attachments:

Please Log in or Create an account to join the conversation.

More
24 Apr 2013 15:03 #9173 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program
well, I have the code all put together, but it doesn't actually work. The code hmjack posted uses GPIOA.10 as the trigger (the uart-rx pin), but as far as I can tell, that pin is not connected to the trainer port at all. While the jack supports a 3-pin 1/8" plug, the wiring only seems to connect the tip and ground and not the middle terminal.

Thus I can probably setup GPIOA.9 to work (though it will be impossible to use ppmin and ppmout at the same time which is too bad). But hmjack seems to have been able to get it to work with GPIOA.10 and I am not sure how.

It is odd because the plug on the circuit-board exposes both pins, but only one seems to be attached to the phono plug.

Please Log in or Create an account to join the conversation.

Time to create page: 0.134 seconds
Powered by Kunena Forum