usbBlaster: fix read bit align and don't potentially write when just set clk low

This commit is contained in:
Gwenhael Goavec-Merou 2020-09-12 18:13:53 +02:00
parent 1345e6da6d
commit a220226a9e
1 changed files with 2 additions and 2 deletions

View File

@ -260,8 +260,8 @@ int UsbBlaster::writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool end)
if (writeBit((rx)? &tmp:NULL, 1) < 0)
return -EXIT_FAILURE;
if (rx)
*rx_ptr |= ((tmp & 0x80) << (7 - nb_bit));
_in_buf[_nb_bit++] = mask | mode;
*rx_ptr = (tmp & 0x80) | ((*rx_ptr) >> 1);
_in_buf[_nb_bit++] = mask;
if (writeBit(NULL, 0) < 0)
return -EXIT_FAILURE;
}