32#ifndef ZEPHYR_INCLUDE_DRIVERS_RTC_DS3231_H_
33#define ZEPHYR_INCLUDE_DRIVERS_RTC_DS3231_H_
47#define MAXIM_DS3231_ALARM1 BIT(0)
50#define MAXIM_DS3231_ALARM2 BIT(1)
58#define MAXIM_DS3231_REG_CTRL_A1IE MAXIM_DS3231_ALARM1
61#define MAXIM_DS3231_REG_CTRL_A2IE MAXIM_DS3231_ALARM2
70#define MAXIM_DS3231_REG_CTRL_INTCN BIT(2)
76#define MAXIM_DS3231_REG_CTRL_RS_Pos 3
79#define MAXIM_DS3231_REG_CTRL_RS_Msk (0x03 << MAXIM_DS3231_REG_CTRL_RS_Pos)
82#define MAXIM_DS3231_REG_CTRL_RS_1Hz 0x00
85#define MAXIM_DS3231_REG_CTRL_RS_1KiHz 0x01
88#define MAXIM_DS3231_REG_CTRL_RS_4KiHz 0x02
91#define MAXIM_DS3231_REG_CTRL_RS_8KiHz 0x03
94#define MAXIM_DS3231_REG_CTRL_CONV BIT(5)
97#define MAXIM_DS3231_REG_CTRL_BBSQW BIT(6)
100#define MAXIM_DS3231_REG_CTRL_EOSCn BIT(7),
108#define MAXIM_DS3231_REG_STAT_A1F MAXIM_DS3231_ALARM1
116#define MAXIM_DS3231_REG_STAT_A2F MAXIM_DS3231_ALARM2
119#define MAXIM_DS3231_REG_STAT_BSY BIT(2)
126#define MAXIM_DS3231_REG_STAT_EN32kHz BIT(3)
129#define MAXIM_DS3231_REG_STAT_OSF BIT(7)
145#define MAXIM_DS3231_ALARM_FLAGS_IGNSE BIT(0)
159#define MAXIM_DS3231_ALARM_FLAGS_IGNMN BIT(1)
172#define MAXIM_DS3231_ALARM_FLAGS_IGNHR BIT(2)
186#define MAXIM_DS3231_ALARM_FLAGS_IGNDA BIT(3)
196#define MAXIM_DS3231_ALARM_FLAGS_DOW BIT(4)
207#define MAXIM_DS3231_ALARM_FLAGS_AUTODISABLE BIT(7)
599#include <zephyr/syscalls/maxim_ds3231.h>
_TIME_T_ time_t
Definition _timespec.h:14
Public API for counter and timer drivers.
static uint32_t k_uptime_get_32(void)
Get system uptime (32-bit version).
Definition kernel.h:1852
int maxim_ds3231_stat_update(const struct device *dev, uint8_t set_bits, uint8_t clear_bits)
Read the ctrl_stat register then set and clear bits in it.
int maxim_ds3231_ctrl_update(const struct device *dev, uint8_t set_bits, uint8_t clear_bits)
Set and clear specific bits in the control register.
int maxim_ds3231_req_syncpoint(const struct device *dev, struct k_poll_signal *signal)
Request to update the synchronization point.
int maxim_ds3231_set(const struct device *dev, const struct maxim_ds3231_syncpoint *syncpoint, struct sys_notify *notify)
Set the RTC to a time consistent with the provided synchronization.
int maxim_ds3231_get_syncpoint(const struct device *dev, struct maxim_ds3231_syncpoint *syncpoint)
Retrieve the most recent synchronization point.
void(* maxim_ds3231_notify_callback)(const struct device *dev, struct sys_notify *notify, int res)
Signature used to notify a user of the DS3231 that an asynchronous operation has completed.
Definition maxim_ds3231.h:247
void(* maxim_ds3231_alarm_callback_handler_t)(const struct device *dev, uint8_t id, uint32_t syncclock, void *user_data)
Signature for DS3231 alarm callbacks.
Definition maxim_ds3231.h:230
static uint32_t maxim_ds3231_read_syncclock(const struct device *dev)
Read the local synchronization clock.
Definition maxim_ds3231.h:360
static uint32_t maxim_ds3231_syncclock_frequency(const struct device *dev)
Get the frequency of the synchronization clock.
Definition maxim_ds3231.h:373
int maxim_ds3231_set_alarm(const struct device *dev, uint8_t id, const struct maxim_ds3231_alarm *cfg)
Configure a DS3231 alarm.
int maxim_ds3231_check_alarms(const struct device *dev)
Check for and clear flags indicating that an alarm has fired.
int maxim_ds3231_get_alarm(const struct device *dev, uint8_t id, struct maxim_ds3231_alarm *cfg)
Read a DS3231 alarm configuration.
int maxim_ds3231_synchronize(const struct device *dev, struct sys_notify *notify)
Synchronize the RTC against the local clock.
sighandler_t signal(int signo, sighandler_t handler)
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:403
Information defining the alarm configuration.
Definition maxim_ds3231.h:262
void * user_data
User-provided pointer passed to alarm callback.
Definition maxim_ds3231.h:297
time_t time
Time specification for an RTC alarm.
Definition maxim_ds3231.h:275
maxim_ds3231_alarm_callback_handler_t handler
Handler to be invoked when alarms are signalled.
Definition maxim_ds3231.h:294
uint8_t flags
Flags controlling configuration of the alarm alarm.
Definition maxim_ds3231.h:311
Register the RTC clock against system clocks.
Definition maxim_ds3231.h:320
uint32_t syncclock
Value of a local clock at the same instant as rtc.
Definition maxim_ds3231.h:334
struct timespec rtc
Time from the DS3231.
Definition maxim_ds3231.h:326
State associated with notification for an asynchronous operation.
Definition notify.h:138
Definition _timespec.h:22