Revision b4885314 components/ControllerAreaNetworkRx.cpp

View differences:

components/ControllerAreaNetworkRx.cpp
99 99
      }
100 100
      break;
101 101

  
102
    case CAN::MAGNETOMETER_X_ID:
103
      if (frame->DLC == 4) {
104
        magnetometerValue[0] = frame->data32[0];
105
        return RDY_OK;
106
      }
107
      break;
108

  
109
    case CAN::MAGNETOMETER_Y_ID:
110
      if (frame->DLC == 4) {
111
        magnetometerValue[1] = frame->data32[0];
112
        return RDY_OK;
113
      }
114
      break;
115

  
116
    case CAN::MAGNETOMETER_Z_ID:
117
      if (frame->DLC == 4) {
118
        magnetometerValue[2] = frame->data32[0];
119
        return RDY_OK;
120
      }
121
      break;
122

  
123
    case CAN::GYROSCOPE_ID:
124
      if (frame->DLC == 6) {
125
        gyroscopeValue[0] = frame->data16[0];
126
        gyroscopeValue[1] = frame->data16[1];
127
        gyroscopeValue[2] = frame->data16[2];
128
        return RDY_OK;
129
      }
130
      break;
131

  
102 132
    default:
103 133
      break;
104 134
  }
......
127 157
  return this->robotId;
128 158
}
129 159

  
160
int32_t ControllerAreaNetworkRx::getMagnetometerValue(int axis)
161
{
162
  return this->magnetometerValue[axis];
163
}
164

  
165
int16_t ControllerAreaNetworkRx::getGyroscopeValue(int axis)
166
{
167
  return this->gyroscopeValue[axis];
168
}
169

  
130 170

  
131 171
uint16_t ControllerAreaNetworkRx::getProximityFloorValue(int index) {
132 172
  return this->proximityFloorValue[index];

Also available in: Unified diff