Skip to content

Commit dc766e1

Browse files
authoredJul 11, 2024··
Merge pull request #8 from bcmi-labs/speedup_and_new_boards
Speedup and new boards
2 parents a50e967 + 1afdaa3 commit dc766e1

File tree

6 files changed

+22
-7
lines changed

6 files changed

+22
-7
lines changed
 

‎examples/LAN8651-iperf/LAN8651-iperf.ino

+8
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,19 @@ static T1SMacSettings const t1s_mac_settings{MAC_PROMISCUOUS_MODE, MAC_TX_CUT_TH
4141
* GLOBAL VARIABLES
4242
**************************************************************************************/
4343

44+
#ifdef ARDUINO_GIGA
45+
auto const tc6_io = new TC6::TC6_Io
46+
( SPI1
47+
, CS_PIN
48+
, RESET_PIN
49+
, IRQ_PIN);
50+
#else
4451
auto const tc6_io = new TC6::TC6_Io
4552
( SPI
4653
, CS_PIN
4754
, RESET_PIN
4855
, IRQ_PIN);
56+
#endif
4957
auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io);
5058

5159
/**************************************************************************************

‎library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ sentence=Generic library for providing IP based 10BASE-T1S communication.
66
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.
77
category=Communication
88
url=https://github.com/arduino-libraries/Arduino_10BASE_T1S
9-
architectures=samd,renesas_uno
9+
architectures=samd,renesas_uno,mbed_giga

‎src/Arduino_10BASE_T1S.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
static int const CS_PIN = 10;
3636
static int const RESET_PIN = 9;
3737
static int const IRQ_PIN = 2;
38-
#elif defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_AVR_UNO_WIFI_REV2)
38+
#elif defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_GIGA)
3939
/* Those are all boards with the Arduino Uno form factor for the T1S shield. */
4040
static int const CS_PIN = 9;
4141
static int const RESET_PIN = 4;

‎src/MacAddress.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ size_t MacAddress::printTo(Print & p) const
7373
/**************************************************************************************
7474
* FUNCTION DEFINITION
7575
**************************************************************************************/
76+
#include "Arduino.h"
7677

7778
void get_unique_chip_id_3(uint8_t * uid)
7879
{
@@ -100,6 +101,11 @@ void get_unique_chip_id_3(uint8_t * uid)
100101
bsp_unique_id_t const * renesas_unique_id = (bsp_unique_id_t *) BSP_FEATURE_BSP_UNIQUE_ID_POINTER;
101102
memcpy(uid, renesas_unique_id->unique_id_bytes, 3);
102103
}
104+
#elif defined(ARDUINO_GIGA)
105+
{
106+
auto stm32_uid = HAL_GetUIDw2();
107+
memcpy(uid, &stm32_uid, 3);
108+
}
103109
#else
104110
# error "Retrieving a unique chip ID for MAC generation is not supported on this platform."
105111
#endif

‎src/microchip/TC6_Arduino_10BASE_T1S.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ bool TC6_Arduino_10BASE_T1S::begin(IPAddress const ip_addr,
137137
memcpy(_lw.ip.mac, mac_addr.data(), sizeof(_lw.ip.mac));
138138

139139
/* Initialize the TC6 library and pass a global tag. */
140-
if (_lw.tc.tc6 = TC6_Init(&_lw);
141-
_lw.tc.tc6 == NULL)
140+
_lw.tc.tc6 = TC6_Init(&_lw);
141+
if (_lw.tc.tc6 == NULL) {
142142
return false;
143+
}
143144

144145
TC6ListNode * ptr = tc6_lwip_instance_list_head;
145146
while (ptr != nullptr) ptr = ptr->next;

‎src/microchip/TC6_Io.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace TC6
2525
* CONSTANTS
2626
**************************************************************************************/
2727

28-
static SPISettings const LAN865x_SPI_SETTING{8 * 1000 * 1000UL, MSBFIRST, SPI_MODE0};
28+
static SPISettings const LAN865x_SPI_SETTING{24 * 1000 * 1000UL, MSBFIRST, SPI_MODE0};
2929

3030
/**************************************************************************************
3131
* STATIC MEMBER DEFINITION
@@ -90,8 +90,8 @@ bool TC6_Io::spi_transaction(uint8_t const *pTx, uint8_t *pRx, uint16_t const le
9090
digitalWrite(_cs_pin, LOW);
9191
_spi.beginTransaction(LAN865x_SPI_SETTING);
9292

93-
for (size_t b = 0; b < len; b++)
94-
pRx[b] = _spi.transfer(pTx[b]);
93+
memcpy(pRx, pTx, len);
94+
_spi.transfer(pRx, len);
9595

9696
_spi.endTransaction();
9797
digitalWrite(_cs_pin, HIGH);

0 commit comments

Comments
 (0)
Please sign in to comment.