Skip to content

Commit

Permalink
Fix spi and i2c header offset
Browse files Browse the repository at this point in the history
align with new implementation

Signed-off-by: Cervenka Dusan <[email protected]>
  • Loading branch information
Hadatko committed Nov 22, 2023
1 parent 685c527 commit 362d2fb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions erpc_python/erpc/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ def close(self):
self._hSIOPort = None

def _base_send(self, message):
#TODO: can we send data at once ?
# Wait for SPI master-slave signalling GPIO pin to be in low state
res = self.sio.GPIO_GetPin(self._gpioport, self._gpiopin)
while (1 == res):
Expand All @@ -312,7 +313,7 @@ def _base_send(self, message):
#print('SPI received %d number of bytes' % rxbytesnumber)
# Send the payload/data
data, rxbytesnumber = self._hSPIPort.Transfer(
0, 15, bytes(message[4:]), len(message) - self.HEADER_LEN, 0)
0, 15, bytes(message[self.HEADER_LEN:]), len(message) - self.HEADER_LEN, 0)
else:
print('SPI transfer error: %d' % rxbytesnumber)

Expand Down Expand Up @@ -407,6 +408,7 @@ def close(self):
self._hSIOPort = None

def _base_send(self, message):
#TODO: can we send data at once ?
# Wait for I2C master-slave signalling GPIO pin to be in low state
res = self.sio.GPIO_GetPin(self._gpioport, self._gpiopin)
while (1 == res):
Expand All @@ -418,7 +420,7 @@ def _base_send(self, message):
#print('I2C received %d number of bytes' % rxbytesnumber)
# Send the payload/data
data, rxbytesnumber = self._hI2CPort.FastXfer(
0x7E, bytes(message[4:]), len(message) - self.HEADER_LEN, 0, False, True)
0x7E, bytes(message[self.HEADER_LEN:]), len(message) - self.HEADER_LEN, 0, False, True)
else:
print('I2C transfer error: %d' % rxbytesnumber)

Expand Down

0 comments on commit 362d2fb

Please sign in to comment.