PT7C4339-RTC 1.0.0
A library for interfacing with the PT7C4339 RTC chip over I2C in the Arduino framework.
 
Loading...
Searching...
No Matches
PT7C4339-RTC Library

Introduction

This library provides methods for communicating with the PT7C4339 RTC IC over I2C. It enables users to read and set the current time and date, manage the square wave output, control the trickle charger, and use the control mechanisms of the device. More info on the GitHub page: https://github.com/depben/PT7C4339-RTC

How to use

  • Initialization and Communication
    • begin(): Initializes the I2C bus, ensures the device is in 24-hour mode, and checks for stop flag.
  • Time and Date Handling
    • getTime(), setTime(): Retrieve or set the current time (hours, minutes, seconds).
    • getDate(), setDate(): Retrieve or set the current date (year, month, day, weekday).
    • Individual getters/setters for each time/date component: getHour(), setHour(), etc.
    • Automatic weekday calculation on every call of a date setter.
  • Alarm and Output Control
    • Output mode selection: getIntOrSqwFlag(), setIntOrSqwFlag().
    • Square wave output configuration: getSqwFrequency(), setSqwFrequency().
  • Alarm 1 Functions
    • isA1IntEnabled(), enableA1Int(): Check or set if alarm 1 can trigger INT/SQW output.
    • getA1Flag(), clearA1Flag(): Check or clear alarm 1 match flag.
    • getA1Rate(), setA1Rate(): Get or set alarm 1 match rate.
    • getA1Time(), setA1Time(): Get or set alarm 1 time (hour, minute, second).
    • getA1DayDate(), setA1DayDate(): Get or set alarm 1 day/date (by day or weekday).
  • Alarm 2 Functions
    • isA2IntEnabled(), enableA2Int(): Check or set if alarm 2 can trigger INT/SQW output.
    • getA2Flag(), clearA2Flag(): Check or clear alarm 2 match flag.
    • getA2Rate(), setA2Rate(): Get or set alarm 2 match rate.
    • getA2Time(), setA2Time(): Get or set alarm 2 time (hour, minute).
    • getA2DayDate(), setA2DayDate(): Get or set alarm 2 day/date (by day or weekday).
  • Oscillator and Power Management
    • Enable/disable oscillator: isOscillatorEnabled(), enableOscillator().
    • RTC stop flag handling: getRtcStopFlag(), clearRtcStopFlag().
    • Battery-backed interrupt setting: isIntFromBatteryEnabled(), enableIntFromBattery().
  • Trickle Charger Configuration
    • Query and configure the trickle charger: getTrickleChargerEnabled(), getTrickleChargerDiode(), getTrickleChargerResistor(), setTrickleChargerConfig().
  • Device Reset
    • reset(): Restores all registers to their default power-on values.
Note
This library uses 24-hour format for time representation and works from 1900-1-1 to 2099-12-31.
Author
Bence Murin
Date
2025-05-30
Version
1.0.0