26 #include "yarp/dev/CanBusInterface.h"
33 inline int getRcp(
const yarp::dev::CanMessage &m)
35 return (m.getId()&0x0f);
43 inline int getSender(
const yarp::dev::CanMessage &m)
45 return (m.getId()&0xf0)>>4;
52 inline int getClass(
const yarp::dev::CanMessage &m)
54 return (m.getId()&0x700);
62 return m.getData()[0]&0x7f;
70 inline int getJoint(
const yarp::dev::CanMessage &m,
const unsigned char *invM)
73 int odd=((m.getData()[0]&0x80)==0) ? 0:1;
74 return invM[sender]+odd;
97 return (m.id&0xf0)>>4;
116 return m.data[0]&0x7f;
128 int odd=((m.data[0]&0x80)==0) ? 0:1;
129 return invM[sender]+odd;
145 yDebug(
"%s", buffer);
212 DEBUG_FUNC(
"Allocating %d x %d\n", joints, num_msgs);
213 elements=joints*num_msgs;
215 num_of_messages=num_msgs;
227 unsigned int i=msg&0x7F;
229 int index=j*num_of_messages+i;
232 if ((index>=0)&&(index<elements))
233 return requests+index;
277 {
return num_of_messages;}
int getJoint(const yarp::dev::CanMessage &m, const unsigned char *invM)
Extract the joint number to which a RECEIVED message is referring to.
unsigned char getMessageType(const yarp::dev::CanMessage &m)
Extract 7 lsb of first byte; this is the message type in our protocol.
int getRcp(const yarp::dev::CanMessage &m)
Extract least significative 4 bits, from the id of a can msg.
const int DEBUG_PRINTF_BUFFER_LENGTH
int getSender(const yarp::dev::CanMessage &m)
Extract most significative 4 bits of the least significative byte from the id of a can msg.
int getClass(const yarp::dev::CanMessage &m)
Extract message class, three bit least significative of the first byte of the message ID.
void DEBUG_FUNC(const char *fmt,...)
ThreadFifo * getFifo(int j, int msg)
void append(const CanRequest &rqst)
RequestsQueue(int joints, int num_msgs)