Example #1
0
static void cmdSetHallGains(unsigned char status, unsigned char length, unsigned char *frame) {
    //Unpack unsigned char* frame into structured values
    PKT_UNPACK(_args_cmdSetPIDGains, argsPtr, frame);

    hallSetGains(0, argsPtr->Kp1, argsPtr->Ki1, argsPtr->Kd1, argsPtr->Kaw1, argsPtr->Kff1);
    hallSetGains(1, argsPtr->Kp2, argsPtr->Ki2, argsPtr->Kd2, argsPtr->Kaw2, argsPtr->Kff2);

    //Send confirmation packet
    Payload pld;
    pld = payCreateEmpty(20);
    //pld->pld_data[0] = status;
    //pld->pld_data[1] = CMD_SET_HALL_GAINS;
    paySetType(pld, CMD_SET_HALL_GAINS);
    paySetStatus(pld, status);
    memcpy((pld->pld_data) + 2, frame, 20);
    radioSendPayload((WordVal) macGetDestAddr(), pld);
}
Example #2
0
static void cmdSetHallGains(MacPacket packet) {
    Payload pld;
    unsigned char *frame;
    hallGains *params;

    pld = macGetPayload(packet);
    frame = payGetData(pld);
    params = (hallGains*) frame;
    hallSetGains(&params[0]);
}