Sapphire SoC DS Sapphire SoC UG Sapphire HP SoC DS Sapphire HP SoC UG RISC-V Embedded IDE UG Board Support Package
Loading...
Searching...
No Matches

Overview

Structs used by the driver.

Note
This is example show how to instantiate RTC with rtc_instance_t, rtc_api_t and rtc_data_t.
#define I2C_CTRL_HZ SYSTEM_CLINT_HZ
#define I2C_CTRL (i2c_hwreg_t *)SYSTEM_I2C_1_IO_CTRL
#define I2C_FREQ 100000
#define RTC_CTRL RTC_DS3231_ADDR
#define RTC_DRIVER ds3231_driver
.drv = &RTC_DRIVER,
.inst = &(i2c_instance_t){
.hwreg = I2C_CTRL,
.slaveAddress = RTC_CTRL,
.samplingClockDivider = 3,
.timeout = I2C_CTRL_HZ/1000,
.tsuDat = I2C_CTRL_HZ/(I2C_FREQ*5),
.tLow = I2C_CTRL_HZ/(I2C_FREQ*2),
.tHigh = I2C_CTRL_HZ/(I2C_FREQ*2),
.tBuf = I2C_CTRL_HZ/(I2C_FREQ),
},
};
printf("Current Time: %02d:%02d:%02d %s\n\n", t.hours, t.minutes,
t.seconds, (t.PM) ? "PM" : "AM");
#define printf(...)
Definition bsp.h:65
#define RTC_CTRL
I2C Address for the currently selected RTC (PCF8523).
Definition rtc_config.h:53
#define RTC_DRIVER
Driver Interface Table for the currently selected RTC (PCF8523).
Definition rtc_config.h:58
struct rtc_instance rtc_instance_t
Forward declaration of RTC instance.
Definition rtc.h:110
I2C instance. Holds the software registers and hardware pointer.
Definition i2c.h:259
RTC time data structure.
Definition rtc.h:116
u8 hours
Hours (0-23 or 1-12) *‍/.
Definition rtc.h:119
u8 minutes
Minutes (0-59) *‍/.
Definition rtc.h:118
u8 seconds
Seconds (0-59) *‍/.
Definition rtc.h:117
u8 PM
PM Indicator for 12-hour format (0 = AM, 1 = PM) *‍/.
Definition rtc.h:120
rtc_data_t current_time
Current time data *‍/.
Definition rtc.h:149

Data Structures

struct  rtc_data_t
 RTC time data structure. More...
struct  rtc_api_t
 RTC API structure. More...
struct  rtc_instance
 RTC instance structure. More...

Typedefs

typedef struct rtc_instance rtc_instance_t
 Forward declaration of RTC instance.

Typedef Documentation

◆ rtc_instance_t

typedef struct rtc_instance rtc_instance_t

#include <rtc.h>

Forward declaration of RTC instance.

Definition at line 110 of file rtc.h.