Naguissa / uRTCLib

Really tiny library to basic RTC functionality on Arduino. DS1307, DS3231 and DS3232 RTCs are supported.
https://www.foroelectro.net/librerias-arduino-ide-f29/rtclib-arduino-libreria-simple-y-eficaz-para-rtc-y-t95.html
GNU Lesser General Public License v3.0
88 stars 24 forks source link

MCU With More Than One I2C #43

Closed mohdrais closed 2 months ago

mohdrais commented 2 months ago

Hello, I am using Pico W and I want to run DS3231 by using I2C1 (Wire1). How to do that? (It works when using I2C0 (Wire).

Naguissa commented 2 months ago

I'll try to define it as constant and try to be able to define it before the include. But last time I tried it didn't work (it was like 2+ years ago)

Naguissa commented 2 months ago

I've seen it's already done for Attiny. You can test it definining URTCLIB_WIRE before including the library:

    #define URTCLIB_WIRE Wire1
    #include "uRTCLib.h"
mohdrais commented 2 months ago

Sorry, it does not work for Pico W. Thank you

On Tue, Aug 6, 2024 at 1:49 PM Naguissa @.***> wrote:

I've seen it's already done for Attiny. You can test it definining URTCLIB_WIRE before including the library:

define URTCLIB_WIRE Wire1

include "uRTCLib.h"

— Reply to this email directly, view it on GitHub https://github.com/Naguissa/uRTCLib/issues/43#issuecomment-2270436136, or unsubscribe https://github.com/notifications/unsubscribe-auth/APBMQ26B675KGWS2OBXM67DZQBPW7AVCNFSM6AAAAABL7LO7FGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZQGQZTMMJTGY . You are receiving this because you authored the thread.Message ID: @.***>

Naguissa commented 2 months ago

Then the quick way is to copy library on Sketch's folder (under libraries folder) and change definition line:

https://github.com/Naguissa/uRTCLib/blob/master/src/uRTCLib.h#L48

Change it from Wire to Wire1

So, this way folders will be like:

[...]/Arduino/YourSketch/libraries/uRTCLib
[...]/Arduino/YourSketch/libraries/uRTCLib/src
[...]/Arduino/YourSketch/libraries/uRTCLib/src/uRTCLib.h ==> This is the modified file
[...]/Arduino/YourSketch/libraries/uRTCLib/src/uRTCLib.cpp
mohdrais commented 2 months ago

Thank you

On Wed, Aug 7, 2024 at 1:18 PM Naguissa @.***> wrote:

Then the quick way is to copy library on Sketch's folder (under libraries folder) and change definition line:

https://github.com/Naguissa/uRTCLib/blob/master/src/uRTCLib.h#L48

Change it from Wire to Wire1

So, this way folders will be like:

[...]/Arduino/YourSketch/libraries/uRTCLib [...]/Arduino/YourSketch/libraries/uRTCLib/src [...]/Arduino/YourSketch/libraries/uRTCLib/src/uRTCLib.h ==> This is the modified file [...]/Arduino/YourSketch/libraries/uRTCLib/src/uRTCLib.cpp

— Reply to this email directly, view it on GitHub https://github.com/Naguissa/uRTCLib/issues/43#issuecomment-2272636732, or unsubscribe https://github.com/notifications/unsubscribe-auth/APBMQ22KTOKFRCW2WIINGOLZQGU2LAVCNFSM6AAAAABL7LO7FGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZSGYZTMNZTGI . You are receiving this because you authored the thread.Message ID: @.***>