this works with q7s and new sus
This commit is contained in:
parent
95f09469d1
commit
07d337c6ad
@ -86,8 +86,19 @@ 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[0] = SUS::CONVERT_DIFF_CHANNEL_1;
|
cmdBuffer[0] = SUS::CONVERT_DIFF_CHANNEL_0;
|
||||||
|
cmdBuffer[1] = SUS::DUMMY_BYTE;
|
||||||
|
cmdBuffer[2] = SUS::CONVERT_DIFF_CHANNEL_1;
|
||||||
|
cmdBuffer[3] = SUS::DUMMY_BYTE;
|
||||||
|
cmdBuffer[4] = SUS::CONVERT_DIFF_CHANNEL_2;
|
||||||
|
cmdBuffer[5] = SUS::DUMMY_BYTE;
|
||||||
|
cmdBuffer[6] = SUS::CONVERT_DIFF_CHANNEL_3;
|
||||||
|
cmdBuffer[7] = SUS::DUMMY_BYTE;
|
||||||
|
cmdBuffer[9] = SUS::CONVERT_DIFF_CHANNEL_4;
|
||||||
|
cmdBuffer[10] = SUS::DUMMY_BYTE;
|
||||||
|
cmdBuffer[11] = SUS::CONVERT_DIFF_CHANNEL_5;
|
||||||
|
cmdBuffer[12] = SUS::DUMMY_BYTE;
|
||||||
|
cmdBuffer[13] = SUS::DUMMY_BYTE;
|
||||||
// cmdBuffer[0] = SUS::SETUP_DEFINITION;
|
// cmdBuffer[0] = SUS::SETUP_DEFINITION;
|
||||||
// cmdBuffer[1] = SUS::UNIPOLAR_CONFIG;
|
// cmdBuffer[1] = SUS::UNIPOLAR_CONFIG;
|
||||||
// cmdBuffer[2] = SUS::CONVERT_TEMPERATURE;
|
// cmdBuffer[2] = SUS::CONVERT_TEMPERATURE;
|
||||||
@ -96,7 +107,7 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
|
|||||||
// cmdBuffer[30] = SUS::CONVERT_DIFF_CHANNEL_4_5;
|
// cmdBuffer[30] = SUS::CONVERT_DIFF_CHANNEL_4_5;
|
||||||
rawPacket = cmdBuffer;
|
rawPacket = cmdBuffer;
|
||||||
// rawPacketLen = SUS::SIZE_PERFORM_CONVERSIONS;
|
// rawPacketLen = SUS::SIZE_PERFORM_CONVERSIONS;
|
||||||
rawPacketLen = 3;
|
rawPacketLen = 14;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
case(SUS::RQUEST_TEMP): {
|
case(SUS::RQUEST_TEMP): {
|
||||||
@ -142,7 +153,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
const uint8_t *packet) {
|
const uint8_t *packet) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SUS::PERFORM_CONVERSIONS: {
|
case SUS::PERFORM_CONVERSIONS: {
|
||||||
// gpioComIF->pullHigh(chipSelectId);
|
gpioComIF->pullHigh(chipSelectId);
|
||||||
PoolReadGuard readSet(&dataset);
|
PoolReadGuard readSet(&dataset);
|
||||||
dataset.temperatureCelcius = (*(packet + 25) << 8 | *(packet + 26)) * 0.125;
|
dataset.temperatureCelcius = (*(packet + 25) << 8 | *(packet + 26)) * 0.125;
|
||||||
dataset.diffScanChannel0_1 = (*(packet + 29) << 8 | *(packet + 30));
|
dataset.diffScanChannel0_1 = (*(packet + 29) << 8 | *(packet + 30));
|
||||||
|
@ -60,7 +60,7 @@ private:
|
|||||||
|
|
||||||
uint8_t cmdBuffer[SUS::MAX_CMD_SIZE];
|
uint8_t cmdBuffer[SUS::MAX_CMD_SIZE];
|
||||||
InternalState internalState = InternalState::SETUP;
|
InternalState internalState = InternalState::SETUP;
|
||||||
CommunicationStep communicationStep = CommunicationStep::PERFORM_CONVERSIONS;
|
CommunicationStep communicationStep = CommunicationStep::WRITE_SETUP;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_SUSHANDLER_H_ */
|
#endif /* MISSION_DEVICES_SUSHANDLER_H_ */
|
||||||
|
@ -19,7 +19,7 @@ namespace SUS {
|
|||||||
* power on.
|
* power on.
|
||||||
*
|
*
|
||||||
* @note Bit1 (DIFFSEL1) - Bit0 (DIFFSEL0): 0b00, No byte is following the setup byte
|
* @note Bit1 (DIFFSEL1) - Bit0 (DIFFSEL0): 0b00, No byte is following the setup byte
|
||||||
* Bit3 (REFSEL1) - Bit2 (REFSEL0): 0b00, internal reference, needs wake-up delay
|
* Bit3 (REFSEL1) - Bit2 (REFSEL0): 0b10, internal reference, no wake-up delay
|
||||||
* Bit5 (CLKSEL1) - Bit4 (CLKSEL0): 0b11, MAX1227 clocked through SPI SCLK
|
* Bit5 (CLKSEL1) - Bit4 (CLKSEL0): 0b11, MAX1227 clocked through SPI SCLK
|
||||||
* Bit7 - Bit6: 0b01, tells MAX1227 that this is the setup register
|
* Bit7 - Bit6: 0b01, tells MAX1227 that this is the setup register
|
||||||
*
|
*
|
||||||
@ -41,6 +41,7 @@ namespace SUS {
|
|||||||
static const uint8_t CONVERT_DIFF_CHANNEL_2 = 0b10010110;
|
static const uint8_t CONVERT_DIFF_CHANNEL_2 = 0b10010110;
|
||||||
static const uint8_t CONVERT_DIFF_CHANNEL_3 = 0b10011110;
|
static const uint8_t CONVERT_DIFF_CHANNEL_3 = 0b10011110;
|
||||||
static const uint8_t CONVERT_DIFF_CHANNEL_4 = 0b10100110;
|
static const uint8_t CONVERT_DIFF_CHANNEL_4 = 0b10100110;
|
||||||
|
static const uint8_t CONVERT_DIFF_CHANNEL_5 = 0b10101110;
|
||||||
|
|
||||||
static const uint8_t RESET_FIFO = 0b00011000;
|
static const uint8_t RESET_FIFO = 0b00011000;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user