View unanswered posts | View active topics It is currently Sat Sep 20, 2014 10:43 am






Reply to topic  [ 9 posts ] 
PSP-Nx-v3 problem... 
Author Message
Rookie

Joined: Sat Jan 09, 2010 12:25 pm
Posts: 48
Location: Rome, Italy
Post PSP-Nx-v3 problem...
Hello guys!

I recently got a PSP-Nx-v3 device and I'm trying to make it work but, as I'm writing right now, I only get failures.

So, first of all, I tested the pad and it works on PC, now I tried running device_explorer.c on RobotC 2.02 and it tells me PSP-NX: 2
I have it attached on S1 but I can't trace any activity between the pad and the brick

Now the problem comes when I try including the drivers in a blank project, I try #include "PSP-Nx-lib.c" and all I get is:

*Warning*:Unreferenecd function 'PSP_SendCommand'
*Warning*:Unreferenced function 'PSP_ReadButtonState'

What's wrong? :(

Thank you all in advance


Mon Jul 05, 2010 5:36 am
Profile
Rookie

Joined: Sat Jan 09, 2010 12:25 pm
Posts: 48
Location: Rome, Italy
Post Re: PSP-Nx-v3 problem...
Nevermind it's working right now, I tried the file PSP-Nx-demo.c and it works... I guess I should ignore those Unreferenced function *Warnings*


Mon Jul 05, 2010 5:18 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: PSP-Nx-v3 problem...
Jampoz,

When you see "*Warning*:Unreferenced function...." you can almost always safely ignore them. Think of a library as a large shop and the compiler as an overzealous salesman telling you that you haven't bought every single item available to you. "Unreferenced function" is just another way of saying "unused function". It's no different than going to a shop and only buying the items you need, rather than everything that's there. Unreferenced functions are almost always optimised out by the compiler, so they won't take up any extra space.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Jul 06, 2010 12:52 am
Profile WWW
Rookie

Joined: Sat Jan 09, 2010 12:25 pm
Posts: 48
Location: Rome, Italy
Post Re: PSP-Nx-v3 problem...
Look Xander, this is PSP-Nx-demo.c
That's a weird way for storing a sensor reference... I'm used to the #pragma config

Code:
#define Addr 0x02
#include "PSP-Nx-lib.c"
#define SensorPort S1


task main()
{
   psp currState;

  nI2CBytesReady[SensorPort] = 0;
  SensorType[SensorPort] = sensorI2CCustom9V;

   while (true)
   {
      PSP_ReadButtonState(SensorPort, Addr, currState);
    nxtDisplayTextLine(1,"b1: %d", (char)currState.b1);
    nxtDisplayTextLine(2,"b2: %d", (char)currState.b2);
    nxtDisplayTextLine(3,"l_j_x: %d", (int)currState.l_j_x);
    nxtDisplayTextLine(4,"l_j_y: %d", (int)currState.l_j_y);
    nxtDisplayTextLine(5,"r_j_x: %d", (int)currState.r_j_x);
    nxtDisplayTextLine(6,"r_j_y: %d", (int)currState.r_j_y);
   }
}


By the way, it looks like the PSP-Nx isn't included in your drivers, is that so?


Tue Jul 06, 2010 5:50 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: PSP-Nx-v3 problem...
Hiya Jampoz,

That is indeed a very un-ROBOTC way of doing things. It's not a bad way of doing it, just not very clear way of doing it. You can easily modify it to make it more compliant.

Code:
#pragma config(Sensor, S1,     PSPNX,               sensorI2CCustomFastSkipStates9V)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#define Addr 0x02
#include "PSP-Nx-lib.c"

task main()
{
   psp currState;

  nI2CBytesReady[PSPNX] = 0;

   while (true)
   {
      PSP_ReadButtonState(PSPNX, Addr, currState);
    nxtDisplayTextLine(1,"b1: %d", (char)currState.b1);
    nxtDisplayTextLine(2,"b2: %d", (char)currState.b2);
    nxtDisplayTextLine(3,"l_j_x: %d", (int)currState.l_j_x);
    nxtDisplayTextLine(4,"l_j_y: %d", (int)currState.l_j_y);
    nxtDisplayTextLine(5,"r_j_x: %d", (int)currState.r_j_x);
    nxtDisplayTextLine(6,"r_j_y: %d", (int)currState.r_j_y);
   }
}


Quote:
By the way, it looks like the PSP-Nx isn't included in your drivers, is that so?

That's correct. It's one of the few MS sensors I don't have. I can't write drivers for ones I don't own, nor do I add them to my suite if I can't support them myself.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Jul 06, 2010 3:27 pm
Profile WWW
Rookie

Joined: Sat Jan 09, 2010 12:25 pm
Posts: 48
Location: Rome, Italy
Post Re: PSP-Nx-v3 problem...
Don't they support your project by sending you stuff?
Do they actually wait for you to need something and start working on it? That's crazy


Tue Jul 06, 2010 3:47 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: PSP-Nx-v3 problem...
They do support me and they're extremely generous. I often get access to sensors before the general public. The PSPNX is just one of the few I have not received, that's all :) I don't think I have anything to complain about, really. I was just giving you the reason it's not part of the suite :) I don't like asking them for stuff because I don't want to be perceived as greedy and I've never really had to, they've always sent me things before I even asked. I feel very fortunate for being in this position and I wouldn't want to compromise that.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Jul 06, 2010 4:12 pm
Profile WWW
Rookie

Joined: Sat Jan 09, 2010 12:25 pm
Posts: 48
Location: Rome, Italy
Post Re: PSP-Nx-v3 problem...
It sure is a fortunate position, yet I'm sure you deserved it
Think I'm neutral enough as a customer? I could mail 'em and ask why the hell isn't the PSP-Nx into your drivers, even if they'll probably answer to ask you that... :D


Tue Jul 06, 2010 4:38 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: PSP-Nx-v3 problem...
Oh sure, perhaps you can convince them to send me one :)

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Jul 06, 2010 4:46 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.