diff --git a/examples/LAN8651-iperf/LAN8651-iperf.ino b/examples/LAN8651-iperf/LAN8651-iperf.ino index 3197040..d610ad7 100644 --- a/examples/LAN8651-iperf/LAN8651-iperf.ino +++ b/examples/LAN8651-iperf/LAN8651-iperf.ino @@ -41,11 +41,19 @@ static T1SMacSettings const t1s_mac_settings{MAC_PROMISCUOUS_MODE, MAC_TX_CUT_TH * GLOBAL VARIABLES **************************************************************************************/ +#ifdef ARDUINO_GIGA +auto const tc6_io = new TC6::TC6_Io + ( SPI1 + , CS_PIN + , RESET_PIN + , IRQ_PIN); +#else auto const tc6_io = new TC6::TC6_Io ( SPI , CS_PIN , RESET_PIN , IRQ_PIN); +#endif auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io); /************************************************************************************** diff --git a/library.properties b/library.properties index a3ba219..b949f3a 100644 --- a/library.properties +++ b/library.properties @@ -6,4 +6,4 @@ sentence=Generic library for providing IP based 10BASE-T1S communication. paragraph=This Arduino library provides both low-level drivers and high-level abstractions to perform real-time communication via 10BASE-T1S, a multi-drop capable Ethernet standard. category=Communication url=https://github.com/arduino-libraries/Arduino_10BASE_T1S -architectures=samd,renesas_uno +architectures=samd,renesas_uno,mbed_giga \ No newline at end of file diff --git a/src/Arduino_10BASE_T1S.h b/src/Arduino_10BASE_T1S.h index ee1fde9..78d7306 100644 --- a/src/Arduino_10BASE_T1S.h +++ b/src/Arduino_10BASE_T1S.h @@ -35,7 +35,7 @@ static int const CS_PIN = 10; static int const RESET_PIN = 9; static int const IRQ_PIN = 2; -#elif defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_AVR_UNO_WIFI_REV2) +#elif defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_GIGA) /* Those are all boards with the Arduino Uno form factor for the T1S shield. */ static int const CS_PIN = 9; static int const RESET_PIN = 4; diff --git a/src/MacAddress.cpp b/src/MacAddress.cpp index 72e6892..fa7ab24 100644 --- a/src/MacAddress.cpp +++ b/src/MacAddress.cpp @@ -73,6 +73,7 @@ size_t MacAddress::printTo(Print & p) const /************************************************************************************** * FUNCTION DEFINITION **************************************************************************************/ +#include "Arduino.h" void get_unique_chip_id_3(uint8_t * uid) { @@ -100,6 +101,11 @@ void get_unique_chip_id_3(uint8_t * uid) bsp_unique_id_t const * renesas_unique_id = (bsp_unique_id_t *) BSP_FEATURE_BSP_UNIQUE_ID_POINTER; memcpy(uid, renesas_unique_id->unique_id_bytes, 3); } +#elif defined(ARDUINO_GIGA) + { + auto stm32_uid = HAL_GetUIDw2(); + memcpy(uid, &stm32_uid, 3); + } #else # error "Retrieving a unique chip ID for MAC generation is not supported on this platform." #endif diff --git a/src/microchip/TC6_Arduino_10BASE_T1S.cpp b/src/microchip/TC6_Arduino_10BASE_T1S.cpp index 10468b4..2c48185 100644 --- a/src/microchip/TC6_Arduino_10BASE_T1S.cpp +++ b/src/microchip/TC6_Arduino_10BASE_T1S.cpp @@ -137,9 +137,10 @@ bool TC6_Arduino_10BASE_T1S::begin(IPAddress const ip_addr, memcpy(_lw.ip.mac, mac_addr.data(), sizeof(_lw.ip.mac)); /* Initialize the TC6 library and pass a global tag. */ - if (_lw.tc.tc6 = TC6_Init(&_lw); - _lw.tc.tc6 == NULL) + _lw.tc.tc6 = TC6_Init(&_lw); + if (_lw.tc.tc6 == NULL) { return false; + } TC6ListNode * ptr = tc6_lwip_instance_list_head; while (ptr != nullptr) ptr = ptr->next; diff --git a/src/microchip/TC6_Io.cpp b/src/microchip/TC6_Io.cpp index 3efcc5e..2886141 100644 --- a/src/microchip/TC6_Io.cpp +++ b/src/microchip/TC6_Io.cpp @@ -25,7 +25,7 @@ namespace TC6 * CONSTANTS **************************************************************************************/ -static SPISettings const LAN865x_SPI_SETTING{8 * 1000 * 1000UL, MSBFIRST, SPI_MODE0}; +static SPISettings const LAN865x_SPI_SETTING{24 * 1000 * 1000UL, MSBFIRST, SPI_MODE0}; /************************************************************************************** * STATIC MEMBER DEFINITION @@ -90,8 +90,8 @@ bool TC6_Io::spi_transaction(uint8_t const *pTx, uint8_t *pRx, uint16_t const le digitalWrite(_cs_pin, LOW); _spi.beginTransaction(LAN865x_SPI_SETTING); - for (size_t b = 0; b < len; b++) - pRx[b] = _spi.transfer(pTx[b]); + memcpy(pRx, pTx, len); + _spi.transfer(pRx, len); _spi.endTransaction(); digitalWrite(_cs_pin, HIGH);