/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / How to use Joystick in an Application?

Username:     
Password:     
             

Forum

# 1   2009-11-15 00:53:46 How to use Joystick in an Application?

peterguy
New member
Registered: 2009-11-09
Posts: 2

How to use Joystick in an Application?

Hi,

I'm currently trying to use the joystick of the PRIMER2 in my application.
I found an example project, where the function call JOYSTICK_GetState() is used.
But when I use same command in my Project, the App is not working. Also, the enum JOYSTICK_state seems to be not included in circle_api.h.

How can I get the JOYSTICK functions running?

Regards,
Peter

Offline

 

# 2   2009-11-16 07:35:14 How to use Joystick in an Application?

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: How to use Joystick in an Application?

Hi Peter,

Use of the JOYSTICK_GetState() is the rigth way to manage the joystick. The status of the joystick is periodically updated by the CircleOS button handler.

The JOYSTICK_state is well defined in the "circle_api.h" as :
enum JOYSTICK_state
    {
    JOYSTICK_UNDEF     = -1,        /*!< Undefined state.                */
    JOYSTICK_RELEASED  =  0,        /*!< Joystick is released.           */
    JOYSTICK_LEFT      =  1,        /*!< Joystick was just pushed left.  */
    JOYSTICK_UP        =  2,        /*!< Joystick was just pushed up.    */
    JOYSTICK_RIGHT     =  3,        /*!< Joystick was just pushed right. */
    JOYSTICK_DOWN      =  4,         /*!< Joystick was just pushed down.  */
    JOYSTICK_RIGHT_UP   =  11,  /*JOYSTICK_RIGHT | JOYSTICK_UP*/
    JOYSTICK_LEFT_UP    =  5,  /*JOYSTICK_LEFT  | JOYSTICK_UP*/
    JOYSTICK_RIGHT_DOWN =  13, /*JOYSTICK_RIGHT | JOYSTICK_DOWN*/
    JOYSTICK_LEFT_DOWN  =  7,  /*JOYSTICK_LEFT  | JOYSTICK_DOWN */
    };

What do you mean by the App is not working ?
And what is the version of your CircleOS ?

Yves

Offline

 

# 3   2009-11-16 09:24:05 How to use Joystick in an Application?

peterguy
New member
Registered: 2009-11-09
Posts: 2

Re: How to use Joystick in an Application?

Hello Yves,

Thanks for your answer!
I solved the problem in the meanwhile. Here a short description for people which have same or similar problem:

I'm using OS version 3.1
My Application did not work at all when I called JOYSTICK_GetState(), that means it compiled but PRIMER2 hang with white screen after flashing.
When I used the JOYSTICK_state enums, compilation has not been possible.
Then I had a look into circle api header file of my project and found no JOYSTICK related API or defines.

So I replaced the circle api header file with one from different project and now everything is fine.
It seems that when starting a project from the scratch in RIDE7, a version of circle_api.h is used that is not prepared well for PRIMER2. Might also be that I perhaps made some wrong settings in the beginning.

regards,
Peter

Offline

 

# 4   2009-11-16 13:13:37 How to use Joystick in an Application?

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: How to use Joystick in an Application?

Peter,

V3.1 is very old version of CircleOS (in fact the first one for Primer2), and I guess you are also using an old version of Ride7.
I suggest you to update your version with the ressources provided on this web site.

Yves

Offline

 

Board footer