this worked with the prototype SUS

This commit is contained in:
Jakob Meier 2021-05-09 10:06:36 +02:00
parent 6861cd399e
commit 451729b103
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) { else if (communicationStep == CommunicationStep::REQUEST_TEMP) {
*id = SUS::RQUEST_TEMP; *id = SUS::RQUEST_TEMP;
communicationStep = CommunicationStep::PERFORM_CONVERSIONS; communicationStep = CommunicationStep::READ_TEMP;
} }
else if (communicationStep == CommunicationStep::READ_TEMP) { else if (communicationStep == CommunicationStep::READ_TEMP) {
*id = SUS::READ_TEMP; *id = SUS::READ_TEMP;
@ -65,7 +65,7 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
case(SUS::WRITE_SETUP): { case(SUS::WRITE_SETUP): {
cmdBuffer[0] = SUS::SETUP_DEFINITION; cmdBuffer[0] = SUS::SETUP_DEFINITION;
rawPacket = cmdBuffer; rawPacket = cmdBuffer;
rawPacketLen = 0; rawPacketLen = 1;
internalState = InternalState::CONFIGURED; internalState = InternalState::CONFIGURED;
return RETURN_OK; return RETURN_OK;
} }
@ -80,7 +80,7 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
cmdBuffer[1] = SUS::SETUP_DEFINITION; cmdBuffer[1] = SUS::SETUP_DEFINITION;
// wirte one dummy byte here // wirte one dummy byte here
// cmdBuffer[2] = SUS::CONVERT_TEMPERATURE; // 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[0] = SUS::SETUP_DEFINITION;
// cmdBuffer[1] = SUS::UNIPOLAR_CONFIG; // cmdBuffer[1] = SUS::UNIPOLAR_CONFIG;
@ -100,13 +100,13 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
// cmdBuffer[1] = SUS::SETUP_DEFINITION; // cmdBuffer[1] = SUS::SETUP_DEFINITION;
cmdBuffer[0] = SUS::CONVERT_TEMPERATURE; cmdBuffer[0] = SUS::CONVERT_TEMPERATURE;
rawPacket = cmdBuffer; rawPacket = cmdBuffer;
rawPacketLen = 25; rawPacketLen = 1;
return RETURN_OK; return RETURN_OK;
} }
case(SUS::READ_TEMP): { case(SUS::READ_TEMP): {
std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
rawPacket = cmdBuffer; rawPacket = cmdBuffer;
rawPacketLen = 0; rawPacketLen = 24;
return RETURN_OK; return RETURN_OK;
} }
default: default:

View File

@ -24,7 +24,7 @@ namespace SUS {
* Bit7 - Bit6: 0b01, tells MAX1227 that this is the setup register * 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 * @brief This value will always be written to the ADC conversion register to specify the