Skip to content

Commit edd9c84

Browse files
committed
ported to samd51, work the same as samd21
1 parent 898c62f commit edd9c84

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/arduino/Adafruit_USBH_Host.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ void tuh_max3421_spi_cs_api(uint8_t rhport, bool active) {
134134
bool tuh_max3421_spi_xfer_api(uint8_t rhport, uint8_t const *tx_buf,
135135
size_t tx_len, uint8_t *rx_buf, size_t rx_len) {
136136
(void)rhport;
137+
137138
if (!Adafruit_USBH_Host::_instance) {
138139
return false;
139140
}
140-
141141
Adafruit_USBH_Host *host = Adafruit_USBH_Host::_instance;
142142

143143
// MAX3421e max clock is 26MHz
@@ -171,13 +171,24 @@ bool tuh_max3421_spi_xfer_api(uint8_t rhport, uint8_t const *tx_buf,
171171

172172
void tuh_max3421_int_api(uint8_t rhport, bool enabled) {
173173
(void)rhport;
174+
174175
if (!Adafruit_USBH_Host::_instance) {
175176
return;
176177
}
178+
Adafruit_USBH_Host *host = Adafruit_USBH_Host::_instance;
177179

178180
#ifdef ARDUINO_ARCH_SAMD
179-
#ifdef __SAMD51
181+
#ifdef __SAMD51__
182+
const IRQn_Type irq =
183+
(IRQn_Type)(EIC_0_IRQn + g_APinDescription[host->_intr].ulExtInt);
184+
185+
if (enabled) {
186+
NVIC_EnableIRQ(irq);
187+
} else {
188+
NVIC_DisableIRQ(irq);
189+
}
180190
#else
191+
(void)host;
181192
if (enabled) {
182193
NVIC_EnableIRQ(EIC_IRQn);
183194
} else {

src/arduino/ports/samd/tusb_config_samd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ extern "C" {
4444
#define CFG_TUSB_DEBUG 0
4545
#endif
4646

47+
// For selectively disable device log (when > CFG_TUSB_DEBUG)
48+
// #define CFG_TUD_LOG_LEVEL 3
49+
4750
#define CFG_TUSB_MEM_SECTION
4851
#define CFG_TUSB_MEM_ALIGN TU_ATTR_ALIGNED(4)
4952

0 commit comments

Comments
 (0)