mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Merge branch 'master' of github.com:felis/USB_Host_Shield_2.0
This commit is contained in:
commit
08121e1701
13 changed files with 72 additions and 73 deletions
12
BTD.cpp
12
BTD.cpp
|
@ -335,15 +335,13 @@ void BTD::EndpointXtract(uint8_t conf, uint8_t iface __attribute__((unused)), ui
|
|||
bConfNum = conf;
|
||||
uint8_t index;
|
||||
|
||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80) { // Interrupt In endpoint found
|
||||
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80) { // Interrupt In endpoint found
|
||||
index = BTD_EVENT_PIPE;
|
||||
epInfo[index].bmNakPower = USB_NAK_NOWAIT;
|
||||
} else {
|
||||
if((pep->bmAttributes & 0x02) == 2) // Bulk endpoint found
|
||||
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? BTD_DATAIN_PIPE : BTD_DATAOUT_PIPE;
|
||||
else
|
||||
return;
|
||||
}
|
||||
} else if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) // Bulk endpoint found
|
||||
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? BTD_DATAIN_PIPE : BTD_DATAOUT_PIPE;
|
||||
else
|
||||
return;
|
||||
|
||||
// Fill the rest of endpoint data structure
|
||||
epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
|
||||
|
|
2
adk.cpp
2
adk.cpp
|
@ -321,7 +321,7 @@ void ADK::EndpointXtract(uint8_t conf, uint8_t iface __attribute__((unused)), ui
|
|||
|
||||
bConfNum = conf;
|
||||
|
||||
if((pep->bmAttributes & 0x02) == 2) {
|
||||
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) {
|
||||
uint8_t index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
||||
// Fill in the endpoint info structure
|
||||
epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
|
||||
|
|
|
@ -237,10 +237,9 @@ void ACM::EndpointXtract(uint8_t conf, uint8_t iface __attribute__((unused)), ui
|
|||
|
||||
uint8_t index;
|
||||
|
||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
|
||||
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80)
|
||||
index = epInterruptInIndex;
|
||||
else
|
||||
if((pep->bmAttributes & 0x02) == 2)
|
||||
else if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK)
|
||||
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
||||
else
|
||||
return;
|
||||
|
|
|
@ -229,10 +229,9 @@ void FTDI::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t prot
|
|||
|
||||
uint8_t index;
|
||||
|
||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
|
||||
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80)
|
||||
index = epInterruptInIndex;
|
||||
else
|
||||
if((pep->bmAttributes & 0x02) == 2)
|
||||
else if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK)
|
||||
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
||||
else
|
||||
return;
|
||||
|
|
|
@ -546,7 +546,7 @@ void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t
|
|||
bConfNum = conf;
|
||||
bIfaceNum = iface;
|
||||
|
||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80) {
|
||||
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80) {
|
||||
if(pep->bInterval > bInterval) bInterval = pep->bInterval;
|
||||
|
||||
// Fill in the endpoint info structure
|
||||
|
|
|
@ -313,29 +313,27 @@ void HIDComposite::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint
|
|||
bNumIface++;
|
||||
}
|
||||
|
||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
|
||||
index = epInterruptInIndex;
|
||||
else
|
||||
index = epInterruptOutIndex;
|
||||
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT)
|
||||
index = (pep->bEndpointAddress & 0x80) == 0x80 ? epInterruptInIndex : epInterruptOutIndex;
|
||||
|
||||
if(!SelectInterface(iface, proto))
|
||||
index = 0;
|
||||
index = 0;
|
||||
|
||||
if(index) {
|
||||
// Fill in the endpoint info structure
|
||||
epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F);
|
||||
epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize;
|
||||
epInfo[bNumEP].bmSndToggle = 0;
|
||||
epInfo[bNumEP].bmRcvToggle = 0;
|
||||
epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT;
|
||||
// Fill in the endpoint info structure
|
||||
epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F);
|
||||
epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize;
|
||||
epInfo[bNumEP].bmSndToggle = 0;
|
||||
epInfo[bNumEP].bmRcvToggle = 0;
|
||||
epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT;
|
||||
|
||||
// Fill in the endpoint index list
|
||||
piface->epIndex[index] = bNumEP; //(pep->bEndpointAddress & 0x0F);
|
||||
// Fill in the endpoint index list
|
||||
piface->epIndex[index] = bNumEP; //(pep->bEndpointAddress & 0x0F);
|
||||
|
||||
if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
|
||||
pollInterval = pep->bInterval;
|
||||
if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
|
||||
pollInterval = pep->bInterval;
|
||||
|
||||
bNumEP++;
|
||||
bNumEP++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -315,10 +315,8 @@ void HIDUniversal::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint
|
|||
bNumIface++;
|
||||
}
|
||||
|
||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
|
||||
index = epInterruptInIndex;
|
||||
else
|
||||
index = epInterruptOutIndex;
|
||||
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT)
|
||||
index = (pep->bEndpointAddress & 0x80) == 0x80 ? epInterruptInIndex : epInterruptOutIndex;
|
||||
|
||||
if(index) {
|
||||
// Fill in the endpoint info structure
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
"type": "git",
|
||||
"url": "https://github.com/felis/USB_Host_Shield_2.0.git"
|
||||
},
|
||||
"version": "1.3.0",
|
||||
"version": "1.3.1",
|
||||
"license": "GPL-2.0",
|
||||
"examples":
|
||||
[
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name=USB Host Shield Library 2.0
|
||||
version=1.3.0
|
||||
version=1.3.1
|
||||
author=Oleg Mazurov (Circuits@Home) <mazurov@circuitsathome.com>, Kristian Lauszus (TKJ Electronics) <kristianl@tkjelectronics.com>, Andrew Kroll <xxxajk@gmail.com>, Alexei Glushchenko (Circuits@Home) <alex-gl@mail.ru>
|
||||
maintainer=Oleg Mazurov (Circuits@Home) <mazurov@circuitsathome.com>, Kristian Lauszus (TKJ Electronics) <kristianl@tkjelectronics.com>, Andrew Kroll <xxxajk@gmail.com>
|
||||
sentence=Revision 2.0 of MAX3421E-based USB Host Shield Library.
|
||||
|
|
|
@ -550,7 +550,7 @@ void BulkOnly::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t
|
|||
uint8_t index;
|
||||
|
||||
#if 1
|
||||
if((pep->bmAttributes & 0x02) == 2) {
|
||||
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) {
|
||||
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
||||
// Fill in the endpoint info structure
|
||||
epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
|
||||
|
@ -564,10 +564,9 @@ void BulkOnly::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t
|
|||
|
||||
}
|
||||
#else
|
||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
|
||||
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80)
|
||||
index = epInterruptInIndex;
|
||||
else
|
||||
if((pep->bmAttributes & 0x02) == 2)
|
||||
else if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK)
|
||||
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
||||
else
|
||||
return;
|
||||
|
|
|
@ -19,6 +19,14 @@ e-mail : support@circuitsathome.com
|
|||
#define USB_HOST_SHIELD_SETTINGS_H
|
||||
#include "macros.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// SPI Configuration
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef USB_SPI
|
||||
#define USB_SPI SPI
|
||||
//#define USB_SPI SPI1
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// DEBUGGING
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -304,7 +304,7 @@ uint8_t USBH_MIDI::parseConfigDescr( uint8_t addr, uint8_t conf )
|
|||
USBTRACE("-EPAddr:"), D_PrintHex(epDesc->bEndpointAddress, 0x80);
|
||||
USBTRACE(" bmAttr:"), D_PrintHex(epDesc->bmAttributes, 0x80);
|
||||
USBTRACE2(" MaxPktSz:", (uint8_t)epDesc->wMaxPacketSize);
|
||||
if ((epDesc->bmAttributes & 0x02) == 2) {//bulk
|
||||
if ((epDesc->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) {//bulk
|
||||
uint8_t index;
|
||||
if( isMidi )
|
||||
index = ((epDesc->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
||||
|
|
62
usbhost.h
62
usbhost.h
|
@ -41,7 +41,7 @@ public:
|
|||
}
|
||||
#elif defined(SPI_HAS_TRANSACTION)
|
||||
static void init() {
|
||||
SPI.begin(); // The SPI library with transaction will take care of setting up the pins - settings is set in beginTransaction()
|
||||
USB_SPI.begin(); // The SPI library with transaction will take care of setting up the pins - settings is set in beginTransaction()
|
||||
SPI_SS::SetDirWrite();
|
||||
SPI_SS::Set();
|
||||
}
|
||||
|
@ -54,17 +54,17 @@ public:
|
|||
static void init() {
|
||||
SPI_SS::SetDirWrite();
|
||||
SPI_SS::Set();
|
||||
SPI.begin();
|
||||
USB_SPI.begin();
|
||||
#if defined(__MIPSEL__)
|
||||
SPI.setClockDivider(1);
|
||||
USB_SPI.setClockDivider(1);
|
||||
#elif defined(__ARDUINO_X86__)
|
||||
#ifdef SPI_CLOCK_1M // Hack used to check if setClockSpeed is available
|
||||
SPI.setClockSpeed(12000000); // The MAX3421E can handle up to 26MHz, but in practice this was the maximum that I could reliably use
|
||||
USB_SPI.setClockSpeed(12000000); // The MAX3421E can handle up to 26MHz, but in practice this was the maximum that I could reliably use
|
||||
#else
|
||||
SPI.setClockDivider(SPI_CLOCK_DIV2); // This will set the SPI frequency to 8MHz - it could be higher, but it is not supported in the old API
|
||||
USB_SPI.setClockDivider(SPI_CLOCK_DIV2); // This will set the SPI frequency to 8MHz - it could be higher, but it is not supported in the old API
|
||||
#endif
|
||||
#elif !defined(RBL_NRF51822)
|
||||
SPI.setClockDivider(4); // Set speed to 84MHz/4=21MHz - the MAX3421E can handle up to 26MHz
|
||||
USB_SPI.setClockDivider(4); // Set speed to 84MHz/4=21MHz - the MAX3421E can handle up to 26MHz
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
|
@ -167,7 +167,7 @@ template< typename SPI_SS, typename INTR >
|
|||
void MAX3421e< SPI_SS, INTR >::regWr(uint8_t reg, uint8_t data) {
|
||||
XMEM_ACQUIRE_SPI();
|
||||
#if defined(SPI_HAS_TRANSACTION)
|
||||
SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
|
||||
USB_SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
|
||||
#endif
|
||||
SPI_SS::Clear();
|
||||
|
||||
|
@ -180,15 +180,15 @@ void MAX3421e< SPI_SS, INTR >::regWr(uint8_t reg, uint8_t data) {
|
|||
uint8_t c[2];
|
||||
c[0] = reg | 0x02;
|
||||
c[1] = data;
|
||||
SPI.transfer(c, 2);
|
||||
USB_SPI.transfer(c, 2);
|
||||
#elif defined(STM32F4)
|
||||
uint8_t c[2];
|
||||
c[0] = reg | 0x02;
|
||||
c[1] = data;
|
||||
HAL_SPI_Transmit(&SPI_Handle, c, 2, HAL_MAX_DELAY);
|
||||
#elif !defined(SPDR) // ESP8266
|
||||
SPI.transfer(reg | 0x02);
|
||||
SPI.transfer(data);
|
||||
USB_SPI.transfer(reg | 0x02);
|
||||
USB_SPI.transfer(data);
|
||||
#else
|
||||
SPDR = (reg | 0x02);
|
||||
while(!(SPSR & (1 << SPIF)));
|
||||
|
@ -198,7 +198,7 @@ void MAX3421e< SPI_SS, INTR >::regWr(uint8_t reg, uint8_t data) {
|
|||
|
||||
SPI_SS::Set();
|
||||
#if defined(SPI_HAS_TRANSACTION)
|
||||
SPI.endTransaction();
|
||||
USB_SPI.endTransaction();
|
||||
#endif
|
||||
XMEM_RELEASE_SPI();
|
||||
return;
|
||||
|
@ -210,7 +210,7 @@ template< typename SPI_SS, typename INTR >
|
|||
uint8_t* MAX3421e< SPI_SS, INTR >::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p) {
|
||||
XMEM_ACQUIRE_SPI();
|
||||
#if defined(SPI_HAS_TRANSACTION)
|
||||
SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
|
||||
USB_SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
|
||||
#endif
|
||||
SPI_SS::Clear();
|
||||
|
||||
|
@ -219,12 +219,12 @@ uint8_t* MAX3421e< SPI_SS, INTR >::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t*
|
|||
spi4teensy3::send(data_p, nbytes);
|
||||
data_p += nbytes;
|
||||
#elif defined(SPI_HAS_TRANSACTION) && !defined(ESP8266)
|
||||
SPI.transfer(reg | 0x02);
|
||||
SPI.transfer(data_p, nbytes);
|
||||
USB_SPI.transfer(reg | 0x02);
|
||||
USB_SPI.transfer(data_p, nbytes);
|
||||
data_p += nbytes;
|
||||
#elif defined(__ARDUINO_X86__)
|
||||
SPI.transfer(reg | 0x02);
|
||||
SPI.transferBuffer(data_p, NULL, nbytes);
|
||||
USB_SPI.transfer(reg | 0x02);
|
||||
USB_SPI.transferBuffer(data_p, NULL, nbytes);
|
||||
data_p += nbytes;
|
||||
#elif defined(STM32F4)
|
||||
uint8_t data = reg | 0x02;
|
||||
|
@ -232,9 +232,9 @@ uint8_t* MAX3421e< SPI_SS, INTR >::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t*
|
|||
HAL_SPI_Transmit(&SPI_Handle, data_p, nbytes, HAL_MAX_DELAY);
|
||||
data_p += nbytes;
|
||||
#elif !defined(SPDR) // ESP8266
|
||||
SPI.transfer(reg | 0x02);
|
||||
USB_SPI.transfer(reg | 0x02);
|
||||
while(nbytes) {
|
||||
SPI.transfer(*data_p);
|
||||
USB_SPI.transfer(*data_p);
|
||||
nbytes--;
|
||||
data_p++; // advance data pointer
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ uint8_t* MAX3421e< SPI_SS, INTR >::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t*
|
|||
|
||||
SPI_SS::Set();
|
||||
#if defined(SPI_HAS_TRANSACTION)
|
||||
SPI.endTransaction();
|
||||
USB_SPI.endTransaction();
|
||||
#endif
|
||||
XMEM_RELEASE_SPI();
|
||||
return ( data_p);
|
||||
|
@ -273,7 +273,7 @@ template< typename SPI_SS, typename INTR >
|
|||
uint8_t MAX3421e< SPI_SS, INTR >::regRd(uint8_t reg) {
|
||||
XMEM_ACQUIRE_SPI();
|
||||
#if defined(SPI_HAS_TRANSACTION)
|
||||
SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
|
||||
USB_SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
|
||||
#endif
|
||||
SPI_SS::Clear();
|
||||
|
||||
|
@ -287,8 +287,8 @@ uint8_t MAX3421e< SPI_SS, INTR >::regRd(uint8_t reg) {
|
|||
HAL_SPI_Receive(&SPI_Handle, &rv, 1, HAL_MAX_DELAY);
|
||||
SPI_SS::Set();
|
||||
#elif !defined(SPDR) || defined(SPI_HAS_TRANSACTION)
|
||||
SPI.transfer(reg);
|
||||
uint8_t rv = SPI.transfer(0); // Send empty byte
|
||||
USB_SPI.transfer(reg);
|
||||
uint8_t rv = USB_SPI.transfer(0); // Send empty byte
|
||||
SPI_SS::Set();
|
||||
#else
|
||||
SPDR = reg;
|
||||
|
@ -300,7 +300,7 @@ uint8_t MAX3421e< SPI_SS, INTR >::regRd(uint8_t reg) {
|
|||
#endif
|
||||
|
||||
#if defined(SPI_HAS_TRANSACTION)
|
||||
SPI.endTransaction();
|
||||
USB_SPI.endTransaction();
|
||||
#endif
|
||||
XMEM_RELEASE_SPI();
|
||||
return (rv);
|
||||
|
@ -312,7 +312,7 @@ template< typename SPI_SS, typename INTR >
|
|||
uint8_t* MAX3421e< SPI_SS, INTR >::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t* data_p) {
|
||||
XMEM_ACQUIRE_SPI();
|
||||
#if defined(SPI_HAS_TRANSACTION)
|
||||
SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
|
||||
USB_SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
|
||||
#endif
|
||||
SPI_SS::Clear();
|
||||
|
||||
|
@ -321,13 +321,13 @@ uint8_t* MAX3421e< SPI_SS, INTR >::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t*
|
|||
spi4teensy3::receive(data_p, nbytes);
|
||||
data_p += nbytes;
|
||||
#elif defined(SPI_HAS_TRANSACTION) && !defined(ESP8266)
|
||||
SPI.transfer(reg);
|
||||
USB_SPI.transfer(reg);
|
||||
memset(data_p, 0, nbytes); // Make sure we send out empty bytes
|
||||
SPI.transfer(data_p, nbytes);
|
||||
USB_SPI.transfer(data_p, nbytes);
|
||||
data_p += nbytes;
|
||||
#elif defined(__ARDUINO_X86__)
|
||||
SPI.transfer(reg);
|
||||
SPI.transferBuffer(NULL, data_p, nbytes);
|
||||
USB_SPI.transfer(reg);
|
||||
USB_SPI.transferBuffer(NULL, data_p, nbytes);
|
||||
data_p += nbytes;
|
||||
#elif defined(STM32F4)
|
||||
HAL_SPI_Transmit(&SPI_Handle, ®, 1, HAL_MAX_DELAY);
|
||||
|
@ -335,9 +335,9 @@ uint8_t* MAX3421e< SPI_SS, INTR >::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t*
|
|||
HAL_SPI_Receive(&SPI_Handle, data_p, nbytes, HAL_MAX_DELAY);
|
||||
data_p += nbytes;
|
||||
#elif !defined(SPDR) // ESP8266
|
||||
SPI.transfer(reg);
|
||||
USB_SPI.transfer(reg);
|
||||
while(nbytes) {
|
||||
*data_p++ = SPI.transfer(0);
|
||||
*data_p++ = USB_SPI.transfer(0);
|
||||
nbytes--;
|
||||
}
|
||||
#else
|
||||
|
@ -363,7 +363,7 @@ uint8_t* MAX3421e< SPI_SS, INTR >::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t*
|
|||
|
||||
SPI_SS::Set();
|
||||
#if defined(SPI_HAS_TRANSACTION)
|
||||
SPI.endTransaction();
|
||||
USB_SPI.endTransaction();
|
||||
#endif
|
||||
XMEM_RELEASE_SPI();
|
||||
return ( data_p);
|
||||
|
|
Loading…
Reference in a new issue