Skip to content

Commit 32d1f95

Browse files
authored
Merge pull request #13 from bcmi-labs/portentas_compatibility
Add Portenta H7 and C33 compatibility for this library.
2 parents c0ff964 + ee39194 commit 32d1f95

File tree

10 files changed

+39
-26
lines changed

10 files changed

+39
-26
lines changed

Diff for: .github/workflows/compile-examples.yml

+6
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,15 @@ jobs:
4242
- fqbn: arduino:renesas_uno:unor4wifi
4343
platforms: |
4444
- name: arduino:renesas_uno
45+
- fqbn: arduino:renesas_portenta:portenta_c33
46+
platforms: |
47+
- name: arduino:renesas_portenta
4548
- fqbn: arduino:mbed_giga:giga
4649
platforms: |
4750
- name: arduino:mbed_giga
51+
- fqbn: arduino:mbed_portenta:envie_m7
52+
platforms: |
53+
- name: arduino:mbed_portenta
4854
4955
steps:
5056
- name: Checkout

Diff for: examples/UDP_Client/UDP_Client.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static uint16_t const UDP_SERVER_PORT = 8888;
3535
**************************************************************************************/
3636

3737
auto const tc6_io = new TC6::TC6_Io(
38-
#ifdef ARDUINO_GIGA
38+
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
3939
SPI1
4040
#else
4141
SPI

Diff for: examples/UDP_Server/UDP_Server.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static uint16_t const UDP_SERVER_LOCAL_PORT = 8888;
3939
**************************************************************************************/
4040

4141
auto const tc6_io = new TC6::TC6_Io(
42-
#ifdef ARDUINO_GIGA
42+
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
4343
SPI1
4444
#else
4545
SPI

Diff for: examples/iperf-client/iperf-client.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static T1SMacSettings const t1s_mac_settings{MAC_PROMISCUOUS_MODE, MAC_TX_CUT_TH
4242
**************************************************************************************/
4343

4444
auto const tc6_io = new TC6::TC6_Io(
45-
#ifdef ARDUINO_GIGA
45+
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
4646
SPI1
4747
#else
4848
SPI

Diff for: examples/tools/Control-DIOx/Control-DIOx.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static auto const DIO_PIN = TC6::DIO::A0;
3636
**************************************************************************************/
3737

3838
auto const tc6_io = new TC6::TC6_Io(
39-
#ifdef ARDUINO_GIGA
39+
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
4040
SPI1
4141
#else
4242
SPI

Diff for: examples/tools/PoDL-Sink-Auto-TurnOff/PoDL-Sink-Auto-TurnOff.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static T1SMacSettings const t1s_default_mac_settings;
3333
**************************************************************************************/
3434

3535
auto const tc6_io = new TC6::TC6_Io(
36-
#ifdef ARDUINO_GIGA
36+
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
3737
SPI1
3838
#else
3939
SPI

Diff for: examples/tools/PoDL-Source/PoDL-Source.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static T1SMacSettings const t1s_default_mac_settings;
3333
**************************************************************************************/
3434

3535
auto const tc6_io = new TC6::TC6_Io(
36-
#ifdef ARDUINO_GIGA
36+
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
3737
SPI1
3838
#else
3939
SPI

Diff for: 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,mbed_giga
9+
architectures=samd,renesas_uno,renesas_portenta,mbed_giga,mbed_portenta

Diff for: src/Arduino_10BASE_T1S.h

+11
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ static int const IRQ_PIN = 2;
4040
static int const CS_PIN = 9;
4141
static int const RESET_PIN = 4;
4242
static int const IRQ_PIN = 2;
43+
#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
44+
/* Pro Demo kit on MID carrier, UNO form factor */
45+
#include "pinDefinitions.h"
46+
static int const CS_PIN = PinNameToIndex(PH_6);
47+
static int const RESET_PIN = PinNameToIndex(PJ_11);
48+
static int const IRQ_PIN = PinNameToIndex(PC_7);
49+
#elif defined(ARDUINO_PORTENTA_C33)
50+
/* Pro Demo kit on MID carrier, UNO form factor */
51+
static int const CS_PIN = 25;
52+
static int const RESET_PIN = 4;
53+
static int const IRQ_PIN = 2;
4354
#else
4455
# error "No pins defined for your board"
4556
#endif

Diff for: src/MacAddress.cpp

+15-19
Original file line numberDiff line numberDiff line change
@@ -82,31 +82,27 @@ void get_unique_chip_id_3(uint8_t * uid)
8282
uint32_t const samd_uid = *(volatile uint32_t*)(0x0080A048);
8383
memcpy(uid, &samd_uid, 3);
8484
}
85-
#elif defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4)
85+
#elif defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_PORTENTA_C33)
8686
{
87-
#define BSP_FEATURE_BSP_MCU_INFO_POINTER_LOCATION (0x407FB19C)
88-
#define BSP_FEATURE_BSP_UNIQUE_ID_OFFSET (0x14)
89-
#define BSP_FEATURE_BSP_UNIQUE_ID_POINTER ((*(uint32_t *) BSP_FEATURE_BSP_MCU_INFO_POINTER_LOCATION) \
90-
+ \
91-
BSP_FEATURE_BSP_UNIQUE_ID_OFFSET)
92-
typedef struct st_bsp_unique_id
93-
{
94-
union
95-
{
96-
uint32_t unique_id_words[4];
97-
uint8_t unique_id_bytes[16];
98-
};
99-
} bsp_unique_id_t;
100-
101-
bsp_unique_id_t const * renesas_unique_id = (bsp_unique_id_t *) BSP_FEATURE_BSP_UNIQUE_ID_POINTER;
102-
memcpy(uid, renesas_unique_id->unique_id_bytes, 3);
87+
const bsp_unique_id_t* t = R_BSP_UniqueIdGet();
88+
memcpy(uid, t->unique_id_bytes, 3);
89+
}
90+
#elif defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
91+
{
92+
uint32_t const stm32_uid = HAL_GetUIDw2();
93+
memcpy(uid, &stm32_uid, 3);
10394
}
104-
#elif defined(ARDUINO_GIGA)
10595
{
10696
auto stm32_uid = HAL_GetUIDw2();
10797
memcpy(uid, &stm32_uid, 3);
10898
}
10999
#else
110100
# error "Retrieving a unique chip ID for MAC generation is not supported on this platform."
111101
#endif
112-
}
102+
}
103+
104+
#if defined(ARDUINO_PORTENTA_C33)
105+
extern "C" int LWIP_RAND() {
106+
return rand();
107+
}
108+
#endif

0 commit comments

Comments
 (0)