Skip to content

Commit

Permalink
Merge pull request #13 from bcmi-labs/portentas_compatibility
Browse files Browse the repository at this point in the history
Add Portenta H7 and C33 compatibility for this library.
  • Loading branch information
aentinger authored Oct 17, 2024
2 parents c0ff964 + ee39194 commit 32d1f95
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 26 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ jobs:
- fqbn: arduino:renesas_uno:unor4wifi
platforms: |
- name: arduino:renesas_uno
- fqbn: arduino:renesas_portenta:portenta_c33
platforms: |
- name: arduino:renesas_portenta
- fqbn: arduino:mbed_giga:giga
platforms: |
- name: arduino:mbed_giga
- fqbn: arduino:mbed_portenta:envie_m7
platforms: |
- name: arduino:mbed_portenta
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion examples/UDP_Client/UDP_Client.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static uint16_t const UDP_SERVER_PORT = 8888;
**************************************************************************************/

auto const tc6_io = new TC6::TC6_Io(
#ifdef ARDUINO_GIGA
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
SPI1
#else
SPI
Expand Down
2 changes: 1 addition & 1 deletion examples/UDP_Server/UDP_Server.ino
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static uint16_t const UDP_SERVER_LOCAL_PORT = 8888;
**************************************************************************************/

auto const tc6_io = new TC6::TC6_Io(
#ifdef ARDUINO_GIGA
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
SPI1
#else
SPI
Expand Down
2 changes: 1 addition & 1 deletion examples/iperf-client/iperf-client.ino
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static T1SMacSettings const t1s_mac_settings{MAC_PROMISCUOUS_MODE, MAC_TX_CUT_TH
**************************************************************************************/

auto const tc6_io = new TC6::TC6_Io(
#ifdef ARDUINO_GIGA
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
SPI1
#else
SPI
Expand Down
2 changes: 1 addition & 1 deletion examples/tools/Control-DIOx/Control-DIOx.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static auto const DIO_PIN = TC6::DIO::A0;
**************************************************************************************/

auto const tc6_io = new TC6::TC6_Io(
#ifdef ARDUINO_GIGA
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
SPI1
#else
SPI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static T1SMacSettings const t1s_default_mac_settings;
**************************************************************************************/

auto const tc6_io = new TC6::TC6_Io(
#ifdef ARDUINO_GIGA
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
SPI1
#else
SPI
Expand Down
2 changes: 1 addition & 1 deletion examples/tools/PoDL-Source/PoDL-Source.ino
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static T1SMacSettings const t1s_default_mac_settings;
**************************************************************************************/

auto const tc6_io = new TC6::TC6_Io(
#ifdef ARDUINO_GIGA
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
SPI1
#else
SPI
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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,mbed_giga
architectures=samd,renesas_uno,renesas_portenta,mbed_giga,mbed_portenta
11 changes: 11 additions & 0 deletions src/Arduino_10BASE_T1S.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ static int const IRQ_PIN = 2;
static int const CS_PIN = 9;
static int const RESET_PIN = 4;
static int const IRQ_PIN = 2;
#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
/* Pro Demo kit on MID carrier, UNO form factor */
#include "pinDefinitions.h"
static int const CS_PIN = PinNameToIndex(PH_6);
static int const RESET_PIN = PinNameToIndex(PJ_11);
static int const IRQ_PIN = PinNameToIndex(PC_7);
#elif defined(ARDUINO_PORTENTA_C33)
/* Pro Demo kit on MID carrier, UNO form factor */
static int const CS_PIN = 25;
static int const RESET_PIN = 4;
static int const IRQ_PIN = 2;
#else
# error "No pins defined for your board"
#endif
34 changes: 15 additions & 19 deletions src/MacAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,31 +82,27 @@ void get_unique_chip_id_3(uint8_t * uid)
uint32_t const samd_uid = *(volatile uint32_t*)(0x0080A048);
memcpy(uid, &samd_uid, 3);
}
#elif defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4)
#elif defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_PORTENTA_C33)
{
#define BSP_FEATURE_BSP_MCU_INFO_POINTER_LOCATION (0x407FB19C)
#define BSP_FEATURE_BSP_UNIQUE_ID_OFFSET (0x14)
#define BSP_FEATURE_BSP_UNIQUE_ID_POINTER ((*(uint32_t *) BSP_FEATURE_BSP_MCU_INFO_POINTER_LOCATION) \
+ \
BSP_FEATURE_BSP_UNIQUE_ID_OFFSET)
typedef struct st_bsp_unique_id
{
union
{
uint32_t unique_id_words[4];
uint8_t unique_id_bytes[16];
};
} bsp_unique_id_t;

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);
const bsp_unique_id_t* t = R_BSP_UniqueIdGet();
memcpy(uid, t->unique_id_bytes, 3);
}
#elif defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
{
uint32_t const stm32_uid = HAL_GetUIDw2();
memcpy(uid, &stm32_uid, 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
}
}

#if defined(ARDUINO_PORTENTA_C33)
extern "C" int LWIP_RAND() {
return rand();
}
#endif

0 comments on commit 32d1f95

Please sign in to comment.