Skip to content

Commit

Permalink
Fix buggy DSP readback code
Browse files Browse the repository at this point in the history
Without the additional setstop parameter, the code doesn't work very well with the ESP32
  • Loading branch information
MCUdude committed Sep 13, 2023
1 parent 3d151af commit 8220af8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SigmaDSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ void SigmaDSP::writeRegisterBlock(uint16_t memoryAddress, uint16_t length, const
*
* @param memoryAddress DSP memory address
* @param readout Which register to read
* @param numberOfBytes How manu bytes to read
* @param numberOfBytes How many bytes to read
* @return int32_t value where four bytes in the block are concatenated
*/
int32_t SigmaDSP::readBack(uint16_t memoryAddress, uint16_t readout, uint8_t numberOfBytes)
Expand All @@ -1168,7 +1168,7 @@ int32_t SigmaDSP::readBack(uint16_t memoryAddress, uint16_t readout, uint8_t num
_WireObject.endTransmission(false);

int32_t returnVal = 0;
_WireObject.requestFrom(_dspAddress, numberOfBytes);
_WireObject.requestFrom(_dspAddress, numberOfBytes, (uint8_t)0);
for(uint8_t i = 0; i < numberOfBytes; i++)
returnVal = returnVal << 8 | _WireObject.read();

Expand Down

0 comments on commit 8220af8

Please sign in to comment.