DS3231 does not work in H7

Hi, I would like to use a real time model in H7, but compile shows some errors, as below, How to
solve it? Many thanks.

Arduino: 1.8.12 (Windows 10), Board: "Arduino Portenta H7 (M7 core)"

In file included from C:\Users\myshi\Documents\Arduino\libraries\DS3231\DS3231.cpp:30:0:

C:\Users\myshi\Documents\Arduino\libraries\DS3231\hardware/arm/HW_ARM.h: In member function 'void DS3231::begin()':

C:\Users\myshi\Documents\Arduino\libraries\DS3231\hardware/arm/HW_ARM.h:7:3: error: 'twi' was not declared in this scope

twi = TWI1;

^~~

C:\Users\myshi\Documents\Arduino\libraries\DS3231\hardware/arm/HW_ARM.h:7:9: error: 'TWI1' was not declared in this scope

twi = TWI1;

^~~~

C:\Users\myshi\Documents\Arduino\libraries\DS3231\hardware/arm/HW_ARM.h:7:9: note: suggested alternative: 'SPI1'

twi = TWI1;

^~~~

SPI1

C:\Users\myshi\Documents\Arduino\libraries\DS3231\hardware/arm/HW_ARM.h:8:25: error: 'WIRE_INTERFACE_ID' was not declared in this scope

pmc_enable_periph_clk(WIRE_INTERFACE_ID);

^~~~~~~~~~~~~~~~~

C:\Users\myshi\Documents\Arduino\libraries\DS3231\hardware/arm/HW_ARM.h:8:25: note: suggested alternative: 'SET_INTERFACE'

pmc_enable_periph_clk(WIRE_INTERFACE_ID);

^~~~~~~~~~~~~~~~~

SET_INTERFACE

C:\Users\myshi\Documents\Arduino\libraries\DS3231\hardware/arm/HW_ARM.h:8:3: error: 'pmc_enable_periph_clk' was not declared in this scope

pmc_enable_periph_clk(WIRE_INTERFACE_ID);

^~~~~~~~~~~~~~~~~~~~~

C:\Users\myshi\Documents\Arduino\libraries\DS3231\hardware/arm/HW_ARM.h:9:49: error: 'PinDescription {aka struct _PinDescription}' has no member named 'pPort'

PIO_Configure(g_APinDescription[PIN_WIRE_SDA].pPort, g_APinDescription[PIN_WIRE_SDA].ulPinType, g_APinDescription[PIN_WIRE_SDA].ulPin, g_APinDescription[PIN_WIRE_SDA].ulPinConfiguration);

^~~~~

^~~~~~~~~~~

C:\Users\myshi\Documents\Arduino\libraries\DS3231\DS3231.cpp: In member function 'uint8_t DS3231::_readByte()':

C:\Users\myshi\Documents\Arduino\libraries\DS3231\DS3231.cpp:407:28: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]

value |= (currentBit << 7-i);

~^~

exit status 1
Error compiling for board Arduino Portenta H7 (M7 core).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

DS3231.zip (381 KB)

I hope this issue is addressed because I am experiencing the same thing.

What DS3231 library do you use?

I tried "RTC by Makuna" library and successfully compiled the included example without error.
I just compiled and not executed.(I don't have any DS3231 modules at hand right now.)