this worked with the prototype SUS

This commit is contained in:
Jakob Meier 2021-05-09 10:06:36 +02:00
parent be29d0e71f
commit eeb8167cdc
2 changed files with 6 additions and 6 deletions

View File

@ -38,7 +38,7 @@ ReturnValue_t SusHandler::buildNormalDeviceCommand(
}
else if (communicationStep == CommunicationStep::REQUEST_TEMP) {
*id = SUS::RQUEST_TEMP;
communicationStep = CommunicationStep::PERFORM_CONVERSIONS;
communicationStep = CommunicationStep::READ_TEMP;
}
else if (communicationStep == CommunicationStep::READ_TEMP) {
*id = SUS::READ_TEMP;
@ -65,7 +65,7 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
case(SUS::WRITE_SETUP): {
cmdBuffer[0] = SUS::SETUP_DEFINITION;
rawPacket = cmdBuffer;
rawPacketLen = 0;
rawPacketLen = 1;
internalState = InternalState::CONFIGURED;
return RETURN_OK;
}
@ -80,7 +80,7 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
cmdBuffer[1] = SUS::SETUP_DEFINITION;
// wirte one dummy byte here
// cmdBuffer[2] = SUS::CONVERT_TEMPERATURE;
cmdBuffer[2] = SUS::CONVERT_DIFF_CHANNEL_2;
cmdBuffer[2] = SUS::CONVERT_DIFF_CHANNEL_1;
// cmdBuffer[0] = SUS::SETUP_DEFINITION;
// cmdBuffer[1] = SUS::UNIPOLAR_CONFIG;
@ -100,13 +100,13 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
// cmdBuffer[1] = SUS::SETUP_DEFINITION;
cmdBuffer[0] = SUS::CONVERT_TEMPERATURE;
rawPacket = cmdBuffer;
rawPacketLen = 25;
rawPacketLen = 1;
return RETURN_OK;
}
case(SUS::READ_TEMP): {
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
rawPacket = cmdBuffer;
rawPacketLen = 0;
rawPacketLen = 24;
return RETURN_OK;
}
default:

View File

@ -24,7 +24,7 @@ namespace SUS {
* Bit7 - Bit6: 0b01, tells MAX1227 that this is the setup register
*
*/
static const uint8_t SETUP_DEFINITION = 0b01110000;
static const uint8_t SETUP_DEFINITION = 0b01111000;
/**
* @brief This value will always be written to the ADC conversion register to specify the