56 #ifndef FOXBMS__RTC_H_
57 #define FOXBMS__RTC_H_
68 #define RTC_I2C_INTERFACE (i2cREG1)
70 #define RTC_I2C_ADDRESS (0x53u)
86 #define RTC_MAX_I2C_TRANSACTION_SIZE_IN_BYTES (10u)
87 #define RTC_WRITE_REGISTER_I2C_TRANSACTION_SIZE_IN_BYTES (2u)
92 #define RTC_REG_CONTROL_1_ADDR (0x0u)
93 #define RTC_CTRL1_STOP_BIT_MASK (0x20u)
94 #define RTC_CTRL1_12_24HOUR_MODE_BIT_MASK (0x04u)
99 #define RTC_REG_CONTROL_3_ADDR (0x02u)
100 #define RTC_CTRL3_BATTERY_PWRMNG_BITS_MASK (0xE0u)
101 #define RTC_CTRL3_BATTERY_PWRMNG_BITS_POSITION (5u)
102 #define RTC_CTRL3_BATTERY_LOW_FLAG_BIT_MASK (0x04u)
103 #define RTC_CTRL3_BATTERY_LOW_FLAG_BIT_POSITION (2u)
108 #define RTC_CTRL3_PWRMNG_DIRECTSWITCH_LOWDETECTIONENABLE_MODE (0b011u)
112 #define RTC_REG_CLKOUT_CTL_ADDR (0x13u)
113 #define RTC_CLKOUT_CTL_OTPR_BIT_MASK (0x20u)
114 #define RTC_CLKOUT_CTL_OTPR_BIT_POSITION (5u)
118 #define RTC_OTPR_BIT_WAIT_TIMEOUT_ms (150u)
121 #define RTC_SECONDS_OSF_BIT_MASK (0x80u)
123 #define RTC_SECONDS_OSF_BIT_POSITION (7u)
127 #define RTC_REG_SOFTWARE_RESET_ADDR (0x5u)
128 #define RTC_SWRESET_CLEARPRESCALER (0xA4u)
133 #define RTC_REG_TIME_START_ADDR (0x06u)
134 #define RTC_100TH_OF_SECONDS_OFFSET (0x0u)
135 #define RTC_SECONDS_OFFSET (0x1u)
136 #define RTC_MINUTES_OFFSET (0x2u)
137 #define RTC_HOURS_OFFSET (0x3u)
138 #define RTC_DAYS_OFFSET (0x4u)
139 #define RTC_WEEKDAYS_OFFSET (0x5u)
140 #define RTC_MONTHS_OFFSET (0x6u)
141 #define RTC_YEARS_OFFSET (0x7u)
145 #define RTC_NUMBER_OF_TIMEDATA_BYTES (8u)
149 #define RTC_TENS_PLACE_FACTOR (10u)
150 #define RTC_TENS_PLACE_OFFSET (4u)
151 #define RTC_HUNDREDTH_OF_SECONDS_TENS_PLACE_MASK (0xF0u)
152 #define RTC_SECONDS_TENS_PLACE_MASK (0x70u)
153 #define RTC_MINUTES_TENS_PLACE_MASK (0x70u)
154 #define RTC_HOURS_TENS_PLACE_MASK (0x30u)
155 #define RTC_DAYS_TENS_PLACE_MASK (0x30u)
156 #define RTC_MONTHS_TENS_PLACE_MASK (0x10u)
157 #define RTC_YEARS_TENS_PLACE_MASK (0xF0u)
162 #define RTC_UNITS_PLACE_MASK (0x0Fu)
163 #define RTC_WEEKDAYS_UNITS_PLACE_MASK (0x07u)
167 #define RTC_START_YEAR (2000)
171 #define RTC_CTIME_YEAR_START (1900)
172 #define RTC_CTIME_MONTH_START (1)
176 #define RTC_MAX_DIFFERENCE_BETWEEN_TIMER_AND_IC_s (1)
178 #define RTC_FACTOR_MIN_TO_MS (60000u)
180 #define RTC_TIME_BETWEEN_RTC_TIMER_ADJUSTMENT_min (60u)
182 #define RTC_TIME_BETWEEN_BLF_FLAG_CHECK_min (10u)
251 #ifdef UNITY_UNIT_TEST
Definition of foxBMS standard types.
void RTC_IncrementSystemTime(void)
increment the RTC system timer.
void RTC_InitializeSystemTimeWithRtc(void)
initialize system time with RTC time.
void RTC_SetSystemTimeRtcFormat(RTC_TIME_DATA_s timeRtcFormat)
set the RTC system timer.
void RTC_Trigger(void)
trigger function for the RTC driver.
STD_RETURN_TYPE_e RTC_Initialize(void)
initialization of the RTC IC.
RTC_TIME_DATA_s RTC_GetSystemTimeRtcFormat(void)
get the RTC system timer.
uint8_t hundredthOfSeconds