ROBOTC.net forums
http://www.robotc.net/forums/

PSP-Nx-v3 problem...
http://www.robotc.net/forums/viewtopic.php?f=41&t=2464
Page 1 of 1

Author:  Jampoz [ Mon Jul 05, 2010 5:36 am ]
Post subject:  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

Author:  Jampoz [ Mon Jul 05, 2010 5:18 pm ]
Post subject:  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*

Author:  mightor [ Tue Jul 06, 2010 12:52 am ]
Post subject:  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

Author:  Jampoz [ Tue Jul 06, 2010 5:50 am ]
Post subject:  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?

Author:  mightor [ Tue Jul 06, 2010 3:27 pm ]
Post subject:  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

Author:  Jampoz [ Tue Jul 06, 2010 3:47 pm ]
Post subject:  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

Author:  mightor [ Tue Jul 06, 2010 4:12 pm ]
Post subject:  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

Author:  Jampoz [ Tue Jul 06, 2010 4:38 pm ]
Post subject:  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

Author:  mightor [ Tue Jul 06, 2010 4:46 pm ]
Post subject:  Re: PSP-Nx-v3 problem...

Oh sure, perhaps you can convince them to send me one :)

- Xander

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/