Ejemplo n.º 1
0
bool VescUartGetValue(bldcMeasure& values) {
    uint8_t command[1] = { COMM_GET_VALUES };
    uint8_t payload[256];
    PackSendPayload(command, 1);
    delay(100); //needed, otherwise data is not read
    int lenPayload = ReceiveUartMessage(payload);
    if (lenPayload > 55) {
        bool read = ProcessReadPacket(payload, values, lenPayload); //returns true if sucessful
        return read;
    }
    else
    {
        return false;
    }
}
Ejemplo n.º 2
0
bool VescUartGetValue(WriteCallback fSend, AvailableCallback fAvailable,
                      ReadCallback fRead, bldcMeasure& values) {
	uint8_t command[1] = { COMM_GET_VALUES };
	uint8_t payload[256];
	PackSendPayload(fSend, command, 1);
	
    delay(10); // let the VESC some time to answer
    
	int lenPayload = ReceiveUartMessage(fAvailable, fRead, payload);
	
    if (lenPayload > 0) {
		return ProcessReadPacket(payload, values, lenPayload);
	}
	else {
		return false;
	}
}