mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Make sure that we send out empty bytes when receiving multiple bytes
Also fixed some comments
This commit is contained in:
parent
e132b5f4ca
commit
963c157bc5
1 changed files with 3 additions and 2 deletions
|
@ -236,7 +236,7 @@ uint8_t MAX3421e< SPI_SS, INTR >::regRd(uint8_t reg) {
|
||||||
SPI_SS::Set();
|
SPI_SS::Set();
|
||||||
#elif USING_SPI4TEENSY3
|
#elif USING_SPI4TEENSY3
|
||||||
spi4teensy3::send(reg);
|
spi4teensy3::send(reg);
|
||||||
uint8_t rv = spi4teensy3::receive(); // Send empty byte
|
uint8_t rv = spi4teensy3::receive();
|
||||||
SPI_SS::Set();
|
SPI_SS::Set();
|
||||||
#else
|
#else
|
||||||
SPDR = reg;
|
SPDR = reg;
|
||||||
|
@ -266,6 +266,7 @@ uint8_t* MAX3421e< SPI_SS, INTR >::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t*
|
||||||
|
|
||||||
#if SPI_HAS_TRANSACTION
|
#if SPI_HAS_TRANSACTION
|
||||||
SPI.transfer(reg);
|
SPI.transfer(reg);
|
||||||
|
memset(data_p, 0, nbytes); // Make sure we send out empty bytes
|
||||||
SPI.transfer(data_p, nbytes);
|
SPI.transfer(data_p, nbytes);
|
||||||
data_p += nbytes;
|
data_p += nbytes;
|
||||||
#elif USING_SPI4TEENSY3
|
#elif USING_SPI4TEENSY3
|
||||||
|
@ -282,7 +283,7 @@ uint8_t* MAX3421e< SPI_SS, INTR >::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t*
|
||||||
SPDR = reg;
|
SPDR = reg;
|
||||||
while(!(SPSR & (1 << SPIF))); //wait
|
while(!(SPSR & (1 << SPIF))); //wait
|
||||||
while(nbytes) {
|
while(nbytes) {
|
||||||
SPDR = 0; //send empty byte
|
SPDR = 0; // Send empty byte
|
||||||
nbytes--;
|
nbytes--;
|
||||||
while(!(SPSR & (1 << SPIF)));
|
while(!(SPSR & (1 << SPIF)));
|
||||||
#if 0
|
#if 0
|
||||||
|
|
Loading…
Reference in a new issue